/* =========================================================================
   Estilos del formulario de screening — diseño limpio, profesional y
   responsivo (mobile-first). Paleta costera: azul marino + verde azulado.
   ========================================================================= */

:root {
  --navy: #0f3550;
  --navy-2: #164a6e;
  --teal: #1f7a8c;
  --teal-soft: #e5f2f4;
  --ink: #1c2b3a;
  --muted: #5b6f82;
  --line: #d9e1ea;
  --bg: #eef2f6;
  --card: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #1a7f4b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 53, 80, .06), 0 4px 16px rgba(15, 53, 80, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Encabezado ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy), var(--navy-2) 60%, var(--teal));
  color: #fff;
  padding: 40px 0 72px;
}
.eyebrow { margin: 0; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; color: #9fc6df; }
.hero h1 { margin: 6px 0 2px; font-size: clamp(26px, 5vw, 36px); line-height: 1.15; }
.hero-es { margin: 0; color: #cfe2ee; font-size: 17px; }
.hero-note { margin: 18px 0 0; color: #e4eef5; max-width: 640px; font-size: 15px; }
.hero-note .es { color: #a9c9dc; }

main.wrap { margin-top: -48px; }

/* ---------- Tarjetas por sección ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
  margin-bottom: 18px;
}
@media (min-width: 640px) { .card { padding: 28px 32px; } }

.card h2 {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin: 0 0 18px; font-size: 20px; color: var(--navy);
}
.card h2 .es { flex-basis: 100%; margin-left: 42px; }
.num {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 15px; font-weight: 700;
  transform: translateY(-2px);
}
.card h3 { margin: 24px 0 10px; font-size: 16px; color: var(--navy); }
.card h3 .es { display: block; }

/* Subtítulos en español */
.es { display: block; font-size: 13px; font-weight: 400; color: var(--muted); font-style: italic; }
.es-inline { font-size: .88em; font-weight: 400; color: var(--muted); font-style: italic; }
.es-inline::before { content: "· "; font-style: normal; }

/* ---------- Rejilla de campos ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px 18px; }
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .col-2 { grid-column: span 2; }
}

.f { display: flex; flex-direction: column; min-width: 0; margin-bottom: 4px; }
.f > label, .f > .label { font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.req { color: var(--danger); font-weight: 700; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fbfcfd;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(31, 122, 140, .18); background: #fff;
}
input[readonly] { background: #f1f4f7; color: var(--muted); }
.upper { text-transform: uppercase; }

/* Campos marcados como inválidos tras intentar enviar */
.was-validated input:invalid, .was-validated select:invalid, .was-validated textarea:invalid {
  border-color: var(--danger); background: var(--danger-soft);
}

.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-prefix input { padding-left: 28px; }

/* ---------- Checkboxes y radios ---------- */
.check, .radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check { margin: 6px 0 14px; font-size: 14.5px; }
.check input, .radio input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--teal); flex: none; }
.radios { display: flex; gap: 10px; flex-wrap: wrap; }
.radio {
  align-items: center; padding: 10px 16px; border: 1.5px solid var(--line); border-radius: 9px;
  min-width: 110px; font-weight: 600; background: #fbfcfd;
}
.radio:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.radio input { margin: 0; }

.consent {
  padding: 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fbfcfd; line-height: 1.45;
}
.consent:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.consent .es { margin-top: 6px; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.conditional {
  margin: 4px 0 18px; padding: 16px; border-left: 3px solid var(--teal);
  background: #f7fafc; border-radius: 0 10px 10px 0;
}
fieldset.plain[disabled] { opacity: .45; }
fieldset.plain { margin-bottom: 16px; }

.notice {
  margin: 14px 0; padding: 12px 14px; font-size: 14px;
  background: var(--teal-soft); border-radius: 9px; color: var(--navy);
}

/* ---------- Carga de archivos con vista previa ---------- */
.upload {
  border: 2px dashed #c3d0dc; border-radius: 12px; padding: 16px; background: #fbfcfd;
  transition: border-color .15s, background .15s;
}
.upload.has-files { border-style: solid; border-color: var(--teal); background: #f6fbfc; }
.upload.invalid { border-color: var(--danger); background: var(--danger-soft); }
.upload.dragover { border-color: var(--teal); background: var(--teal-soft); }
.upload-head .upload-title { font-weight: 700; }
.upload .hint { margin: 4px 0 12px; }
.upload-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.counter { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 600; }

.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.previews:empty { display: none; }
.thumb {
  position: relative; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff;
}
.thumb img { display: block; width: 100%; height: 110px; object-fit: cover; background: #e9eef3; }
.thumb .pdf {
  height: 110px; display: grid; place-items: center; background: #fdf0ef; color: var(--danger);
  font-weight: 800; font-size: 20px; letter-spacing: 1px;
}
.thumb .meta { padding: 6px 8px; font-size: 12px; line-height: 1.3; }
.thumb .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.thumb .meta span { color: var(--muted); }
.thumb .remove {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(15, 53, 80, .85); color: #fff; font-size: 17px; line-height: 1; cursor: pointer;
}
.thumb.processing img, .thumb.processing .pdf { opacity: .4; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; border-radius: 9px; cursor: pointer;
  padding: 10px 16px; min-height: 44px; border: 1.5px solid transparent; text-align: center;
}
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-outline { background: #fff; border-color: var(--teal); color: var(--teal); }
.btn-outline:hover, .btn-outline:focus-within { background: var(--teal-soft); }
.btn-primary { width: 100%; background: var(--navy); color: #fff; font-size: 17px; padding: 14px 20px; min-height: 54px; }
.btn-primary:hover { background: var(--navy-2); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-primary .es-inline { color: #b9d3e3; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Firma ---------- */
.sig-input {
  font-family: "Brush Script MT", "Segoe Script", "Lucida Handwriting", cursive !important;
  font-size: 26px !important; letter-spacing: .5px;
}

/* ---------- Barra de envío ---------- */
.submit-bar { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 24px; }
.size-meter { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.size-track { flex: 1; height: 8px; border-radius: 8px; background: #e6ecf1; overflow: hidden; }
.size-fill { height: 100%; width: 0; background: var(--teal); transition: width .2s; }
.size-meter.over .size-fill { background: var(--danger); }
.size-meter.over { color: var(--danger); font-weight: 600; }

.errors {
  background: var(--danger-soft); border: 1px solid #f5c2bd; color: var(--danger);
  border-radius: 9px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px;
}
.errors ul { margin: 6px 0 0; padding-left: 18px; }
.fine { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- Pantalla de éxito ---------- */
.success { text-align: center; padding: 48px 24px; outline: none; }
.success svg { width: 64px; height: 64px; fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success h2 { justify-content: center; margin: 12px 0 0; }
.success p { max-width: 520px; margin: 8px auto; }

.footer { padding-bottom: 32px; font-size: 12.5px; color: var(--muted); text-align: center; }
