/* Área de clientes · Fibra Sanctipetri
   Colores y tipografía de fibrasanctipetri.es (azul #1d3d94, naranja #f26522, Poppins).
   Todo en rem para que respete la letra grande del sistema; nada de alturas fijas. */

@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url("fuentes/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("fuentes/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("fuentes/poppins-700.woff2") format("woff2"); }

:root {
  --azul: #1d3d94;
  --azul-oscuro: #142c6b;
  --azul-claro: #e8edf9;
  --naranja: #f26522;
  --naranja-texto: #b3440c;      /* naranja con contraste suficiente sobre blanco */
  --naranja-claro: #fdeee6;
  --texto: #1a202c;
  --texto-suave: #4a5568;
  --borde: #cbd5e0;
  --fondo: #f7fafc;
  --blanco: #ffffff;
  --ok: #13612e;
  --ok-claro: #e6f4ea;
  --error: #b82105;
  --error-claro: #fdecea;
  --radio: 0.875rem;
  --sombra: 0 1px 3px rgba(26, 32, 44, 0.12);
  --hueco: 1rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* iPhone: «Tamaño del texto» del sistema (Dynamic Type) mueve todos los rem. */
@supports (font: -apple-system-body) {
  html { font: -apple-system-body; }
}
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fondo);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; }
a { color: var(--azul); }
:focus-visible { outline: 3px solid var(--naranja); outline-offset: 2px; }
[hidden] { display: none !important; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Cabecera ---------- */
.cabecera {
  background: var(--azul);
  color: var(--blanco);
  padding: max(0.75rem, env(safe-area-inset-top)) var(--hueco) 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
}
.cabecera .logo { display: block; height: 2.5rem; width: auto; max-width: 60vw; }
.cabecera .volver {
  background: transparent;
  color: var(--blanco);
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  min-height: 2.75rem;
  cursor: pointer;
}
.cabecera .espacio { flex: 1; }
.cabecera .ayuda-cab { color: var(--blanco); font-weight: 600; text-decoration: none; padding: 0.4rem 0; }

/* ---------- Contenido ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--hueco) var(--hueco) 2rem;
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 1rem; color: var(--azul); }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 1.5rem 0 0.75rem; color: var(--azul); }
p { margin: 0 0 1rem; }
.suave { color: var(--texto-suave); }
.centrado { text-align: center; }

.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1rem;
  margin-bottom: 1rem;
}
.tarjeta h2 { margin-top: 0; }
.tarjeta.destacada { border-left: 6px solid var(--naranja); }
.dato { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.5rem 0; border-bottom: 1px solid #edf2f7; }
.dato:last-child { border-bottom: 0; }
.dato .etiqueta { color: var(--texto-suave); }
.dato .valor { font-weight: 600; text-align: right; }
.importe { font-size: 1.6rem; font-weight: 700; color: var(--azul); line-height: 1.2; }

/* ---------- Formularios ---------- */
label { display: block; font-weight: 600; margin: 1rem 0 0.35rem; }
.ayuda { display: block; font-size: 0.92rem; color: var(--texto-suave); margin-top: 0.3rem; font-weight: 400; }
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--borde);
  border-radius: 0.6rem;
  background: var(--blanco);
  color: var(--texto);
  min-height: 3.25rem;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, textarea:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px rgba(29, 61, 148, 0.25); }
input.codigo { font-size: 1.8rem; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.campo-clave { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }
.campo-clave input { flex: 1 1 8rem; min-width: 0; }
.campo-clave .boton { flex: 0 0 auto; width: auto; margin: 0; }

.boton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.25rem;
  margin: 1.25rem 0 0;
  padding: 0.7rem 1.2rem;
  border: 2px solid var(--azul);
  border-radius: 999px;
  background: var(--azul);
  color: var(--blanco);
  font: inherit;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.boton:hover { background: var(--azul-oscuro); }
.boton:disabled { opacity: 0.6; cursor: wait; }
.boton.secundario { background: var(--blanco); color: var(--azul); }
.boton.secundario:hover { background: var(--azul-claro); }
.boton.naranja { background: var(--naranja); border-color: var(--naranja); color: #1a1a1a; }
.boton.peligro { background: var(--blanco); color: var(--error); border-color: var(--error); }
.enlace {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  padding: 0.75rem 0.25rem;
  min-height: 3rem;
  font: inherit;
  font-weight: 600;
  color: var(--azul);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: center;
  cursor: pointer;
}

.aviso { border-radius: 0.6rem; padding: 0.85rem 1rem; margin: 1rem 0; border: 2px solid; }
.aviso p:last-child { margin-bottom: 0; }
.aviso.error { background: var(--error-claro); border-color: var(--error); color: #5c1003; }
.aviso.ok { background: var(--ok-claro); border-color: var(--ok); color: #0b3d1c; }
.aviso.info { background: var(--azul-claro); border-color: var(--azul); }
.aviso.atencion { background: var(--naranja-claro); border-color: var(--naranja); color: #4a1d05; }
.aviso ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }

.reglas { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.reglas li { padding: 0.15rem 0 0.15rem 1.9rem; position: relative; color: var(--texto-suave); }
.reglas li::before { content: "○"; position: absolute; left: 0.3rem; font-weight: 700; }
.reglas li.cumple { color: var(--ok); }
.reglas li.cumple::before { content: "✓"; }

/* ---------- Menú de inicio ---------- */
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 0.75rem; margin: 1rem 0; }
.menu > * { min-width: 0; }
.opcion .textos { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.opcion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  background: var(--blanco);
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  padding: 0.9rem;
  min-height: 5.5rem;
  color: var(--texto);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--sombra);
}
.opcion:hover { border-color: var(--azul); }
.opcion .icono { width: 2rem; height: 2rem; color: var(--naranja); flex: 0 0 auto; }
.opcion .icono svg { width: 100%; height: 100%; }
.opcion .extra { font-weight: 400; font-size: 0.92rem; color: var(--texto-suave); }
.opcion.urgente { border-color: var(--naranja); }

.direccion-actual { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.direccion-actual .texto { flex: 1 1 12rem; }

/* ---------- Listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: 0.9rem 1rem; margin-bottom: 0.75rem; box-shadow: var(--sombra); }
.fila { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; }
.fila .principal { font-weight: 600; }
.etiqueta-estado { display: inline-block; border-radius: 999px; padding: 0.1rem 0.7rem; font-size: 0.92rem; font-weight: 600; border: 1.5px solid; white-space: nowrap; }
.estado-pagada, .estado-resuelta { color: var(--ok); background: var(--ok-claro); }
.estado-pendiente, .estado-recibida { color: var(--naranja-texto); background: var(--naranja-claro); }
.estado-en-curso { color: var(--azul); background: var(--azul-claro); }
.estado-otra { color: var(--texto-suave); background: #edf2f7; }

.elegible {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--blanco);
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  padding: 1rem;
  margin-bottom: 0.75rem;
  font: inherit;
  color: var(--texto);
  cursor: pointer;
  box-shadow: var(--sombra);
  min-height: 3.5rem;
}
.elegible:hover, .elegible[aria-pressed="true"] { border-color: var(--azul); background: var(--azul-claro); }
.elegible strong { display: block; font-size: 1.1rem; }

.secreto { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.04em; background: var(--azul-claro); border-radius: 0.5rem; padding: 0.35rem 0.6rem; word-break: break-all; }

/* ---------- Pie ---------- */
.pie { text-align: center; padding: 1.25rem var(--hueco) max(1.25rem, env(safe-area-inset-bottom)); color: var(--texto-suave); font-size: 0.95rem; }
.pie a { font-weight: 600; }

/* ---------- Diálogos ---------- */
dialog {
  border: 0;
  border-radius: var(--radio);
  padding: 1.25rem;
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  color: var(--texto);
}
dialog::backdrop { background: rgba(10, 20, 50, 0.55); }
dialog h2 { margin-top: 0; }
dialog .botones { display: flex; flex-direction: column; gap: 0; }
.pasos { padding-left: 1.4rem; }
.pasos li { margin-bottom: 0.6rem; }
.icono-compartir { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.25em; color: #0a84ff; }

.cargando { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 2.5rem 0; color: var(--texto-suave); }
.cargando::before { content: ""; width: 1.6rem; height: 1.6rem; border: 3px solid var(--azul-claro); border-top-color: var(--azul); border-radius: 50%; animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cargando::before { animation-duration: 3s; } }

.sin-conexion { background: #4a1d05; color: var(--blanco); text-align: center; padding: 0.5rem var(--hueco); font-weight: 600; }

/* Pantallas muy estrechas (320 px) o letra muy grande: una columna y menos márgenes. */
@media (max-width: 22rem) {
  :root { --hueco: 0.75rem; }
  h1 { font-size: 1.35rem; }
  .menu { grid-template-columns: 1fr; }
  .opcion { flex-direction: row; align-items: center; gap: 0.75rem; min-height: 3.75rem; }
}

.boton.compacto { width: auto; margin: 0; }
.importe.pequeno { font-size: 1.25rem; }
.sin-margen { margin: 0.35rem 0 0; }
