:root {
  --tinta: #0F2233;
  --papel: #EEF2F4;
  --superficie: #FFFFFF;
  --pizarra: #4A5A6A;
  --linea: #D3DBE2;
  --senal: #F2B705;
  --senal-tinta: #6E5200;
  --error: #A12A1F;
  --radio: 10px;
  --ancho: 38rem;
  --sans: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --condensada: "IBM Plex Sans Condensed", "Arial Narrow", "IBM Plex Sans", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
}

/* Barra superior con la línea de pulso: el único elemento expresivo de la página */
.barra {
  background: var(--tinta);
  color: #FFFFFF;
  padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.barra__fila {
  max-width: var(--ancho);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.marca {
  font-family: var(--condensada);
  font-weight: 600;
  font-size: 1.375rem;
  letter-spacing: 0.01em;
}
.aval {
  font-size: 0.875rem;
  color: #B9C6D2;
}
.pulso {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 0.5rem;
}
.pulso path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.pulso .pulso__estable { stroke-linecap: butt; }
.pulso__irregular {
  stroke: #5E7489;
  stroke-width: 2;
  transition: opacity 900ms ease;
}
.pulso__estable {
  stroke: var(--senal);
  stroke-width: 3;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 900ms ease;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

h1 {
  font-family: var(--condensada);
  font-weight: 600;
  font-size: clamp(2rem, 7vw, 2.875rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  max-width: 16ch;
}
h2 {
  font-family: var(--condensada);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}
.entrada { color: var(--pizarra); margin: 0 0 2rem; }

/* Formularios */
.campo { margin-bottom: 1.125rem; }
label, legend {
  display: block;
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
}
.opcional { font-weight: 400; color: var(--pizarra); }
input[type="text"], input:not([type]), input[type="email"], input[type="tel"], textarea {
  width: 100%;
  font: inherit;
  color: var(--tinta);
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 0.75rem 0.875rem;
}
textarea { resize: vertical; min-height: 3.25rem; }
input:focus, textarea:focus { border-color: var(--tinta); }
:focus-visible { outline: 3px solid var(--senal); outline-offset: 2px; }

.consentimiento {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-weight: 400;
  color: var(--pizarra);
  margin: 1.5rem 0 1rem;
}
.consentimiento input { margin-top: 0.3rem; width: 1.125rem; height: 1.125rem; accent-color: var(--tinta); flex: none; }

.acciones { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }
.boton {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radio);
  padding: 0.875rem 1.25rem;
  background: var(--tinta);
  color: #FFFFFF;
  cursor: pointer;
}
.boton:hover { background: #1B3650; }
.boton:disabled { opacity: 0.55; cursor: progress; }
.boton--secundario {
  background: transparent;
  color: var(--tinta);
  border: 1px solid var(--linea);
}
.boton--secundario:hover { background: var(--superficie); }
.nota { font-size: 0.9375rem; color: var(--pizarra); margin-top: 1.25rem; }
.error { color: var(--error); font-weight: 500; margin: 0.75rem 0 0; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Conversación */
.registro { display: flex; flex-direction: column; gap: 1.5rem; padding-bottom: 1.5rem; }
.msg { max-width: 100%; }
.msg p { margin: 0 0 0.625rem; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 0.25rem 0 0.625rem; padding-left: 1.25rem; }
.msg li { margin-bottom: 0.25rem; }
.msg--asistente {
  border-left: 3px solid var(--senal);
  padding-left: 1rem;
}
.msg--cliente {
  align-self: flex-end;
  max-width: 85%;
  background: var(--tinta);
  color: #FFFFFF;
  padding: 0.75rem 1rem;
  border-radius: var(--radio) var(--radio) 2px var(--radio);
  white-space: pre-wrap;
}
.escribiendo { color: var(--pizarra); font-size: 0.9375rem; }

.compositor {
  position: sticky;
  bottom: 0;
  background: var(--papel);
  padding: 0.75rem 0 calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
  border-top: 1px solid var(--linea);
}
.compositor__acciones { display: flex; justify-content: space-between; align-items: center; margin-top: 0.625rem; gap: 0.75rem; }
.atajo {
  font: inherit;
  font-size: 0.9375rem;
  background: var(--superficie);
  color: var(--tinta);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.cierre {
  background: var(--superficie);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  padding: 1.5rem;
  margin-top: 0.5rem;
}
.cierre p { margin: 0 0 0.75rem; }
.cierre .boton { display: inline-block; text-decoration: none; margin-top: 0.5rem; }

/* Formulario clásico */
fieldset { border: 0; padding: 0; margin: 0 0 1.75rem; }
.pregunta legend, .pregunta > label { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.ayuda { color: var(--pizarra); font-size: 0.9375rem; margin: 0 0 0.625rem; }
.opcion {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  font-weight: 400;
  padding: 0.375rem 0;
  margin: 0;
}
.pregunta .opcion { font-weight: 400; font-size: 1rem; margin-bottom: 0; }
.opcion input { margin-top: 0.3rem; width: 1.0625rem; height: 1.0625rem; accent-color: var(--tinta); flex: none; }
.bloque {
  font-family: var(--condensada);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 2.25rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--linea);
}
.otro-texto { margin-top: 0.375rem; }

.pie {
  border-top: 1px solid var(--linea);
  padding: 1.25rem;
  color: var(--pizarra);
  font-size: 0.875rem;
}
.pie p { max-width: var(--ancho); margin: 0 auto; }

@media (min-width: 40rem) {
  .acciones { flex-direction: row; }
  main { padding-top: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pulso__irregular, .pulso__estable { transition: none; }
}
