/* =============================================================================
   ACCESO (ChoosePath): elegir perfil → WhatsApp → código
   Estilo limpio inspirado en los formularios de apple.com, con los colores de la
   marca (azul marino + dorado, los mismos de assets/css/expediente.css).
   Lo usan: ChoosePath/index.php, ChoosePath/validatenumber.php y
   ChoosePath/verify_code.html. No depende de Bootstrap ni de fuentes externas:
   usa la fuente del sistema (SF Pro en iPhone/Mac, Segoe UI en Windows,
   Roboto en Android).

   Temas: claro por defecto. <html data-tema="asesor"> activa el tema oscuro
   empresarial de los pasos 2 y 3 cuando el perfil elegido es Asesor (sección 14).
   ============================================================================= */

/* 1. TOKENS ------------------------------------------------------------------ */
:root {
    /* Marca */
    --ac-navy: #021A3C;
    --ac-gold: #C6A950;
    --ac-gold-hover: #D2B865;
    --ac-gold-text: #8A6D1F;   /* dorado legible sobre blanco (contraste AA) */
    --ac-gold-tint: #FBF6E6;

    /* Superficies y texto (los cambia el tema oscuro) */
    --ac-bg: #FFFFFF;
    --ac-surface: #FFFFFF;           /* mosaicos, campos, casillas */
    --ac-surface-2: #F5F5F7;         /* resumen, fondo de iconos */
    --ac-header-bg: rgba(255, 255, 255, .88);
    --ac-header-line: rgba(0, 0, 0, .08);
    --ac-footer-bg: #F5F5F7;
    --ac-footer-line: #E8E8ED;
    --ac-ink: #1D1D1F;
    --ac-muted: #6E6E73;
    --ac-faint: #86868B;
    --ac-line: #D2D2D7;              /* borde de mosaicos y separadores */
    --ac-field-line: #86868B;        /* borde de campos (contraste 3:1) */
    --ac-field-focus: var(--ac-navy);
    --ac-eyebrow: var(--ac-gold-text);
    --ac-icon: var(--ac-navy);
    --ac-link: var(--ac-navy);
    --ac-btn-bg: var(--ac-navy);
    --ac-btn-hover: #0B2B57;
    --ac-btn-text: #FFFFFF;
    --ac-spinner-track: rgba(255, 255, 255, .35);
    --ac-spinner-head: #FFFFFF;
    --ac-flag-ring: rgba(0, 0, 0, .1);

    /* Estados */
    --ac-err: #B42318;  --ac-err-tint: #FDECEA;  --ac-err-field: #FFF6F5;
    --ac-warn: #8A5A00; --ac-warn-tint: #FFF4DA;
    --ac-ok: #1E7B45;   --ac-ok-tint: #E7F4EC;

    /* Forma */
    --ac-radius: 12px;
    --ac-radius-lg: 18px;
    --ac-focus: 0 0 0 4px rgba(198, 169, 80, .45);
    --ac-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --ac-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 2. BASE -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.ac {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--ac-bg);
    color: var(--ac-ink);
    font-family: var(--ac-font);
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.ac-ico {
    width: 24px; height: 24px; flex: none; display: block;
    fill: none; stroke: currentColor; stroke-width: 1.6;
    stroke-linecap: round; stroke-linejoin: round;
}
.ac-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* 3. ENCABEZADO ---------------------------------------------------------------- */
.ac-header {
    position: sticky; top: 0; z-index: 10;
    background: var(--ac-header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--ac-header-line);
}
.ac-header__inner {
    max-width: 1024px; height: 56px; margin: 0 auto; padding: 0 22px;
    display: flex; align-items: center; gap: 14px;
}
.ac-brand { display: inline-flex; align-items: center; border-radius: 6px; }
.ac-brand img { display: block; width: auto; }
.ac-brand__claro { height: 40px; }
.ac-brand__oscuro { height: 18px; display: none !important; }
.ac-brand:focus-visible { outline: none; box-shadow: var(--ac-focus); }
.ac-header__sep { width: 1px; height: 22px; background: var(--ac-line); }
.ac-header__product { font-size: 15px; font-weight: 600; color: var(--ac-ink); }
.ac-solo-oscuro { display: none; }

/* 4. CONTENIDO ----------------------------------------------------------------- */
.ac-main { flex: 1; padding: 56px 22px 72px; }
/* Sin "both": si la animación no corre (pestaña en segundo plano, impresión), el contenido se ve igual */
.ac-wrap { max-width: 720px; margin: 0 auto; animation: ac-in .45s ease-out; }
.ac-wrap--form { max-width: 440px; }
.ac-intro { text-align: center; }
.ac-eyebrow { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--ac-eyebrow); letter-spacing: 0; }
.ac-title {
    margin: 0;
    font-family: var(--ac-font-display);
    font-size: 40px; line-height: 1.1; font-weight: 600; letter-spacing: -.015em;
    color: var(--ac-ink);
}
.ac-lead { margin: 12px auto 0; max-width: 32em; font-size: 19px; line-height: 1.42; color: var(--ac-muted); }
.ac-lead strong { color: var(--ac-ink); font-weight: 600; white-space: nowrap; }

@keyframes ac-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 5. AVISOS -------------------------------------------------------------------- */
.ac-notice {
    display: flex; align-items: flex-start; gap: 12px;
    margin: 28px auto 0; padding: 14px 16px;
    border-radius: var(--ac-radius);
    font-size: 15px; line-height: 1.4; text-align: left;
}
.ac-notice .ac-ico { width: 20px; height: 20px; margin-top: 1px; }
.ac-notice strong { display: block; font-weight: 600; }
.ac-notice--err  { background: var(--ac-err-tint);  color: var(--ac-err); }
.ac-notice--warn { background: var(--ac-warn-tint); color: var(--ac-warn); }
.ac-notice--ok   { background: var(--ac-ok-tint);   color: var(--ac-ok); }
.ac-notice__timer { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 6. PERFILES (mosaicos) -------------------------------------------------------- */
.ac-group { margin-top: 40px; }
.ac-group__label { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--ac-muted); }
.ac-tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ac-tile {
    display: flex; align-items: center; gap: 14px;
    min-height: 84px; padding: 18px;
    background: var(--ac-surface);
    border: 1px solid var(--ac-line);
    border-radius: var(--ac-radius-lg);
    color: var(--ac-ink); text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}
.ac-tile:hover { border-color: var(--ac-faint); }
.ac-tile:active { transform: scale(.99); }
.ac-tile:focus-visible { outline: none; border-color: var(--ac-gold); box-shadow: var(--ac-focus); }
.ac-tile__icon {
    flex: 0 0 44px; width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--ac-surface-2); color: var(--ac-icon);
}
.ac-tile__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-tile__title { font-size: 17px; line-height: 1.25; font-weight: 600; }
.ac-tile__text { font-size: 14px; line-height: 1.4; color: var(--ac-muted); }
.ac-tile__chev { width: 18px; height: 18px; color: var(--ac-faint); transition: transform .2s ease, color .2s ease; }
.ac-tile:hover .ac-tile__chev { transform: translateX(2px); color: var(--ac-ink); }
.ac-tile--pro .ac-tile__icon { background: var(--ac-gold-tint); color: var(--ac-gold-text); }
.ac-tile[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.ac-tile[aria-disabled="true"]:hover { border-color: var(--ac-line); }
.ac-tile[aria-disabled="true"]:hover .ac-tile__chev { transform: none; color: var(--ac-faint); }

/* 7. TEXTO DE APOYO Y ENLACES ------------------------------------------------- */
.ac-fine {
    display: flex; justify-content: center; align-items: flex-start; gap: 8px;
    max-width: 30em; margin: 40px auto 0;
    font-size: 13px; line-height: 1.4; color: var(--ac-muted);
}
.ac-fine .ac-ico { width: 16px; height: 16px; margin-top: 1px; }
.ac-link { color: var(--ac-link); font-size: 15px; font-weight: 600; text-decoration: none; border-radius: 4px; }
.ac-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.ac-link:focus-visible { outline: none; box-shadow: var(--ac-focus); }
.ac-pill {
    display: inline-flex; align-items: center; min-height: 34px; padding: 6px 14px;
    border: 1px solid var(--ac-line); border-radius: 980px; background: var(--ac-surface);
    color: var(--ac-link); font-size: 14px; font-weight: 600; text-decoration: none;
    transition: border-color .2s ease;
}
.ac-pill:hover { border-color: var(--ac-faint); }
.ac-pill:focus-visible { outline: none; box-shadow: var(--ac-focus); }

/* 8. RESUMEN DEL PERFIL ELEGIDO ----------------------------------------------- */
.ac-summary {
    display: flex; align-items: center; gap: 12px;
    margin: 32px 0 24px; padding: 12px 12px 12px 14px;
    background: var(--ac-surface-2); border-radius: var(--ac-radius);
}
.ac-summary__icon { color: var(--ac-icon); }
.ac-summary__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ac-summary__label { font-size: 12px; line-height: 1.33; color: var(--ac-muted); }
.ac-summary__value { font-size: 15px; line-height: 1.33; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 9. CAMPOS (etiqueta flotante) ------------------------------------------------ */
.ac-form { margin-top: 32px; }
.ac-summary + .ac-form { margin-top: 0; }
.ac-field { position: relative; }
.ac-input {
    display: block; width: 100%; height: 56px; margin: 0;
    padding: 24px 16px 6px;
    background: var(--ac-surface); color: var(--ac-ink);
    border: 1px solid var(--ac-field-line); border-radius: var(--ac-radius);
    font: inherit; font-size: 17px; line-height: 24px; letter-spacing: 0;
    -webkit-appearance: none; appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.ac-input::placeholder { color: transparent; }
.ac-input:focus::placeholder { color: var(--ac-faint); }
.ac-input:focus { outline: none; border-color: var(--ac-field-focus); box-shadow: var(--ac-focus); }
/* Autocompletado del navegador: sin el fondo amarillo */
.ac-input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--ac-surface) inset; -webkit-text-fill-color: var(--ac-ink); caret-color: var(--ac-ink); }
.ac-input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--ac-surface) inset, var(--ac-focus); }
.ac-label {
    position: absolute; left: 17px; top: 17px;
    max-width: calc(100% - 34px);
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: 17px; line-height: 22px; color: var(--ac-muted);
    pointer-events: none;
    transition: top .15s ease, font-size .15s ease, line-height .15s ease;
}
.ac-input:focus + .ac-label,
.ac-input:not(:placeholder-shown) + .ac-label,
.ac-label--up { top: 8px; font-size: 12px; line-height: 16px; }
.ac-input[aria-invalid="true"] { border-color: var(--ac-err); background: var(--ac-err-field); }
.ac-input[aria-invalid="true"] + .ac-label { color: var(--ac-err); }

/* País: el <select> nativo es invisible y está encima; se ve la bandera y la lada */
.ac-phone { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 10px; }
.ac-country {
    height: 56px;
    background: var(--ac-surface);
    border: 1px solid var(--ac-field-line); border-radius: var(--ac-radius);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ac-country:focus-within { border-color: var(--ac-field-focus); box-shadow: var(--ac-focus); }
.ac-country__select {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
    opacity: 0; cursor: pointer;
    font-size: 17px; /* 16px o más: iOS no hace zoom al tocarlo */
}
.ac-country__value {
    position: absolute; left: 16px; top: 26px;
    display: flex; align-items: center; gap: 8px;
    font-size: 17px; line-height: 22px; pointer-events: none;
}
.ac-flag { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px var(--ac-flag-ring); }
.ac-country__chev {
    position: absolute; right: 12px; top: 50%; width: 16px; height: 16px;
    transform: translateY(-50%); color: var(--ac-muted); pointer-events: none;
}
.ac-help { margin: 8px 2px 0; font-size: 13px; line-height: 1.4; color: var(--ac-muted); }
.ac-error {
    display: flex; align-items: flex-start; gap: 6px;
    margin: 8px 2px 0; font-size: 13px; line-height: 1.4; color: var(--ac-err);
}
.ac-error .ac-ico { width: 16px; height: 16px; margin-top: 1px; }

/* 10. CÓDIGO DE VERIFICACIÓN --------------------------------------------------- */
.ac-code { display: flex; justify-content: center; gap: 12px; margin: 32px 0 0; border: 0; padding: 0; min-width: 0; }
.ac-code__box {
    width: 60px; height: 68px; margin: 0; padding: 0;
    background: var(--ac-surface); color: var(--ac-ink);
    border: 1px solid var(--ac-field-line); border-radius: var(--ac-radius);
    font: inherit; font-size: 28px; font-weight: 600; text-align: center;
    font-variant-numeric: tabular-nums; letter-spacing: 0;
    caret-color: var(--ac-field-focus);
    -webkit-appearance: none; appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.ac-code__box:focus { outline: none; border-color: var(--ac-field-focus); box-shadow: var(--ac-focus); }
.ac-code__box[aria-invalid="true"] { border-color: var(--ac-err); background: var(--ac-err-field); }
.ac-code + .ac-error { justify-content: center; text-align: center; margin-top: 12px; }
/* Leyenda bajo las casillas; al enviarse cambia a "Verificando…" (no hay botón) */
.ac-code-status {
    display: flex; justify-content: center; align-items: center; gap: 8px;
    min-height: 22px; margin: 14px 0 0;
    font-size: 13px; line-height: 1.4; color: var(--ac-muted); text-align: center;
}
.ac-code-status.is-busy { font-size: 15px; font-weight: 600; color: var(--ac-ink); }

/* 10b. CASILLAS (step1.php: términos y aviso de privacidad) -------------------- */
.ac-checks {
    background: var(--ac-surface);
    border: 1px solid var(--ac-line); border-radius: var(--ac-radius);
    overflow: hidden;
}
.ac-check {
    position: relative;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px;
    font-size: 15px; line-height: 1.4; color: var(--ac-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ac-check + .ac-check { border-top: 1px solid var(--ac-line); }
/* La casilla nativa sigue ahí (teclado, lector de pantalla), invisible sobre la dibujada */
.ac-check input {
    position: absolute; left: 16px; top: 15px; width: 22px; height: 22px; margin: 0;
    opacity: 0; cursor: pointer;
}
.ac-check__box {
    flex: none; width: 22px; height: 22px; margin-top: -1px;
    display: grid; place-items: center;
    background: var(--ac-surface); color: var(--ac-btn-text);
    border: 1.5px solid var(--ac-field-line); border-radius: 6px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ac-check__box svg {
    width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3;
    stroke-linecap: round; stroke-linejoin: round;
    opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease;
}
.ac-check input:checked + .ac-check__box { background: var(--ac-btn-bg); border-color: var(--ac-btn-bg); }
.ac-check input:checked + .ac-check__box svg { opacity: 1; transform: none; }
.ac-check input:focus-visible + .ac-check__box { box-shadow: var(--ac-focus); }
.ac-check__text a { color: var(--ac-link); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ac-checks + .ac-help { margin-top: 10px; }

/* 11. BOTONES ------------------------------------------------------------------ */
.ac-actions { display: grid; justify-items: center; gap: 18px; margin-top: 24px; }
.ac-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; min-height: 52px; padding: 14px 22px;
    background: var(--ac-btn-bg); color: var(--ac-btn-text);
    border: 0; border-radius: var(--ac-radius);
    font: inherit; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
    cursor: pointer;
    transition: background-color .2s ease, opacity .2s ease;
}
a.ac-btn { text-decoration: none; }
.ac-btn:hover { background: var(--ac-btn-hover); }
.ac-btn:focus-visible { outline: none; box-shadow: var(--ac-focus); }
.ac-btn:disabled { opacity: .45; cursor: not-allowed; }
.ac-btn:disabled:hover { background: var(--ac-btn-bg); }
.ac-spinner {
    width: 18px; height: 18px; flex: none;
    border: 2px solid var(--ac-spinner-track); border-top-color: var(--ac-spinner-head); border-radius: 50%;
    animation: ac-spin .8s linear infinite;
}
/* Variante sobre el fondo de la página (no sobre un botón) */
.ac-spinner--page { width: 16px; height: 16px; border-color: var(--ac-line); border-top-color: var(--ac-field-focus); }
@keyframes ac-spin { to { transform: rotate(360deg); } }

/* 12. PIE ---------------------------------------------------------------------- */
.ac-footer {
    background: var(--ac-footer-bg);
    border-top: 1px solid var(--ac-footer-line);
    padding: 18px 22px calc(18px + env(safe-area-inset-bottom));
}
/* legend_footer.php trae estilos en línea: aquí se adaptan a la página */
.ac-footer p { margin: 0 !important; font-size: 12px; line-height: 1.33; text-align: center; color: var(--ac-muted) !important; }
.ac-footer .fw-semibold { font-weight: 600; }

/* 13. PANTALLAS ---------------------------------------------------------------- */
@media (min-width: 735px) {
    .ac-tiles--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 734px) {
    .ac-header__inner { height: 52px; padding: 0 16px; }
    .ac-brand__claro { height: 36px; }
    .ac-main { padding: 32px 16px 48px; }
    .ac-title { font-size: 32px; line-height: 1.125; }
    .ac-lead { font-size: 17px; line-height: 1.47; }
    .ac-group { margin-top: 32px; }
    .ac-tile { min-height: 76px; padding: 16px; }
    .ac-fine { margin-top: 32px; }
}
@media (max-width: 359px) {
    .ac-phone { grid-template-columns: 112px minmax(0, 1fr); }
    .ac-code { gap: 8px; }
    .ac-code__box { width: 54px; height: 62px; }
}
@media (prefers-reduced-motion: reduce) {
    .ac-wrap { animation: none; }
    .ac-tile, .ac-tile__chev, .ac-btn, .ac-input, .ac-country, .ac-code__box, .ac-label { transition: none; }
    .ac-spinner { animation-duration: 1.6s; }
}

/* 14. TEMA OSCURO EMPRESARIAL (asesores, pasos 2 y 3) ------------------------- */
/* validatenumber.php lo pone cuando share=asesor y lo recuerda en sessionStorage
   para verify_code.html. Botón dorado con texto azul marino (blanco sobre dorado
   no alcanza contraste). */
:root[data-tema="asesor"] {
    color-scheme: dark;
    --ac-bg: #050D1A;
    --ac-surface: #0B1628;
    --ac-surface-2: #101E35;
    --ac-header-bg: rgba(5, 13, 26, .82);
    --ac-header-line: rgba(255, 255, 255, .08);
    --ac-footer-bg: #030912;
    --ac-footer-line: rgba(255, 255, 255, .06);
    --ac-ink: #F5F5F7;
    --ac-muted: #A1A1A6;
    --ac-faint: #8E8E93;
    --ac-line: #22324D;
    --ac-field-line: #56698C;
    --ac-field-focus: var(--ac-gold);
    --ac-eyebrow: var(--ac-gold);
    --ac-icon: var(--ac-gold);
    --ac-link: #DCC786;
    --ac-btn-bg: var(--ac-gold);
    --ac-btn-hover: var(--ac-gold-hover);
    --ac-btn-text: var(--ac-navy);
    --ac-spinner-track: rgba(2, 26, 60, .25);
    --ac-spinner-head: var(--ac-navy);
    --ac-flag-ring: rgba(255, 255, 255, .18);
    --ac-err: #FF8A80;  --ac-err-tint: rgba(255, 138, 128, .12);  --ac-err-field: rgba(255, 138, 128, .08);
    --ac-warn: #F2C35B; --ac-warn-tint: rgba(242, 195, 91, .12);
    --ac-ok: #6FD49D;   --ac-ok-tint: rgba(111, 212, 157, .12);
    --ac-focus: 0 0 0 4px rgba(198, 169, 80, .35);
}
:root[data-tema="asesor"] body.ac {
    background:
        radial-gradient(900px 460px at 50% -140px, rgba(198, 169, 80, .14), transparent 70%),
        var(--ac-bg);
}
:root[data-tema="asesor"] .ac-brand__claro { display: none !important; }
:root[data-tema="asesor"] .ac-brand__oscuro { display: block !important; }
:root[data-tema="asesor"] .ac-solo-claro { display: none; }
:root[data-tema="asesor"] .ac-solo-oscuro { display: inline; }
:root[data-tema="asesor"] .ac-header__sep { background: rgba(255, 255, 255, .18); }
:root[data-tema="asesor"] .ac-header__product { color: var(--ac-gold); letter-spacing: .02em; }
:root[data-tema="asesor"] .ac-summary { border: 1px solid var(--ac-line); }
:root[data-tema="asesor"] .ac-pill { background: transparent; }
