:root {
  color-scheme: light;
  --azul: #123d61;
  --azul-oscuro: #102a42;
  --texto: #172e42;
  --secundario: #455c70;
  --borde: #d7e1ea;
  --suave: #f3f7fa;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: var(--texto);
  background: #fff;
  line-height: 1.5;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
p, h1, h2, h3, h4, dl, dd { margin: 0; }
.contenedor { width: min(100% - 3rem, 56rem); margin-inline: auto; }

.institucion { border-top: 4px solid var(--azul); border-bottom: 1px solid var(--borde); }
.institucion .contenedor {
  min-height: 4.25rem;
  padding-block: .875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  flex-wrap: wrap;
}
.institucion p { color: var(--azul); font-size: .875rem; font-weight: 750; letter-spacing: .055em; }

main { padding-block: 2rem 4rem; }
h1 {
  color: var(--azul-oscuro);
  font-size: clamp(1.875rem, 3.5vw, 2.75rem);
  line-height: 1.13;
  letter-spacing: -.035em;
  font-weight: 740;
  text-wrap: balance;
}
.estado { margin-block: 1.25rem 1.75rem; min-height: 2rem; }
.mensaje { color: var(--azul); font-weight: 700; }
.detalle { color: var(--secundario); margin-top: .375rem; }
.valido .mensaje {
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  padding: .3125rem .6875rem;
  color: #175445;
  background: #eaf5f1;
  border-radius: .25rem;
  font-size: .875rem;
}
.valido .mensaje::before {
  content: "";
  width: .37rem;
  height: .66rem;
  border: solid currentColor;
  border-width: 0 .12rem .12rem 0;
  transform: translateY(-.08rem) rotate(45deg);
  flex: none;
}
.error { border-left: 3px solid #aa443b; padding: .875rem 1rem; background: #fcf5f4; }
.error .mensaje { color: #8c312a; }

.resumen {
  background: var(--suave);
  border-block: 1px solid var(--borde);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .875rem 1.75rem;
}
.resumen dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem .875rem; align-content: start; }
.resumen dt, .atribuciones dt { font-size: .875rem; color: var(--secundario); font-weight: 600; }
.resumen dd, .atribuciones dd { overflow-wrap: anywhere; }
.nombre-paciente { grid-column: 1 / -1; }
.nombre-paciente dd { color: var(--azul-oscuro); font-size: 1.125rem; font-weight: 730; }
time { font-variant-numeric: tabular-nums; }
.emision > div:first-child { grid-column: 1 / -1; }

.examen { margin-top: 2.25rem; }
h2 { border-top: 2px solid var(--azul); padding-top: .625rem; color: var(--azul); font-size: 1.5rem; letter-spacing: -.015em; }
h3 { color: var(--azul); font-size: 1.0625rem; margin-block: 1.125rem .25rem; }
.contexto { color: var(--secundario); font-size: .875rem; overflow-wrap: anywhere; }
.examen-meta { margin-top: .1875rem; }
.pendiente { margin-top: .625rem; font-weight: 650; }
.resultados { border-collapse: collapse; width: 100%; table-layout: fixed; margin-top: .6875rem; text-align: left; }
.resultados th, .resultados td { padding: .4375rem .625rem; border-bottom: 1px solid var(--borde); vertical-align: top; overflow-wrap: anywhere; }
.resultados thead th { font-size: .875rem; background: var(--suave); color: var(--secundario); }
.resultados th:first-child { width: 43%; }
.resultados th:last-child { width: 19%; }
.resultados tbody th { font-weight: 550; }
.resultados td:last-child { color: var(--secundario); font-size: .875rem; }
.valor { white-space: pre-wrap; font-variant-numeric: tabular-nums; }
.origen { display: block; margin-top: .1rem; color: var(--secundario); font-size: .8125rem; }
.muestras { list-style: none; padding: 0; margin: .5rem 0 0; }
.muestras li { border-bottom: 1px solid var(--borde); padding: .625rem 0; }
.muestras h4 { font-size: 1rem; font-weight: 650; }
.muestra-valor { margin-top: .25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.atribuciones > div { border-bottom: 1px solid var(--borde); padding: .625rem 0; }

@media (max-width: 38rem) {
  .contenedor { width: calc(100% - 2rem); }
  .institucion .contenedor { min-height: 0; padding-block: .75rem; }
  .institucion p { letter-spacing: .025em; }
  main { padding-block: 1.4375rem 3rem; }
  .estado { margin-block: 1rem 1.25rem; }
  .resumen { grid-template-columns: 1fr; padding: .75rem; }
  .examen { margin-top: 1.75rem; }
  .resultados th, .resultados td { padding-inline: .375rem; }
  .resultados th:last-child { width: 20%; }
}
