:root {
  --primary: #1e3a5f;
  --primary-dark: #16293f;
  --accent: #2e86de;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #22303f;
  --muted: #5b6b7c;
  --line: #e3e9f0;
  --verde: #2e7d32;
  --verde-bg: #e8f5e9;
  --amarillo: #b8860b;
  --amarillo-bg: #fff8e1;
  --naranja: #e65100;
  --naranja-bg: #fff3e0;
  --rojo: #c62828;
  --rojo-bg: #ffebee;
  --danger: #d7263d;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 40, 65, 0.08);
  --shadow-lg: 0 8px 28px rgba(20, 40, 65, 0.12);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.site-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 26px 0;
}

.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  font-size: 30px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: 0.2px; }

.brand p { margin: 2px 0 0; font-size: 0.85rem; opacity: 0.85; }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-warning { background: rgba(255, 193, 7, 0.18); color: #ffe082; border: 1px solid rgba(255, 193, 7, 0.4); }

main { padding: 20px 0 40px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
}

.card h2 { margin: 0 0 6px; font-size: 1.12rem; }

.card h2.section-title { margin: 0; }

.section-sub { margin: 2px 0 14px; color: var(--muted); font-size: 0.88rem; }

.alert { border-left: 5px solid var(--accent); }

.alert h2 { font-size: 1rem; }

.alert ul, .alert ol { margin: 8px 0 0; padding-left: 20px; }

.alert li { margin: 6px 0; font-size: 0.92rem; }

.alert-danger { border-left-color: var(--danger); background: #fff6f6; }

.alert-info { border-left-color: var(--accent); background: #f4f9ff; }

.progress-wrap { margin-bottom: 18px; }

.progress-label { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }

.progress-track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }

.progress-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.25s ease; }

.steps-dots { display: flex; gap: 8px; margin-top: 10px; }

.step-dot {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  transition: background 0.2s;
}

.step-dot.active { background: var(--primary); }

.step-dot.done { background: var(--accent); }

.paso { display: none; animation: fadein 0.25s ease; }

.paso.active { display: block; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.paso-head { margin-bottom: 16px; }

.paso-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 700;
}

.paso-head h3 { margin: 4px 0 6px; font-size: 1.15rem; }

.paso-note {
  font-size: 0.88rem;
  color: var(--muted);
  background: #f7f9fc;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
}

.paso-warning {
  font-size: 0.88rem;
  color: var(--danger);
  background: #fff0f1;
  border: 1px solid #ffd4d9;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0 0;
  font-weight: 600;
}

.pregunta { margin-top: 20px; }

.pregunta-titulo { font-weight: 600; font-size: 0.98rem; }

.pregunta-hint { font-size: 0.86rem; color: var(--muted); margin-top: 4px; }

.opciones { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }

@media (min-width: 640px) {
  .opciones.grid-2 { grid-template-columns: 1fr 1fr; }
}

.opcion {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.opcion:hover { border-color: #b9c7d8; }

.opcion.selected { border-color: var(--accent); background: #f0f7ff; box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.12); }

.opcion input { position: absolute; opacity: 0; pointer-events: none; }

.opcion .radio {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid #b9c7d8;
  background: #fff;
  position: relative;
  transition: border-color 0.15s;
}

.opcion.selected .radio { border-color: var(--accent); }

.opcion.selected .radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.opcion .opt-label { font-weight: 600; font-size: 0.94rem; }

.opcion .opt-detail { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }

.opcion .opt-index {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f4f8;
  border-radius: 99px;
  padding: 2px 9px;
}

.opcion.selected .opt-index { background: var(--accent); color: #fff; }

.crack-guide { margin-top: 14px; }

.crack-guide summary { cursor: pointer; font-size: 0.86rem; color: var(--accent); font-weight: 600; }

.crack-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.82rem; }

.crack-table th, .crack-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }

.crack-table th { background: #f7f9fc; }

.crack-table td:last-child { white-space: nowrap; font-weight: 600; }

.nav-buttons { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

.nav-buttons .btn-right { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

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

.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; }

.field .opcional { font-weight: 400; color: var(--muted); }

.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 134, 222, 0.12); }

.field input.invalid { border-color: var(--danger); }

.field .error-msg { display: none; color: var(--danger); font-size: 0.78rem; margin-top: 4px; }

.field input.invalid + .error-msg { display: block; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 2px dashed #b9c7d8;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #f0f7ff; }

.dz-icon { font-size: 30px; }

.dz-hint { font-size: 0.78rem; color: var(--muted); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 14px; }

.photo-thumb { position: relative; }

.photo-thumb img { width: 100%; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

.photo-thumb button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.photo-thumb button:hover { background: var(--danger); }

.photo-status { font-size: 0.82rem; color: var(--muted); margin-top: 10px; }

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }

.btn-primary:hover { background: #1f77d4; }

.btn-primary:disabled { background: #b7c6d6; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }

.btn-ghost:hover { border-color: #b9c7d8; color: var(--text); }

.btn-lg { width: 100%; padding: 15px 20px; font-size: 1.05rem; }

.btn-submit { background: var(--primary); }

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

.envio-nota { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }

.status { margin-top: 14px; padding: 14px; border-radius: 10px; font-size: 0.92rem; }

.status.success { background: var(--verde-bg); color: var(--verde); border: 1px solid #c8e6c9; }

.status.error { background: var(--rojo-bg); color: var(--rojo); border: 1px solid #ffcdd2; }

.status.info { background: #f0f7ff; color: var(--primary); border: 1px solid #d6e7f8; }

.status.spinner::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(46, 134, 222, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Resultado */
.resultado-banner {
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  margin-top: 6px;
  background: linear-gradient(135deg, #445 0%, #556 100%);
}

.resultado-banner.verde { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.resultado-banner.amarillo { background: linear-gradient(135deg, #f9a825, #c68a00); }
.resultado-banner.naranja { background: linear-gradient(135deg, #e65100, #bf360c); }
.resultado-banner.rojo { background: linear-gradient(135deg, #c62828, #8e1a1a); }

.resultado-hab { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }

.resultado-nivel { font-size: 1rem; opacity: 0.95; margin: 0; }

.resultado-severidad { font-size: 2.6rem; font-weight: 800; margin: 10px 0 2px; }

.resultado-severidad small { font-size: 1rem; font-weight: 600; opacity: 0.9; }

.gauge-wrap { margin-top: 16px; }

.gauge { position: relative; height: 22px; border-radius: 99px; overflow: hidden; display: flex; }

.gauge-seg { height: 100%; }

.gauge-marks { position: relative; height: 18px; margin-top: 4px; }

.gauge-mark { position: absolute; top: 0; transform: translateX(-50%); font-size: 0.72rem; color: var(--muted); }

.gauge-mark::before { content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 1.5px; height: 6px; background: #8b99a8; }

.gauge-pointer { position: absolute; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 12px solid #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); transition: left 0.4s ease; }

.confianza { margin-top: 12px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }

.confianza .tag {
  font-weight: 700;
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.confianza .tag.alta { background: var(--verde-bg); color: var(--verde); }
.confianza .tag.media { background: var(--amarillo-bg); color: var(--amarillo); }
.confianza .tag.baja { background: var(--rojo-bg); color: var(--rojo); }

.danger-box {
  margin-top: 14px;
  background: var(--rojo-bg);
  border: 1px solid #ffcdd2;
  color: var(--rojo);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.danger-box strong { display: block; margin-bottom: 4px; }

.danger-box ul { margin: 6px 0 0; padding-left: 18px; }

.resultado-rec { margin-top: 16px; background: #f7f9fc; border-radius: 10px; padding: 14px; }

.resultado-rec h4 { margin: 0 0 6px; font-size: 0.95rem; }

.resultado-rec p { margin: 0; font-size: 0.9rem; }

.resultado-why { margin-top: 16px; }

.resultado-why h4 { margin: 0 0 6px; font-size: 0.95rem; }

.resultado-why ul { margin: 0; padding-left: 18px; }

.resultado-why li { font-size: 0.88rem; color: var(--muted); margin: 5px 0; }

.aviso-oficial { margin-top: 14px; border-left: 5px solid var(--amarillo); background: var(--amarillo-bg); padding: 12px 14px; font-size: 0.86rem; border-radius: 0 10px 10px 0; }

.aviso-oficial strong { color: var(--amarillo); }

.site-footer { background: var(--primary-dark); color: #cdd8e4; font-size: 0.8rem; padding: 26px 0 40px; }

.site-footer p { margin: 0 0 10px; max-width: 70ch; }

.site-footer em { color: #fff; }
