:root {
  --brand: #1b4f9c;
  --brand-ink: #123a75;
  --brand-soft: #e8f0fb;
  --accent: #e8833a;
  --accent-soft: #fdf0e6;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #18212f;
  --muted: #5d6879;
  --line: #dde3ec;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --ok: #1e8a5a;
  --ok-soft: #e6f6ee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 4px 16px rgba(16, 32, 64, .06);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Header ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 880px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 16px; }
.topbar img { height: 52px; width: auto; display: block; }
.topbar .tag { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.hero { max-width: 880px; margin: 0 auto; padding: 28px 16px 8px; }
.hero h1 { font-size: clamp(24px, 4vw, 32px); color: var(--brand-ink); letter-spacing: -.01em; }
.hero p { color: var(--muted); margin: 8px 0 0; max-width: 640px; }

/* ---------- Form layout ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 22px 24px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.card-head h2 { font-size: 17px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .card { padding: 18px 16px 20px; }
  .topbar img { height: 42px; }
}

.field label.lbl, .field .lbl { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.req::after { content: ' *'; color: var(--danger); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.err { font-size: 12.5px; color: var(--danger); margin-top: 5px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid select, .field.invalid .chips, .field.invalid .sig-box { border-color: var(--danger); }

input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; min-height: 44px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(27, 79, 156, .15); }

/* Opciones tipo "chip" (radio / checkbox) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 1px solid transparent; border-radius: 12px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; user-select: none; transition: all .12s;
}
.chip span::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #b6c0cf; flex: none; transition: all .12s; }
.chip input[type=checkbox] + span::before { border-radius: 4px; }
.chip input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.chip input:checked + span::before { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 2px #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(27, 79, 156, .25); }
.chips.grid-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.chips.grid-chips .chip span { width: 100%; border-radius: 10px; }

.cond { display: none; }
.cond.show { display: block; }
.sub { margin-top: 12px; }
.question { padding: 16px 0; border-top: 1px dashed var(--line); }
.question:first-of-type { border-top: 0; padding-top: 0; }
.question .lbl { font-size: 14.5px; }

/* Firma */
.sig-box { border: 1.5px dashed #b6c0cf; border-radius: 12px; background: #fbfcfe; position: relative; touch-action: none; }
.sig-box canvas { display: block; width: 100%; height: 180px; cursor: crosshair; }
.sig-box .sig-line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid #c8d0dc; pointer-events: none; }
.sig-box .sig-ph { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #9aa5b5; font-size: 12.5px; pointer-events: none; }
.sig-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.declare { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.declare input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: #f6f8fb; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); background: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-danger { color: var(--danger); border-color: #f1c4bf; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: progress; }

.submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.submit-bar p { margin: 0; color: var(--muted); font-size: 13px; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; display: none; }
.alert.show { display: block; }
.alert-error { background: var(--danger-soft); color: #8e2a20; border: 1px solid #f1c4bf; }

/* Pantalla de éxito */
.done { text-align: center; padding: 48px 24px; }
.done .check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 16px; }
.done h2 { font-size: 24px; color: var(--brand-ink); }
.done p { color: var(--muted); }
.folio { display: inline-block; margin: 12px 0 20px; font-weight: 700; font-size: 18px; background: var(--accent-soft); color: #a3521a; padding: 8px 18px; border-radius: 999px; }

footer.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 16px 32px; }
.hidden { display: none !important; }
