/* Formularios funcionales de Codex, aislados para revisión local. */
body.request-dialog-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

.pi-conditions {
  display: block;
  width: fit-content;
  margin: 28px auto 0;
  color: var(--cian);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 4px;
}

.foot-link {
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
}

.foot-link:hover { color: var(--blanco); }

.info-dialog,
.request-dialog {
  color: var(--tinta);
  background: var(--blanco);
  border: 0;
  box-shadow: var(--sh-2);
}

.info-dialog {
  width: min(calc(100% - 24px), 680px);
  max-height: calc(100dvh - 24px);
  padding: clamp(20px, 4vw, 34px);
  overflow-y: auto;
  border-radius: 18px;
}

.info-dialog::backdrop,
.request-dialog::backdrop {
  background: rgba(3, 12, 29, .82);
  backdrop-filter: blur(6px);
}

.dialog-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-top h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.05;
}

.dialog-top > button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  color: var(--tinta);
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 10px;
  font-size: 26px;
  line-height: 1;
}

.info-dialog > p { margin: 22px 0; }

.conditions-preliminary,
.review-notice {
  padding: 12px 14px;
  color: #81420d;
  background: rgba(240, 165, 49, .14);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  font-size: 13px;
}

.conditions-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding-left: 20px;
  list-style: disc;
}

.conditions-list li::marker { color: var(--azul); }
.pilot-dialog-note { color: var(--mut); font-size: 13px; }

.request-dialog {
  width: min(calc(100% - 24px), 980px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
  overflow-x: clip;
  border-radius: 22px;
}

.request-dialog-compact { width: min(calc(100% - 24px), 780px); }

.request-dialog[open] { animation: request-dialog-enter 220ms var(--ease) both; }

@keyframes request-dialog-enter {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.request-dialog-shell {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.request-dialog-top {
  position: sticky;
  z-index: 5;
  top: 0;
  padding: 18px clamp(18px, 4vw, 34px);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--linea);
  backdrop-filter: blur(14px);
}

.request-dialog-top h2 { margin-top: 4px; }

.dialog-kicker {
  color: var(--azul-o);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.request-form { padding: clamp(18px, 4vw, 36px); }
.review-notice { margin-bottom: 14px; }
.request-intro { max-width: 720px; margin-bottom: 24px; color: var(--mut); }

.turnstile-field {
  display: grid;
  gap: 9px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #cad5e5;
  border-radius: 12px;
  background: #f7faff;
}
.turnstile-label { margin: 0; color: var(--tinta); font-size: 13px; font-weight: 760; }
.turnstile-status { min-height: 18px; margin: 0; color: var(--mut); font-size: 12px; }
.turnstile-status.is-error { color: #9d3400; font-weight: 700; }
.turnstile-test-widget {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #aebdd2;
  border-radius: 9px;
  background: #fff;
}
.turnstile-test-widget.is-verified { border-color: #4a9870; background: #f1fbf5; }
.turnstile-test-widget span { color: var(--mut); font-size: 11px; text-align: right; }
.turnstile-test-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--azul);
  border-radius: 7px;
  background: #fff;
  color: var(--azul-o);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}
.turnstile-test-button:hover { background: #edf4ff; }
.turnstile-test-button:focus-visible { outline: 3px solid #ffb281; outline-offset: 2px; }
.turnstile-test-widget.is-verified .turnstile-test-button { border-color: #2f7b55; color: #1f6b47; }

.form-honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-top: 1px solid var(--linea);
}

.form-section:first-of-type { padding-top: 0; border-top: 0; }

.form-section legend {
  margin-bottom: 14px;
  padding: 0;
  color: var(--tinta);
  font-size: 17px;
  font-weight: 800;
}

.form-section legend span {
  margin-right: 7px;
  color: var(--naranja-t);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .08em;
}

.form-grid { display: grid; gap: 14px 16px; }
.form-field { min-width: 0; }

.form-field label,
.field-instruction {
  display: block;
  margin: 0 0 6px;
  color: var(--tinta);
  font-size: 13px;
  font-weight: 720;
}

.form-field label > span,
.field-instruction > span { color: var(--naranja-t); }
.form-field label small { color: var(--mut); font-weight: 500; }

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--tinta);
  background: var(--blanco);
  border: 1px solid #b7c6d9;
  border-radius: 9px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.form-field textarea { min-height: 110px; resize: vertical; }
.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover { border-color: #7f98ba; }

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 4px rgba(47, 123, 255, .13);
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  background: #fff9f5;
  border-color: var(--naranja-t);
}

.form-error {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: #9d3400;
  font-size: 12px;
  line-height: 1.35;
}

.choice-grid { display: grid; gap: 9px; }
.choice-card { position: relative; cursor: pointer; }
.choice-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.choice-card span {
  display: flex;
  min-height: 48px;
  align-items: center;
  padding: 10px 12px;
  color: var(--mut);
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.choice-card input:checked + span {
  color: var(--azul-o);
  background: rgba(47, 123, 255, .08);
  border-color: rgba(47, 123, 255, .45);
  box-shadow: inset 3px 0 var(--azul);
}

.choice-card input:focus-visible + span { outline: 3px solid var(--naranja); outline-offset: 3px; }

[data-choice-group].has-error .choice-grid {
  padding: 5px;
  border: 1px solid var(--naranja-t);
  border-radius: 11px;
}

.consent-field {
  padding: 15px;
  background: var(--papel);
  border: 1px solid var(--linea);
  border-radius: 10px;
}

.consent-field label { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.consent-field input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--azul); }
.consent-field span:not(.form-error) { color: var(--mut); font-size: 13px; }
.consent-field a { color: var(--azul-o); font-weight: 720; text-underline-offset: 3px; }
.consent-field:has(input[aria-invalid="true"]) { background: #fff9f5; border-color: var(--naranja-t); }

.request-actions { display: grid; gap: 10px; margin-top: 16px; }
.request-actions .btn { width: 100%; }
.request-actions .btn:disabled { cursor: wait; opacity: .62; transform: none; }
.request-actions p { margin: 0; color: var(--mut); font-size: 12px; text-align: center; }
.request-actions p.is-error { color: #9d3400; font-weight: 700; }

.request-success { min-height: 450px; padding: clamp(34px, 7vw, 76px); text-align: center; }
.request-success h2 { max-width: 680px; margin: 8px auto 16px; font-size: clamp(30px, 5vw, 50px); line-height: 1.04; }
.request-success > p:not(.dialog-kicker) { max-width: 620px; margin: 0 auto 24px; color: var(--mut); }

.success-mark {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  place-items: center;
  color: var(--blanco);
  background: var(--azul);
  border-radius: 50%;
  box-shadow: 0 18px 38px rgba(47, 123, 255, .28);
  font-size: 30px;
  font-weight: 850;
}

@media (min-width: 600px) {
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-field-full { grid-column: 1 / -1; }
  .choice-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .request-actions { justify-items: end; }
  .request-actions .btn { width: auto; min-width: 300px; }
}

@media (max-width: 599px) {
  .request-dialog,
  .request-dialog-compact { width: calc(100% - 12px); max-height: calc(100dvh - 12px); border-radius: 16px; }
  .request-dialog-shell { max-height: calc(100dvh - 12px); }
  .request-dialog-top { padding: 14px 16px; }
  .dialog-top > button { width: 40px; height: 40px; }
  .request-success { min-height: 390px; }
  .request-actions .btn {
    min-width: 0;
    height: auto;
    padding: 12px 16px;
    line-height: 1.25;
    white-space: normal;
  }
  .turnstile-test-widget { align-items: stretch; flex-direction: column; }
  .turnstile-test-widget span { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .request-dialog[open] { animation: none; }
}
