/* Formulario /aplicar de Andrés Rangel con el diseño del formulario instantáneo actual de Meta. */
:root {
  --ink: #1c2b33;
  --ink-soft: rgba(28, 43, 51, 0.65);
  --line: #cbd2d9;
  --pill-line: #dbdfe4;
  --accent: #4a5df9;
  --continue: #0a78be;
  --page: #f0f2f5;
  --intro: #2b2b2b;
  --intro-footer: #1c2b33;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--ink);
  background: var(--page);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: flex; height: 100%; justify-content: center; align-items: center; }
.sheet {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 440px;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
@media (min-width: 481px) {
  .sheet { height: min(820px, calc(100% - 48px)); border-radius: 8px; box-shadow: 0 12px 28px rgba(0, 0, 0, .2), 0 2px 4px rgba(0, 0, 0, .1); }
}

.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.is-active { display: flex; }

/* Encabezado: atrás + Cerrar */
.topbar { display: flex; height: 44px; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 0 16px; }
.icon-btn { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; border: 0; background: none; color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.text-btn { padding: 7px 0 4px 8px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 700; line-height: 20px; }
.topbar .spacer { width: 32px; }

.body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Pie con botón */
.footer { flex: 0 0 auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #e4e6eb; background: #fff; }
[data-screen="question"] .footer { border-top: 0; }
.btn {
  display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: center; padding: 12px 20px;
  border: 0; border-radius: 12px; color: #fff; background: var(--accent); font-size: 14px; font-weight: 700; line-height: 18px;
  text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-continue { border-radius: 4px; background: var(--continue); }
.btn-light { border-radius: 4px; color: #1c2b33; background: #fff; }

/* Pantalla de inicio (oscura) */
.intro { background: var(--intro); color: #fff; }
.intro .topbar .icon-btn { color: #fff; }
.intro .body { display: flex; flex-direction: column; justify-content: center; padding: 24px 24px 32px; }
.intro h1 { margin: 0 0 16px; font-size: 24px; font-weight: 700; line-height: 28px; }
.byline { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; font-weight: 700; line-height: 20px; }
.byline img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background: #fff; }
.intro p { margin: 0; font-size: 14px; line-height: 20px; white-space: pre-line; }
.intro .footer { border-top: 0; background: var(--intro-footer); }

/* Avatar de la página */
.avatar { display: block; width: 52px; height: 52px; margin: 30px auto 0; border: 1px solid #8a8d91; border-radius: 50%; object-fit: contain; background: #fff; }

/* Preguntas */
.question { padding: 14px 20px 24px; }
.question h2 { margin: 0 0 16px; font-size: 18px; font-weight: 700; line-height: 22px; text-align: center; }
.question .hint { margin: -6px 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 17px; text-align: center; }
.options { display: grid; gap: 8px; }
.option {
  position: relative; display: block; padding: 10px 16px; border: 1px solid var(--pill-line); border-radius: 20px;
  color: var(--ink); background: #fff; font-size: 14px; line-height: 20px; cursor: pointer;
}
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:checked) { border-color: var(--continue); box-shadow: inset 0 0 0 1px var(--continue); background: #e7f3ff; }
.option:has(input:focus-visible) { outline: 2px solid var(--continue); outline-offset: 2px; }

/* Contacto */
.contact { padding: 0 16px 0 18px; }
.page-name { margin: 8px 0 0; font-size: 14px; font-weight: 700; line-height: 20px; text-align: center; }
.contact h2 { margin: 15px 0 0; font-size: 18px; font-weight: 700; line-height: 22px; text-align: center; }
.contact .lead-text { margin: 0 0 12px; font-size: 12px; line-height: 16px; text-align: center; }
.field { display: block; margin: 0 0 10px; }
.field input, .phone-row {
  width: 100%; min-height: 46px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 4px; background: #fff;
  font-size: 14px; line-height: 20px;
}
.field input::placeholder { color: var(--ink-soft); }
.field input:focus, .phone-row:focus-within { outline: none; border-color: var(--continue); box-shadow: 0 0 0 1px var(--continue); }
.phone-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.phone-row select { flex: 0 0 auto; height: 44px; max-width: 92px; padding: 0 2px; border: 0; background: transparent; font-size: 14px; }
.phone-row input { flex: 1; min-width: 0; height: 44px; padding: 0; border: 0; background: transparent; font-size: 14px; }
.phone-row input:focus { outline: none; }
.phone-row input::placeholder { color: var(--ink-soft); }
.is-invalid, .phone-row.is-invalid { border-color: #e41e3f !important; box-shadow: 0 0 0 1px #e41e3f !important; }
.privacy { margin: 5px 0 20px; color: var(--ink-soft); font-size: 12px; line-height: 16px; }
.privacy a { color: var(--accent); font-weight: 600; text-decoration: none; }
.error { min-height: 16px; margin: 0 0 8px; color: #e41e3f; font-size: 12px; line-height: 16px; text-align: center; }
.error:empty { display: none; }
.honeypot { position: fixed; left: -10000px; width: 1px; height: 1px; opacity: 0; }

/* Pantallas finales */
.end .body { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 48px; text-align: center; }
.end-icon { width: 64px; height: 64px; }
.end h2 { margin: 0; padding: 16px 32px 4px; font-size: 20px; font-weight: 700; line-height: 24px; }
.end p { margin: 0; padding: 0 32px; color: #0c1014; font-size: 14px; line-height: 20px; }
.end .note { margin-top: 16px; color: var(--ink-soft); font-size: 12px; line-height: 16px; }

/* Botón final de WhatsApp */
.btn-whatsapp { min-height: 53px; gap: 10px; border-radius: 5px; background: #1fa855; font-size: 17px; font-weight: 400; line-height: 1.2; }
.btn-whatsapp:hover { background: #178a45; }
.btn-whatsapp .wa-icon { width: 22px; height: 22px; flex: 0 0 auto; }

.option .check{display:none}
.multi .option{display:flex;align-items:center;gap:10px}
.multi .option .check{display:grid;flex:0 0 18px;width:18px;height:18px;place-items:center;border:1.5px solid #8a8d91;border-radius:4px}
.multi .option:has(input:checked) .check{border-color:var(--continue);background:var(--continue)}
.multi .option .check svg{width:12px;height:12px;opacity:0}
.multi .option:has(input:checked) .check svg{opacity:1}
/* Tamaños más grandes para móvil (16 px mínimo en campos evita el zoom del iPhone) */
.text-btn{font-size:15px}
.country{position:relative;display:flex;flex:0 0 auto;align-items:center;gap:4px;height:48px;padding-right:10px;border-right:1px solid var(--line);font-size:16px;white-space:nowrap}
.country-label{font-size:16px}
.country-caret{width:12px;height:12px;color:var(--ink-soft)}
.phone-row .country select{position:absolute;inset:0;width:100%;max-width:none;height:100%;opacity:0;cursor:pointer}
.intro h1{font-size:28px;line-height:34px}
.byline{font-size:15px}
.intro p{font-size:16px;line-height:23px}
.question h2{font-size:21px;line-height:26px}
.question .hint{margin:-6px 0 18px;font-size:15px;line-height:20px}
.options{gap:10px}
.option{padding:13px 18px;border-radius:24px;font-size:16px;line-height:22px}
.multi .option .check{flex-basis:20px;width:20px;height:20px}
.btn:not(.btn-whatsapp){min-height:50px;font-size:16px;line-height:20px}
.page-name{font-size:15px}
.contact h2{font-size:21px;line-height:26px}
.contact .lead-text{margin-bottom:14px;font-size:14px;line-height:19px}
.field input,.phone-row{min-height:50px;font-size:16px}
.phone-row select,.phone-row input{height:48px;font-size:16px}
.privacy{font-size:13px;line-height:18px}
.error{font-size:14px;line-height:18px}
.end h2{font-size:22px;line-height:28px}
.end p{font-size:16px;line-height:23px}
.end .note{font-size:14px;line-height:19px}
/* Fondo del inicio: tu plataforma de métricas con filtro oscuro */
.intro{position:relative;background:var(--intro)}
.intro-bg{position:absolute;inset:0;z-index:0;width:100%;height:100%;object-fit:cover;object-position:center top;pointer-events:none}
.intro-shade{position:absolute;inset:0;z-index:0;background:linear-gradient(180deg,rgba(10,10,14,.80) 0%,rgba(10,10,14,.76) 40%,rgba(10,10,14,.90) 75%,rgba(10,10,14,.96) 100%);pointer-events:none}
.intro>.topbar,.intro>.body,.intro>.footer{position:relative;z-index:1}
.intro .footer{background:rgba(20,22,28,.85);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
.intro h1,.intro p,.byline{text-shadow:0 1px 8px rgba(0,0,0,.55)}
