/* Gestión de falleros de una falla.
   El color principal (--falla) se elige en Configuración y la cabecera lo escribe en la página;
   los demás tonos se calculan a partir de él. */
:root {
  --falla: #0a7f8e;
  --falla-osc: color-mix(in srgb, var(--falla) 74%, #000);
  --falla-mas-osc: color-mix(in srgb, var(--falla) 52%, #000);
  --falla-claro: color-mix(in srgb, var(--falla) 45%, #fff);
  --falla-tinte: color-mix(in srgb, var(--falla) 10%, #fff);
  --falla-tinte-2: color-mix(in srgb, var(--falla) 21%, #fff);
  --oro: #e0b12f;
  --oro-osc: #8a6a0c;
  --oro-tinte: #fbf3da;
  --negro: #202020;
  --gris: #313131;

  --fondo: #f3f6f7;
  --panel: #ffffff;
  --borde: #d9e2e4;
  --borde-fuerte: #b3c3c7;
  --texto: #202020;
  --suave: #5e6b6e;
  --ok: #24693a;
  --ok-fondo: #e3f2e7;
  --error: #a3261f;
  --error-fondo: #fbe9e7;
  --aviso: #7a5200;
  --aviso-fondo: #fff4d6;
  --radio: 8px;
  --sombra: 0 1px 2px rgba(4,67,75,.06), 0 3px 10px rgba(4,67,75,.05);
  --ancho-lateral: 236px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.45;
}
a { color: var(--falla); }
a:hover { color: var(--falla-mas-osc); }
h1 { font-size: 1.55rem; margin: .1rem 0 1rem; color: var(--negro); font-weight: 700; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .7rem; color: var(--falla-osc); }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
small, .nota { color: var(--suave); }
.oculto { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }
.derecha { text-align: right; }
.centro { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Menú lateral */
.con-sesion { padding-left: var(--ancho-lateral); }
.lateral {
  position: fixed; inset: 0 auto 0 0; width: var(--ancho-lateral); z-index: 30;
  background: linear-gradient(180deg, var(--falla) 0%, var(--falla-osc) 55%, var(--falla-mas-osc) 100%);
  color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.lateral a { color: #fff; text-decoration: none; }
.marca { display: flex; align-items: center; gap: .7rem; padding: 1rem 1rem .8rem; }
.escudo { width: 52px; height: auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.marca-texto { display: flex; flex-direction: column; line-height: 1.15; }
.marca-texto strong { font-size: 1rem; font-weight: 700; }
.marca-texto small { color: var(--falla-claro); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.ejercicio-actual {
  margin: 0 1rem .8rem; padding: .35rem .7rem; border-radius: 20px;
  background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.18);
  font-weight: 700; font-size: .9rem; display: flex; align-items: center; gap: .5rem;
}
.ejercicio-actual small { color: var(--oro); font-weight: 600; text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; }
.menu { display: flex; flex-direction: column; padding: .2rem .6rem; gap: 2px; }
.menu a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radio); color: #e4f5f7; font-size: .95rem; }
.menu a:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu a.activo { background: #fff; color: var(--falla-osc); font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.menu svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.usuario { margin-top: auto; padding: 1rem; border-top: 1px solid rgba(255,255,255,.15); display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem; }
.usuario-nombre { width: 100%; font-weight: 600; }
.usuario form { margin: 0; }
.usuario a, .usuario .enlace { color: var(--falla-claro); }
.enlace { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; color: var(--falla); }
.barra-movil { display: none; }

.contenido { padding: 1.4rem 1.8rem 3rem; max-width: 1400px; }

@media (max-width: 860px) {
  .con-sesion { padding-left: 0; }
  .lateral { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .lateral.abierto { transform: none; }
  .barra-movil { display: flex; align-items: center; gap: .8rem; background: var(--falla); padding: .4rem 1rem; position: sticky; top: 0; z-index: 20; }
  .boton-menu { background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; padding: .2rem .4rem; }
  .logo-movil { height: 36px; }
  .contenido { padding: 1rem; }
}

/* ---------- Avisos */
.aviso { padding: .7rem 1rem; border-radius: var(--radio); margin: 0 0 1rem; border: 1px solid transparent; }
.aviso-ok { background: var(--ok-fondo); color: var(--ok); border-color: #c4dfcb; }
.aviso-error { background: var(--error-fondo); color: var(--error); border-color: #efc6c1; }
.aviso-info { background: var(--falla-tinte); color: var(--falla-mas-osc); border-color: var(--falla-tinte-2); }
.aviso-atencion { background: var(--aviso-fondo); color: var(--aviso); border-color: #f0dca0; }
.aviso ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* ---------- Botones */
.boton {
  display: inline-flex; align-items: center; gap: .35rem; justify-content: center;
  padding: .5rem .95rem; border-radius: var(--radio); border: 1px solid var(--borde-fuerte);
  background: #fff; color: var(--texto); font: inherit; font-size: .93rem; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.boton:hover { border-color: var(--falla); color: var(--falla-osc); }
.boton.primario { background: var(--falla); border-color: var(--falla); color: #fff; }
.boton.primario:hover { background: var(--falla-osc); border-color: var(--falla-osc); color: #fff; }
.boton.peligro { color: var(--error); border-color: #e0b4ae; }
.boton.peligro:hover { background: var(--error-fondo); border-color: var(--error); }
.boton.oro { background: var(--oro); border-color: var(--oro); color: var(--negro); }
.boton.pequeno { padding: .25rem .6rem; font-size: .83rem; }
.boton[disabled] { opacity: .5; cursor: not-allowed; }
.botones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.titulo-seccion { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.titulo-seccion h1 { margin-bottom: .3rem; }
.subtitulo { color: var(--suave); margin: -.6rem 0 1rem; }
.migas { font-size: .88rem; margin-bottom: .3rem; color: var(--suave); }
.migas a { text-decoration: none; }

/* ---------- Paneles */
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.1rem 1.25rem; box-shadow: var(--sombra); margin-bottom: 1.2rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.rejilla { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.rejilla-2-1 { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 1100px) { .rejilla-2-1 { grid-template-columns: 1fr; } }

/* Cifras del panel de inicio */
.cifras { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1.4rem; }
.cifra { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.15rem; box-shadow: var(--sombra); border-top: 4px solid var(--falla); text-decoration: none; color: inherit; display: block; }
.cifra:hover { border-color: var(--falla); color: inherit; }
.cifra.oro { border-top-color: var(--oro); }
.cifra.rojo { border-top-color: var(--error); }
.cifra .valor { font-size: 1.9rem; font-weight: 700; color: var(--negro); line-height: 1.1; display: block; font-variant-numeric: tabular-nums; }
.cifra .cifra-texto { color: var(--suave); font-size: .88rem; }
.cifra .detalle { font-size: .82rem; color: var(--suave); margin-top: .35rem; display: block; }
.barra-progreso { display: block; height: 8px; background: var(--falla-tinte); border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.barra-progreso span { display: block; height: 100%; background: var(--falla); }

/* ---------- Tablas */
.tabla-envoltura { overflow-x: auto; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); margin-bottom: 1rem; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--panel); }
.tabla th { text-align: left; font-weight: 600; color: var(--falla-mas-osc); background: var(--falla-tinte); padding: .55rem .7rem; border-bottom: 1px solid var(--falla-tinte-2); white-space: nowrap; position: sticky; top: 0; }
.tabla td { padding: .5rem .7rem; border-bottom: 1px solid #edf1f2; vertical-align: top; }
.tabla tbody tr:hover td { background: #f6fbfb; }
.tabla tr[data-href] { cursor: pointer; }
.tabla tr.baja td { color: var(--suave); }
.tabla tr.baja td a { color: var(--suave); }
.tabla td.importe, .tabla th.importe { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tfoot td { font-weight: 700; background: #fafcfc; border-top: 2px solid var(--borde); }
.tabla .casilla { width: 2rem; }
.panel .tabla th { position: static; }
.panel > .tabla { margin: 0 -.2rem; }
.vacio { color: var(--suave); padding: 1.2rem; text-align: center; background: var(--panel); border: 1px dashed var(--borde-fuerte); border-radius: var(--radio); }

/* Etiquetas de estado */
.etiqueta { display: inline-block; padding: .08rem .5rem; border-radius: 10px; font-size: .78rem; font-weight: 600; background: #eef1f2; color: var(--gris); white-space: nowrap; }
.etiqueta.pendiente { background: var(--aviso-fondo); color: var(--aviso); }
.etiqueta.cobrado, .etiqueta.alta { background: var(--ok-fondo); color: var(--ok); }
.etiqueta.devuelto, .etiqueta.baja { background: var(--error-fondo); color: var(--error); }
.etiqueta.anulado { background: #eceeef; color: #777; text-decoration: line-through; }
.etiqueta.cargo { background: var(--oro-tinte); color: var(--oro-osc); }
.etiqueta.cat { background: var(--falla-tinte); color: var(--falla-mas-osc); }

/* ---------- Filtros */
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filtros input[type=search] { min-width: 260px; flex: 1; max-width: 420px; }
.contador { margin-left: auto; color: var(--suave); font-size: .92rem; }
@media (max-width: 600px) {
  .filtros input[type=search] { min-width: 0; flex-basis: 100%; max-width: none; }
  .filtros select, .filtros input { max-width: 100%; min-width: 0; }
  .contador { margin-left: 0; }
}

/* ---------- Formularios */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
  font: inherit; font-size: .95rem; padding: .45rem .6rem; border: 1px solid var(--borde-fuerte); border-radius: 6px; background: #fff; color: var(--texto); max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--falla-claro); outline-offset: 0; border-color: var(--falla); }
textarea { width: 100%; min-height: 80px; resize: vertical; }
.campos { display: grid; gap: .8rem 1rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.campo { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.campo label, .campo .rotulo { font-size: .82rem; font-weight: 600; color: var(--suave); }
.campo input, .campo select, .campo textarea { width: 100%; }
.campo.ancho-2 { grid-column: span 2; }
.campo.ancho-3 { grid-column: span 3; }
.campo.completo { grid-column: 1 / -1; }
@media (max-width: 600px) { .campo.ancho-2, .campo.ancho-3 { grid-column: 1 / -1; } }
.campo .ayuda { font-size: .78rem; color: var(--suave); }
.campo .error { font-size: .8rem; color: var(--error); }
input.invalido { border-color: var(--error); background: #fff8f7; }
.casillas { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.casillas label { display: flex; gap: .4rem; align-items: center; font-size: .93rem; }
fieldset { border: 0; padding: 0; margin: 0; }
.formulario-pie { display: flex; gap: .6rem; margin-top: 1.2rem; align-items: center; flex-wrap: wrap; }
.formulario-linea { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.formulario-linea .campo { min-width: 150px; }

/* ---------- Ficha del fallero */
.ficha-cabecera { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.foto { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--falla-tinte); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--falla-tinte-2); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; color: var(--falla); flex: none; }
.ficha-cabecera h1 { margin: 0 0 .3rem; }
.ficha-datos { display: flex; gap: .4rem .9rem; flex-wrap: wrap; color: var(--suave); font-size: .92rem; align-items: center; }
.ficha-acciones { margin-left: auto; }
.pestanas { display: flex; gap: .2rem; border-bottom: 2px solid var(--borde); margin-bottom: 1.2rem; overflow-x: auto; }
.pestanas a { padding: .6rem 1rem; text-decoration: none; color: var(--suave); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.pestanas a:hover { color: var(--falla); }
.pestanas a.activa { color: var(--falla-osc); border-bottom-color: var(--falla); }
.pestanas .num { background: var(--falla-tinte); color: var(--falla-osc); border-radius: 9px; padding: 0 .4rem; font-size: .78rem; margin-left: .2rem; }
.resumen-deuda { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.resumen-deuda div { display: flex; flex-direction: column; }
.resumen-deuda strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { padding: .45rem 0; border-bottom: 1px solid #edf1f2; display: flex; justify-content: space-between; gap: 1rem; }
.lista-simple li:last-child { border-bottom: 0; }
.historial li { font-size: .88rem; display: block; }
.historial time { color: var(--suave); margin-right: .5rem; font-variant-numeric: tabular-nums; }
dl.datos { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; font-size: .93rem; }
dl.datos dt { color: var(--suave); }
dl.datos dd { margin: 0; }

/* ---------- Paginación */
.paginacion { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; margin: 1rem 0; }
.paginacion a, .paginacion span { padding: .35rem .7rem; border-radius: 6px; border: 1px solid var(--borde); background: #fff; text-decoration: none; font-size: .9rem; }
.paginacion .actual { background: var(--falla); color: #fff; border-color: var(--falla); }
.paginacion .desactivado { color: #b5bfc2; }

/* ---------- Acceso */
.sin-sesion { min-height: 100vh; background: linear-gradient(160deg, var(--falla) 0%, var(--falla-mas-osc) 100%); display: flex; align-items: center; justify-content: center; }
.sin-sesion .contenido { width: 100%; max-width: 420px; padding: 1rem; }
.caja-acceso { background: #fff; border-radius: 14px; padding: 2rem 2rem 1.6rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); text-align: center; }
.caja-acceso .escudo-grande { width: 120px; margin: -4.5rem auto .6rem; display: block; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.caja-acceso h1 { font-size: 1.3rem; margin: 0 0 .2rem; }
.caja-acceso p.nota { margin: 0 0 1.3rem; }
.caja-acceso form { text-align: left; display: flex; flex-direction: column; gap: .8rem; }
.caja-acceso .boton { width: 100%; padding: .65rem; }
.caja-acceso .aviso { text-align: left; }

/* ---------- Menú de administración y listados */
.tarjetas { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tarjeta { display: block; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.15rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); border-left: 4px solid var(--falla); }
.tarjeta:hover { border-color: var(--falla); color: var(--texto); background: #fbfefe; }
.tarjeta strong { display: block; color: var(--falla-osc); margin-bottom: .2rem; }
.tarjeta span { font-size: .88rem; color: var(--suave); }

/* ---------- Recibo imprimible */
.recibo-imprimible { background: #fff; max-width: 720px; margin: 0 auto; padding: 2rem; border: 1px solid var(--borde); border-radius: var(--radio); }
.recibo-cabecera { display: flex; align-items: center; gap: 1rem; border-bottom: 3px solid var(--falla); padding-bottom: 1rem; margin-bottom: 1.2rem; }
.recibo-cabecera img { width: 80px; }
.recibo-cabecera h1 { margin: 0; font-size: 1.3rem; }
.recibo-total { font-size: 1.6rem; font-weight: 700; text-align: right; margin-top: 1rem; color: var(--falla-osc); }
.sello { display: inline-block; border: 3px solid var(--ok); color: var(--ok); padding: .3rem 1rem; font-weight: 700; text-transform: uppercase; transform: rotate(-6deg); border-radius: 6px; letter-spacing: .1em; }

.cabecera-impresion { display: none; }

@media print {
  .con-sesion { padding: 0; }
  .lateral, .barra-movil, .no-imprimir, .filtros, .paginacion, .aviso, .botones, .titulo-seccion .boton { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .contenido { padding: 0; max-width: none; }
  .tabla-envoltura, .panel, .recibo-imprimible { box-shadow: none; border: 0; }
  .tabla th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; position: static; }
  .tabla td, .tabla th { padding: .25rem .4rem; }
  .cabecera-impresion { display: flex; align-items: center; gap: .8rem; border-bottom: 2px solid #000; margin-bottom: .6rem; padding-bottom: .4rem; }
  .cabecera-impresion img { width: 40px; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Añadidos v2 */
.nombre-movil { color: #fff; font-size: 1rem; }
.progreso-jcf { display: grid; gap: .3rem; margin: .6rem 0; }
.progreso-jcf .fila { display: grid; grid-template-columns: 9rem 1fr 4.5rem; gap: .6rem; align-items: center; font-size: .88rem; }
.progreso-jcf .barra-progreso { margin: 0; }
.progreso-jcf .barra-progreso span.cumple { background: var(--ok); }
.recompensa-jcf { display: flex; gap: .8rem; align-items: center; padding: .8rem 1rem; border-radius: var(--radio); background: var(--oro-tinte); border: 1px solid #efdca2; margin-bottom: 1rem; }
.recompensa-jcf .medalla { width: 42px; height: 42px; border-radius: 50%; background: var(--oro); color: var(--negro); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.recompensa-jcf strong { display: block; }
.recompensa-jcf small { color: var(--oro-osc); }
.tabla .grupo-fila td { background: #fafcfc; font-weight: 600; color: var(--falla-osc); }
.actividad-tarjeta { display: flex; gap: 1rem; align-items: flex-start; }
.actividad-fecha { flex: none; width: 64px; text-align: center; border-radius: var(--radio); background: var(--falla); color: #fff; padding: .4rem 0; line-height: 1.1; }
.actividad-fecha strong { display: block; font-size: 1.5rem; }
.actividad-fecha small { color: #fff; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.etiqueta.abierta { background: var(--ok-fondo); color: var(--ok); }
.etiqueta.cerrada { background: #eceeef; color: #666; }
.muestra-color { display: inline-block; width: 1.2rem; height: 1.2rem; border-radius: 4px; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }
.logo-vista { max-height: 96px; max-width: 220px; display: block; margin-bottom: .6rem; }
.interruptor { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid #edf1f2; }
.interruptor:last-child { border-bottom: 0; }
.interruptor input { margin-top: .25rem; }
.interruptor small { display: block; }

/* ---------- Portal del fallero (móvil primero) */
.portal-dentro { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.portal-cabecera { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--falla); color: #fff; padding: .55rem 1rem; padding-top: calc(.55rem + env(safe-area-inset-top)); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.portal-marca { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; }
.portal-marca:hover { color: #fff; }
.portal-marca img { height: 38px; width: auto; }
.portal-yo { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; text-decoration: none; }
.portal-contenido { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 1.5rem; }
.portal-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: #fff; border-top: 1px solid var(--borde);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.portal-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem .2rem .5rem; font-size: .7rem; color: var(--suave); text-decoration: none; }
.portal-nav a.activo { color: var(--falla); font-weight: 700; }
.portal-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal h1 { font-size: 1.35rem; }
.portal .panel { padding: 1rem; }
.tarjeta-portal { display: block; background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 1rem; margin-bottom: .8rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); }
.tarjeta-portal:hover { color: var(--texto); border-color: var(--falla); }
.tarjeta-portal .actividad-tarjeta h3 { margin: 0 0 .2rem; color: var(--falla-osc); }
.saludo { margin: .2rem 0 1rem; }
.saludo small { display: block; color: var(--suave); }
.lista-recibos li { align-items: center; }
.portal .boton { padding: .65rem 1rem; }
.casilla-grande { display: flex; gap: .7rem; align-items: center; padding: .7rem .8rem; border: 1px solid var(--borde); border-radius: 10px; margin-bottom: .5rem; background: #fff; }
.casilla-grande input { width: 1.25rem; height: 1.25rem; }
.casilla-grande.hecho { background: var(--ok-fondo); border-color: #c4dfcb; }
@media (min-width: 900px) { .portal-nav { max-width: 720px; margin: 0 auto; border: 1px solid var(--borde); border-bottom: 0; border-radius: 12px 12px 0 0; } }
/* Que los textos largos no ensanchen la página en el móvil */
dl.datos { grid-template-columns: max-content minmax(0, 1fr); }
dl.datos dd, .recompensa-jcf > div, .actividad-tarjeta > div, .lista-simple li > span, .tarjeta-portal { min-width: 0; overflow-wrap: anywhere; }
.portal-cabecera, .portal-contenido { max-width: 100vw; }
.portal-marca { min-width: 0; }
.portal-marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-nav a { min-width: 0; }
.portal-nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- Botones rápidos de filtro */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 18px; border: 1px solid var(--borde-fuerte);
  background: #fff; color: var(--texto); text-decoration: none; font-size: .88rem; font-weight: 600; }
.chip:hover { border-color: var(--falla); color: var(--falla-osc); }
.chip.activo { background: var(--falla); border-color: var(--falla); color: #fff; }
.chip .num { font-size: .75rem; font-weight: 700; background: var(--falla-tinte); color: var(--falla-osc); border-radius: 9px; padding: 0 .4rem; }
.chip.activo .num { background: rgba(255,255,255,.25); color: #fff; }
.chips-sep { width: 1px; height: 1.4rem; background: var(--borde-fuerte); margin: 0 .3rem; }
.mas-filtros summary { cursor: pointer; color: var(--falla); font-size: .9rem; padding: .4rem .2rem; }
.tabla th a.ordenar { color: inherit; text-decoration: none; }
.tabla th a.ordenar:hover, .tabla th a.ordenar.activo { color: var(--falla); text-decoration: underline; }
.etiqueta.jcf { background: #ede7f6; color: #5b3d99; }

.menu a.enlace-portal { margin-top: .6rem; border: 1px dashed rgba(255,255,255,.35); }
.tabla-compacta td, .tabla-compacta th { padding: .3rem .5rem; }

/* ---------- Gestión desde la app (cobros, barra) */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: #fff; border: 1px solid var(--borde); border-radius: 14px; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); min-height: 120px; }
.tile:hover { border-color: var(--falla); color: var(--texto); }
.tile-ico { font-size: 1.8rem; }
.tile small { color: var(--suave); font-size: .78rem; }
.productos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.producto { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 78px; padding: .5rem;
  border-radius: 12px; border: 1px solid var(--borde-fuerte); background: #fff; font: inherit; cursor: pointer; }
.producto small { color: var(--suave); }
.producto.marcado { border-color: var(--falla); background: var(--falla-tinte); }
.producto .cant { position: absolute; top: -6px; right: -6px; background: var(--falla); color: #fff; border-radius: 12px; min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.ticket-total { display: flex; justify-content: space-between; align-items: center; margin-top: .8rem; }
.ticket-total strong { font-size: 1.8rem; display: block; }
.producto .cant[hidden] { display: none; }

/* ---------- Elegir fallero con el dedo (barra en la app) */
.pf-boton { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; min-height: 58px; padding: .6rem .9rem; font: inherit; font-weight: 600; font-size: 1.05rem;
  text-align: left; background: #fff; border: 2px dashed var(--borde-fuerte); border-radius: 12px; color: var(--texto); cursor: pointer; }
.pf-boton small { font-weight: 400; font-size: .8rem; color: var(--suave); }
.pf-boton.elegido { border-style: solid; border-color: var(--falla); background: var(--falla-tinte); }
.pf-capa { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--fondo); }
.pf-capa[hidden] { display: none; }
.pf-cabeza { display: flex; gap: .5rem; padding: .7rem; background: var(--panel); border-bottom: 1px solid var(--borde); }
.pf-cabeza input { flex: 1; min-width: 0; font-size: 1.05rem; padding: .6rem .7rem; }
.pf-lista { flex: 1; overflow-y: auto; padding: .5rem .7rem 2rem; -webkit-overflow-scrolling: touch; }
.pf-titulo { margin: .7rem 0 .3rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
.pf-titulo[hidden], .pf-fila[hidden] { display: none; }
.pf-fila { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: 100%; min-height: 52px; margin-bottom: .35rem; padding: .5rem .8rem;
  font: inherit; text-align: left; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; color: var(--texto); cursor: pointer; }
.pf-fila:active { background: var(--falla-tinte); border-color: var(--falla); }
.pf-fila small { color: var(--suave); white-space: nowrap; }
.pf-fila strong { color: var(--error); white-space: nowrap; }
.producto .cant { cursor: pointer; }
.boton[disabled] { opacity: .5; cursor: not-allowed; }
.campo input[type="file"] { max-width: 100%; min-width: 0; }
