/* =========================================================
   Campus + Suma · MESAN Eventos
   Mobile-first · Paleta: navy Campus / teal MESAN / oro 20 años
   ========================================================= */

:root {
  --navy:      #0A2A5C;
  --navy-deep: #061C40;
  --teal:      #00A296;
  --teal-dark: #00867C;
  --teal-soft: #E0F4F2;
  --gold:      #DFAF48;
  --bg:        #F1F5F9;
  --card:      #FFFFFF;
  --ink:       #10233F;
  --muted:     #5B6B82;
  --line:      #D8E2EC;
  --error:     #C6362F;
  --radius:    14px;
  --shadow:    0 8px 24px rgba(6, 28, 64, .10);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Poppins', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }

/* ---------- Cabecera ---------- */
.cabecera {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding-bottom: 26px;
}
.cabecera .banner img { width: 100%; height: auto; }
.cabecera .intro {
  color: #fff;
  text-align: center;
  padding: 18px 20px 0;
  max-width: 640px;
  margin: 0 auto;
}
.cabecera h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: .02em;
}
.cabecera p {
  margin: 0;
  font-size: .9rem;
  color: #C4D3E8;
}
.cabecera .oro { color: var(--gold); font-weight: 600; }

/* ---------- Contenedor ---------- */
.contenedor {
  max-width: 640px;
  margin: -14px auto 0;
  padding: 0 14px 40px;
}

/* ---------- Bloques ---------- */
.bloque {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  margin-bottom: 18px;
}
.bloque-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}
.bloque-titulo .marca {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
}
.bloque-titulo h2 {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0;
}

/* ---------- Campos ---------- */
.campo { margin-bottom: 16px; }
.campo:last-child { margin-bottom: 0; }

label.etiqueta {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

input[type="text"],
input[type="date"],
input[type="tel"],
input[type="email"],
input[type="password"],
.campo input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;              /* evita zoom automático en iOS */
  color: var(--ink);
  background: #FBFDFE;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus-visible {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 162, 150, .18);
}
input.invalido { border-color: var(--error); }

/* ---------- Tarjetas de necesidad (checkbox) ---------- */
.opciones { display: grid; gap: 10px; }
.opcion {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  min-height: 56px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #FBFDFE;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opcion input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.opcion .caja {
  flex: 0 0 24px;
  width: 24px; height: 24px;
  border: 2px solid var(--line);
  border-radius: 7px;
  display: grid;
  place-items: center;
  transition: all .15s;
}
.opcion .caja svg { width: 14px; height: 14px; opacity: 0; }
.opcion .texto strong { display: block; font-size: .95rem; font-weight: 600; }
.opcion .texto span   { font-size: .8rem; color: var(--muted); }
.opcion:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.opcion:has(input:checked) .caja {
  background: var(--teal);
  border-color: var(--teal);
}
.opcion:has(input:checked) .caja svg { opacity: 1; }
.opcion:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(0,162,150,.18); }

/* ---------- Chips de parentesco (radio) ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  position: relative;
  cursor: pointer;
}
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #FBFDFE;
  font-size: .88rem;
  font-weight: 500;
  transition: all .15s;
}
.chip:has(input:checked) span {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.chip:has(input:focus-visible) span {
  box-shadow: 0 0 0 3px rgba(10,42,92,.22);
}

/* ---------- Responsables dinámicos ---------- */
.responsable {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 16px 14px;
  margin-bottom: 14px;
  position: relative;
}
.responsable .cabecera-resp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.responsable .cabecera-resp strong {
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal-dark);
}
.btn-quitar {
  background: none;
  border: none;
  color: var(--error);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}

.btn-secundario {
  width: 100%;
  min-height: 50px;
  background: #fff;
  border: 1.5px dashed var(--teal);
  color: var(--teal-dark);
  border-radius: 12px;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-secundario:hover { background: var(--teal-soft); }

/* ---------- Legal ---------- */
.legal { font-size: .88rem; }
.legal a { color: var(--teal-dark); font-weight: 600; }

/* ---------- Botón enviar ---------- */
.btn-enviar {
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0,162,150,.35);
  transition: transform .12s, box-shadow .12s;
}
.btn-enviar:active { transform: scale(.98); }
.btn-enviar:disabled { opacity: .6; cursor: wait; }

.aviso-error {
  display: none;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #FBE9E8;
  color: var(--error);
  font-size: .88rem;
  font-weight: 500;
}
.aviso-error.visible { display: block; }

/* ---------- Pie ---------- */
.pie {
  background: var(--navy-deep);
  padding: 28px 20px 34px;
  text-align: center;
}
.pie .titulo-pie {
  color: #8FA6C7;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0 0 18px;
}
.pie .logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
}
.pie .logos .arico {
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
}
.pie .logos img { height: 64px; width: auto; }
.pie small { display: block; margin-top: 20px; color: #6E86AC; font-size: .75rem; }

/* ---------- Modal de éxito ---------- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(6,28,64,.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal-fondo.visible { display: flex; }
.modal {
  background: #fff;
  border-radius: 18px;
  max-width: 380px;
  width: 100%;
  padding: 32px 24px;
  text-align: center;
  animation: aparecer .25s ease;
}
@keyframes aparecer {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal .icono {
  width: 68px; height: 68px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--teal-soft);
  display: grid;
  place-items: center;
}
.modal .icono svg { width: 34px; height: 34px; }
.modal h3 { margin: 0 0 8px; font-size: 1.15rem; color: var(--navy); }
.modal p  { margin: 0 0 20px; font-size: .9rem; color: var(--muted); }
.modal button {
  min-height: 48px;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Backend ---------- */
.admin-body { background: var(--bg); }
.admin-topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-topbar .marca-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: .95rem;
}
.admin-topbar img { height: 26px; width: auto; }
.admin-topbar a {
  color: #BFD2EC;
  font-size: .85rem;
  text-decoration: none;
  font-weight: 500;
}
.admin-contenedor { max-width: 1080px; margin: 0 auto; padding: 22px 14px 50px; }

.tarjeta-login {
  max-width: 400px;
  margin: 8vh auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
}
.tarjeta-login .logo-login { margin: 0 auto 18px; height: 54px; width: auto; background: var(--navy); border-radius: 10px; padding: 10px 16px; }
.tarjeta-login h1 { font-size: 1.1rem; text-align: center; color: var(--navy); margin: 0 0 20px; }

.resumen {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.resumen .kpi {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.resumen .kpi b { display: block; font-size: 1.5rem; color: var(--teal-dark); }
.resumen .kpi span { font-size: .78rem; color: var(--muted); }

.tabla-envoltura {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table.listado {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: .88rem;
}
table.listado th {
  text-align: left;
  padding: 12px 14px;
  background: var(--navy);
  color: #fff;
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
table.listado td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.listado tr:last-child td { border-bottom: none; }
.etiqueta-necesidad {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
}
.n-acogida              { background: #E4EEFB; color: var(--navy); }
.n-permanencia          { background: #FBF3DF; color: #8A6A17; }
.n-acogida_permanencia  { background: var(--teal-soft); color: var(--teal-dark); }
.lista-resp { margin: 0; padding-left: 16px; }
.lista-resp li { margin-bottom: 4px; }
.lista-resp small { color: var(--muted); }

.barra-acciones {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.btn-csv {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
}
.sin-datos {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
