:root {
  --azul: #1d4e89; --azul-osc: #153a68; --azul-cl: #e8f0fa; --verde: #1b7f4b; --verde-cl: #e4f5ec;
  --rojo: #b3261e; --rojo-cl: #fdeceb; --ambar: #8a5a00; --ambar-cl: #fff4d6;
  --gris: #f3f5f8; --borde: #cfd6e0; --texto: #1b2430; --suave: #5b6675;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 17px; }
body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; color: var(--texto); background: #eef4fb; line-height: 1.45; }
/* Fondo de la plataforma: ilustración de la familia (public/fondo-familia.png). Para cambiarla, reemplace ese archivo. */
body::before { content: ""; position: fixed; left: 0; right: 0; top: 56px; bottom: 0; z-index: -1; pointer-events: none;
  background: url('/fondo-familia.png') no-repeat center center / contain; opacity: .5; }
body.admin::before { display: none; }
body.admin { background: var(--gris); }
a { color: var(--azul); }
.cabecera { background: var(--azul); color: #fff; padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.cabecera h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.cabecera a.marca { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; padding: 0; }
.marca .logo { width: 40px; height: 40px; flex: none; }
.marca-texto { display: flex; flex-direction: column; line-height: 1.12; }
.marca-texto strong { font-size: 1.2rem; letter-spacing: .07em; font-weight: 800; }
.marca-texto small { font-size: .6rem; letter-spacing: .06em; font-weight: 600; opacity: .88; }
.cabecera nav { display: flex; gap: .5rem; align-items: center; font-size: .9rem; margin-left: auto; }
.cabecera a, .cabecera button.enlace { color: #fff; background: none; border: 0; text-decoration: underline; cursor: pointer; font: inherit; padding: .3rem; }
main { max-width: 760px; margin: 1rem auto; padding: 0 .8rem 2rem; }
.tarjeta { background: rgba(255, 255, 255, .8); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.08); padding: 1.1rem; margin-bottom: 1rem; }
.tarjeta h2 { margin: 0 0 .6rem; font-size: 1.2rem; color: var(--azul); }
.tarjeta h3 { margin: 1rem 0 .4rem; font-size: 1.02rem; }
.suave { color: var(--suave); font-size: .92rem; }
.ayuda-pie { max-width: 760px; margin: 0 auto 2rem; padding: .7rem 1rem; text-align: center; font-size: .92rem; color: #33404f; background: rgba(255, 255, 255, .78); border-radius: 12px; }
.ayuda-pie:empty { display: none; }
.ayuda-pie p { margin: .2rem 0; }
.ayuda-pie .legales { margin-top: .6rem; font-size: .85rem; }

/* formularios */
.campo { margin-bottom: .85rem; }
.campo label, .etiqueta { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel], select, textarea {
  width: 100%; min-height: 46px; padding: .55rem .7rem; font: inherit; border: 1.5px solid var(--borde); border-radius: 8px; background: #fff; color: var(--texto);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #86b3ea; outline-offset: 1px; }
input.invalido, select.invalido, textarea.invalido { border-color: var(--rojo); background: var(--rojo-cl); }
.error { display: block; color: var(--rojo); font-size: .88rem; min-height: 0; margin-top: .2rem; }
.ayuda-campo { display: block; color: var(--suave); font-size: .85rem; margin-top: .2rem; }
.fila { display: grid; grid-template-columns: 1fr; gap: 0 .8rem; }
@media (min-width: 640px) { .fila.dos { grid-template-columns: 1fr 1fr; } .fila.tres { grid-template-columns: 1fr 1fr 1fr; } }
.casilla { display: flex; gap: .6rem; align-items: flex-start; margin: .6rem 0; }
.casilla input { width: 24px; height: 24px; margin-top: .1rem; flex: none; }
.casilla label { font-weight: 400; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1.1rem; font: inherit; font-weight: 600; border: 0; border-radius: 10px; background: var(--azul); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--azul-osc); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.sec { background: #fff; color: var(--azul); border: 1.5px solid var(--azul); }
.btn.sec:hover { background: var(--azul-cl); }
.btn.peligro { background: var(--rojo); }
.btn.ok { background: var(--verde); }
.btn.chico { min-height: 38px; padding: .3rem .8rem; font-size: .9rem; }
.btn.bloque { width: 100%; }
.acciones { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.acciones .derecha { margin-left: auto; }
.barra-nav { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

/* avisos */
.alerta { padding: .75rem .9rem; border-radius: 8px; margin: .6rem 0; font-size: .95rem; }
.alerta.info { background: var(--azul-cl); color: var(--azul-osc); }
.alerta.ok { background: var(--verde-cl); color: #0e5a33; }
.alerta.error { background: var(--rojo-cl); color: var(--rojo); }
.alerta.aviso { background: var(--ambar-cl); color: var(--ambar); }
.alerta ul { margin: .3rem 0 0 1.1rem; padding: 0; }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--azul-cl); color: var(--azul-osc); white-space: nowrap; }
.badge.ok { background: var(--verde-cl); color: #0e5a33; }
.badge.mal { background: var(--rojo-cl); color: var(--rojo); }
.badge.esp { background: var(--ambar-cl); color: var(--ambar); }

/* progreso */
.progreso { height: 8px; background: #dde4ee; border-radius: 99px; overflow: hidden; margin: .4rem 0 .8rem; }
.progreso > div { height: 100%; background: var(--verde); transition: width .3s; }
.pasos { list-style: none; display: flex; gap: .3rem; padding: 0; margin: 0 0 .3rem; overflow-x: auto; }
.pasos li { flex: 1 1 0; min-width: 0; text-align: center; font-size: .72rem; color: var(--suave); }
.pasos li button { display: block; width: 100%; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: .2rem 0; }
.pasos li button[disabled] { cursor: not-allowed; opacity: .6; }
@media (max-width: 560px) { .pasos li > button > span:last-child { display: none; } }
.pasos .num { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; background: #dde4ee; color: var(--texto); font-weight: 700; font-size: .85rem; margin-bottom: .1rem; }
.pasos li.hecho .num { background: var(--verde); color: #fff; }
.pasos li.actual .num { background: var(--azul); color: #fff; box-shadow: 0 0 0 3px #b9d0ee; }
.pasos li.actual { color: var(--azul); font-weight: 700; }

/* tarjetas internas */
.sub { border: 1.5px solid var(--borde); border-radius: 10px; padding: .8rem; margin-bottom: .8rem; background: #fcfdff; }
.sub-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; gap: .5rem; }
.sub-cab strong { color: var(--azul); }
.archivo { border: 2px dashed var(--borde); border-radius: 10px; padding: .7rem; background: #fff; }
.archivo .actual { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; font-size: .9rem; flex-wrap: wrap; }
.archivo input[type=file] { width: 100%; font: inherit; font-size: .9rem; }
.miniatura { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--borde); background: #eee; }
.icono-pdf { display: inline-flex; width: 64px; height: 64px; border-radius: 6px; background: var(--rojo-cl); color: var(--rojo); align-items: center; justify-content: center; font-weight: 700; flex: none; }
.boleta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; align-items: start; }
.boleta > :nth-child(1) { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.boleta > :nth-child(2), .boleta > :nth-child(5) { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .boleta { grid-template-columns: 90px 1fr 1fr 1fr auto; gap: .7rem; }
  .boleta > :nth-child(1) { grid-column: auto; display: block; margin: 0; }
  .boleta > :nth-child(2), .boleta > :nth-child(5) { grid-column: auto; }
}
.totales { width: 100%; border-collapse: collapse; margin: .5rem 0; font-size: .95rem; }
.totales td, .totales th { padding: .35rem .5rem; border-bottom: 1px solid var(--borde); text-align: left; }
.totales td.num, .totales th.num { text-align: right; white-space: nowrap; }
.totales tr.total td { font-weight: 700; border-top: 2px solid var(--azul); }
.resumen dt { font-weight: 600; color: var(--suave); font-size: .85rem; margin-top: .5rem; }
.resumen dd { margin: 0; }
.resumen-cab { display: flex; justify-content: space-between; align-items: center; }
.pago-datos { display: grid; gap: .8rem; }
@media (min-width: 640px) { .pago-datos { grid-template-columns: 1fr 1fr; } }
.qr { max-width: 220px; width: 100%; border: 1px solid var(--borde); border-radius: 8px; }
.grande { font-size: 1.3rem; font-weight: 700; color: var(--azul); overflow-wrap: anywhere; }
.centro { text-align: center; }
.pestanas { display: flex; gap: .3rem; margin-bottom: 1rem; }
.pestanas button { flex: 1; min-height: 46px; font: inherit; font-weight: 600; background: #e6ebf2; border: 0; border-radius: 10px 10px 0 0; cursor: pointer; }
.pestanas button.activa { background: #fff; color: var(--azul); box-shadow: 0 -2px 0 var(--azul) inset; }
.separador { text-align: center; color: var(--suave); margin: .8rem 0; font-size: .9rem; }
.btn-fb { background: #1877f2; }
.btn-fb:hover { background: #1465d0; }

/* modales y avisos flotantes */
.modal-fondo { position: fixed; inset: 0; background: rgba(15, 25, 40, .6); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; max-width: 560px; width: 100%; padding: 1.2rem; box-shadow: 0 10px 40px rgba(0,0,0,.3); max-height: 90vh; overflow-y: auto; }
.modal h2 { margin: 0 0 .6rem; color: var(--azul); font-size: 1.15rem; }
.modal .cuerpo { margin-bottom: 1rem; white-space: pre-line; }
.modal .acciones { justify-content: flex-end; margin-top: .5rem; }
.toast-zona { position: fixed; left: 0; right: 0; bottom: 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; z-index: 60; pointer-events: none; padding: 0 1rem; }
.toast { background: #1b2430; color: #fff; padding: .7rem 1rem; border-radius: 10px; max-width: 520px; box-shadow: 0 4px 16px rgba(0,0,0,.3); pointer-events: auto; }
.toast.error { background: var(--rojo); }
.toast.ok { background: var(--verde); }
.cargando { text-align: center; padding: 2rem; color: var(--suave); }

/* panel admin */
.admin main { max-width: 1100px; }
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
table.tabla th, table.tabla td { padding: .5rem .6rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
table.tabla th { background: var(--azul-cl); color: var(--azul-osc); position: sticky; top: 0; }
table.tabla tr.clic { cursor: pointer; }
table.tabla tr.clic:hover { background: var(--azul-cl); }
.tarjetas-num { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.num-caja { background: #fff; border-radius: 10px; padding: .8rem; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.num-caja strong { display: block; font-size: 1.5rem; color: var(--azul); }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; align-items: end; }
.filtros .campo { margin: 0; flex: 1 1 160px; }
.modal.ancho { max-width: 900px; }
.lista-docs a { display: inline-block; margin: .15rem .6rem .15rem 0; }
@media print { .cabecera, .ayuda-pie, .acciones, .barra-nav { display: none; } }
