:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #5d6975;
  --border: #d9e0e6;
  --primary: #173f5f;
  --primary-dark: #0f2d45;
  --focus: #2f80ed;
  --low-bg: #e8f5ec;
  --low-border: #2f855a;
  --low-text: #155c37;
  --moderate-bg: #fff6d8;
  --moderate-border: #c58a00;
  --moderate-text: #6d4c00;
  --high-bg: #fdeaea;
  --high-border: #c53030;
  --high-text: #8a1c1c;
  --pending-bg: #eef2f5;
  --pending-border: #82909c;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: #135f96;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  min-height: 44px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(47, 128, 237, 0.35);
  outline-offset: 2px;
}

.site-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 2.5rem 1.25rem 2rem;
}

.header-inner,
main,
.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.85;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.08;
}

.subtitle {
  max-width: 800px;
  margin: 0.8rem 0 1.2rem;
  font-size: 1.08rem;
  opacity: 0.92;
}

.author-block {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  font-size: 0.94rem;
}

.author-block strong {
  font-size: 1rem;
}

.author-block .affiliation {
  flex-basis: 100%;
  opacity: 0.86;
}

main {
  padding-block: 1.5rem 3rem;
}

.notice-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.notice {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid #b7c7d4;
  border-left: 5px solid var(--primary);
  border-radius: 10px;
  background: #f8fbfd;
}

.notice strong {
  display: block;
  margin-bottom: 0.2rem;
}

.scope {
  color: var(--muted);
  font-size: 0.92rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 1.25rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 1.15rem;
}

fieldset {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

legend {
  padding-inline: 0.4rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field > label,
.group-label {
  font-weight: 700;
}

select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #aeb9c2;
  border-radius: 8px;
  background: white;
  color: var(--text);
}

select:disabled {
  background: #eef1f3;
  color: #697782;
}

.help {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.choice-stack {
  display: grid;
  gap: 0.55rem;
}

.choice-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  background: #fcfdfe;
}

.choice-row:hover {
  border-color: #9fb1be;
}

.choice-row input {
  width: 18px;
  height: 18px;
  margin-top: 0.14rem;
  flex: 0 0 auto;
}

.choice-row strong {
  color: var(--primary);
  white-space: nowrap;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0.7rem 1rem;
  font-weight: 750;
  cursor: pointer;
}

.button-primary {
  background: var(--primary);
  color: white;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: white;
  color: var(--primary);
  border-color: #96a9b8;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.result-panel {
  position: sticky;
  top: 1rem;
  overflow: hidden;
}

.result-card {
  padding: 1.2rem;
  border-left: 8px solid;
}

.result-card h2 {
  margin: 0;
  font-size: 1.4rem;
}

.result-summary {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin-top: 0.7rem;
}

.score {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.score-caption {
  display: block;
  color: currentColor;
  opacity: 0.78;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0;
}

.result-range {
  max-width: 260px;
  margin: 0;
  text-align: right;
  font-weight: 650;
}

.risk-low {
  background: var(--low-bg);
  border-color: var(--low-border);
  color: var(--low-text);
}

.risk-moderate {
  background: var(--moderate-bg);
  border-color: var(--moderate-border);
  color: var(--moderate-text);
}

.risk-high {
  background: var(--high-bg);
  border-color: var(--high-border);
  color: var(--high-text);
}

.result-pending {
  background: var(--pending-bg);
  border-color: var(--pending-border);
  color: #34424d;
}

.result-content {
  padding: 1.1rem;
}

.result-content h3 {
  margin: 0 0 0.7rem;
  color: var(--primary-dark);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f4f6;
  color: #30404d;
}

.score-cell {
  font-weight: 800;
  white-space: nowrap;
}

.interpretation {
  margin: 0 0 1rem;
  padding: 0.85rem;
  border-radius: 9px;
  background: #f6f8fa;
}

.clinical-alerts {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.clinical-alert {
  padding: 0.75rem 0.85rem;
  border: 1px solid;
  border-radius: 9px;
}

.clinical-alert h4,
.clinical-alert p {
  margin: 0;
}

.clinical-alert h4 {
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.alert-info {
  background: #eef7ff;
  border-color: #81b7e2;
}

.alert-warning {
  background: #fff8df;
  border-color: #d8ae32;
}

.alert-danger {
  background: #fff0f0;
  border-color: #d56a6a;
}

.result-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.references-panel {
  margin-top: 1.25rem;
  padding: 1.15rem;
}

.references-panel h2 {
  margin-top: 0;
  color: var(--primary-dark);
}

.references-panel li + li {
  margin-top: 0.65rem;
}

.method-note {
  padding: 0.85rem;
  border-radius: 9px;
  background: #f5f7f8;
  color: #3d4b56;
}

.site-footer {
  padding-block: 0 2.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 650px) {
  .field-grid,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  .result-summary {
    display: block;
  }

  .result-range {
    max-width: none;
    margin-top: 0.7rem;
    text-align: left;
  }

  .button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .site-header {
    color: black;
    background: white;
    padding: 0 0 1rem;
  }

  .notice-stack,
  .form-panel,
  .references-panel,
  .result-actions,
  .site-footer {
    display: none !important;
  }

  main,
  .header-inner {
    width: 100%;
  }

  .layout {
    display: block;
  }

  .result-panel {
    position: static;
    box-shadow: none;
  }
}
/* Componentes de la versión protegida: conserva la estética azul original. */
.form-status {
  min-height: 1.3rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-hero {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 0.55rem;
}

.risk-light {
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  border: 5px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--pending-border);
  box-shadow:
    0 0 0 1px rgba(17, 34, 51, 0.10),
    0 8px 18px rgba(17, 34, 51, 0.12);
}

.risk-low .risk-light {
  background: #2f9e5b;
}

.risk-moderate .risk-light {
  background: #e0a400;
}

.risk-high .risk-light {
  background: #d33b3b;
}

.result-card h2 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.75rem, 4vw, 2.55rem);
}

.result-card p:last-child {
  margin: 0;
  font-weight: 600;
}

.result-eyebrow {
  color: inherit;
}

.driver-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.driver-list li + li {
  margin-top: 0.45rem;
}

.result-note {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border-radius: 9px;
  background: #f5f7f8;
  color: #3d4b56;
}

.form-actions,
.result-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.clinical-alert {
  padding: 0.75rem 0.85rem;
  border: 1px solid;
  border-radius: 9px;
}

.clinical-alert h4,
.clinical-alert p {
  margin: 0;
}

.clinical-alert h4 {
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
}

.alert-info {
  background: #eef7ff;
  border-color: #81b7e2;
}

.alert-warning {
  background: #fff8df;
  border-color: #d8ae32;
}

.alert-danger {
  background: #fff0f0;
  border-color: #d56a6a;
}

@media (max-width: 650px) {
  .result-hero {
    align-items: flex-start;
  }

  .risk-light {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }
}
