/* ==========================================================================
   WEEM · Ventana emergente única (diálogo / hoja inferior)
   Un solo componente para todos los formularios públicos: WhatsApp previo,
   formación, «Quiero que me importen», salida, evaluador y cotización de la
   calculadora. Cada página conserva sus IDs, campos y controladores; este
   archivo solo define la apariencia.

   Escritorio (≥600px): tarjeta centrada. Móvil (<600px): hoja inferior con
   margen de área segura y entrada desde abajo (sin animación si la persona
   pidió movimiento reducido).

   Colores: copia de src/brand/tokens.css (--c-* y sus valores
   [data-theme=dark]) bajo el prefijo --wd-*, porque en las páginas públicas
   algunas --c-* tienen otro significado (tripletes RGB). La prueba
   tests/kit/weem-dialog.cjs comprueba que los valores sigan iguales.

   Las páginas públicas cargan además reglas antiguas con !important
   (weem-identity.css, learning.css). Por eso cada regla empieza con
   «html body» e incluye #serviceModal dentro de :is(): así gana por
   especificidad sin depender del orden de carga.
   Botones y campos: la biblioteca única /shared/weem-ui.css (.w-btn, .w-field,
   .w-input…). Ver «Puente con la biblioteca única» más abajo.
   ========================================================================== */

:root{
  --wd-surface:#FFFFFF;--wd-raised:#FAFAF8;--wd-line:#E2E0D9;--wd-ink:#0E1A1F;--wd-muted:#56666C;
  --wd-accent:#B84F0B;--wd-accent-ink:#FFFFFF;--wd-ok:#1E7A46;--wd-bad:#B42318;
  --wd-ring:rgba(184,79,11,.28);--wd-scrim:rgba(14,26,31,.42);
  --wd-shadow:0 1px 2px rgba(14,26,31,.06),0 24px 48px -16px rgba(14,26,31,.28);
  --wd-radius:20px;--wd-control:44px;--wd-field-radius:10px;
  --wd-font:'Instrument Sans',system-ui,-apple-system,'Segoe UI',sans-serif;
  --wd-ease:cubic-bezier(0,0,.2,1);
}
html[data-theme=dark],html.dark{
  --wd-surface:#10181C;--wd-raised:#162127;--wd-line:rgba(160,190,200,.14);--wd-ink:#E7EEF0;--wd-muted:#95A8AE;
  --wd-accent:#FF8A3D;--wd-accent-ink:#1A0D05;--wd-ok:#46D18C;--wd-bad:#FF6B6B;
  --wd-ring:rgba(255,138,61,.32);--wd-scrim:rgba(0,0,0,.62);
  --wd-shadow:0 1px 2px rgba(0,0,0,.4),0 24px 56px -16px rgba(0,0,0,.75);
}

/* --- Puente con la biblioteca única (/shared/weem-ui.css, issue #67) ----
   Dentro de la tarjeta, los tokens --w-* toman la paleta del diálogo. Así los
   componentes de la biblioteca (.w-btn, .w-field, .w-label, .w-input,
   .w-error, .w-chip) se ven con el formato examen sin reglas propias, y las
   reglas de abajo para el marcado antiguo (botones, campos, opciones) son
   alias de esos mismos tokens: un solo lenguaje visual, una sola fuente. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div){
  --w-font:var(--wd-font);
  --w-accent:var(--wd-accent);--w-accent-hover:color-mix(in srgb,var(--wd-accent) 88%,var(--wd-ink));
  --w-accent-ink:var(--wd-accent-ink);--w-accent-soft:var(--wd-ring);--w-accent-line:var(--wd-accent);
  --w-surface:var(--wd-surface);--w-surface-2:var(--wd-raised);--w-ink:var(--wd-ink);--w-ink-2:var(--wd-ink);--w-muted:var(--wd-muted);
  --w-line:var(--wd-line);--w-line-strong:var(--wd-line);
  --w-ring:var(--wd-accent);--w-ring-offset:var(--wd-surface);
  --w-success:var(--wd-ok);--w-success-soft:color-mix(in srgb,var(--wd-ok) 14%,transparent);
  --w-danger:var(--wd-bad);--w-danger-soft:color-mix(in srgb,var(--wd-bad) 8%,transparent);
  --w-radius:var(--wd-field-radius);--w-h:var(--wd-control);--w-h-lg:52px;
}

/* --- Fondo ------------------------------------------------------------- */
html body :is(.wd-overlay,.lead-overlay,.exit-overlay,.popup-overlay,.vm-overlay,#serviceModal){
  position:fixed!important;inset:0!important;z-index:10050!important;
  align-items:center!important;justify-content:center!important;
  padding:24px!important;overflow-y:auto!important;overscroll-behavior:contain;box-sizing:border-box!important;
  background:var(--wd-scrim)!important;
  -webkit-backdrop-filter:blur(6px)!important;backdrop-filter:blur(6px)!important;
}
html body .wd-overlay{display:none}
html body .wd-overlay.active{display:flex}
html body :is(.vm-overlay,#serviceModal) .vm-backdrop{background:transparent!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important}

/* --- Tarjeta ----------------------------------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div){
  box-sizing:border-box!important;position:relative!important;
  width:min(480px,100%)!important;max-width:480px!important;max-height:calc(100dvh - 48px)!important;
  margin:auto!important;padding:24px!important;overflow:auto!important;overscroll-behavior:contain;
  background:var(--wd-surface)!important;color:var(--wd-ink)!important;
  border:1px solid var(--wd-line)!important;border-radius:var(--wd-radius)!important;
  box-shadow:var(--wd-shadow)!important;
  font-family:var(--wd-font)!important;font-size:14px;line-height:1.5;text-align:left!important;
  transform:none!important;opacity:1!important;
  animation:wd-in .18s var(--wd-ease);
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div)::before{display:none!important}
@keyframes wd-in{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@keyframes wd-sheet{from{transform:translateY(100%)}to{transform:none}}

/* --- Marca, título y descripción -------------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.popup-logo,.vm-brand){
  display:flex!important;align-items:center!important;gap:8px;background:none!important;border:0!important;border-radius:0!important;
  padding:0!important;margin:0 56px 14px 0!important;min-height:0!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.popup-logo,.vm-brand) img{
  width:auto!important;height:20px!important;max-height:20px!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(h2,h3,.wd-title){
  font-family:var(--w-font)!important;font-size:21px!important;line-height:1.3!important;font-weight:700!important;letter-spacing:-.02em!important;
  color:var(--w-ink)!important;margin:0 48px 6px 0!important;padding:0!important;text-align:left!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(h2,h3,.wd-title)+:is(p,.wd-desc),
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-desc,.subtitle,.vm-sub,.modal-sub){
  font-size:14px!important;line-height:1.5!important;color:var(--w-muted)!important;margin:0 0 18px!important;opacity:1!important;text-align:left!important;
}

/* --- Cerrar (área táctil de 44px) ------------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-close,.lead-close,.exit-close,.popup-close,.vm-close,.weem-dialog-close,#serviceModal>div>button:first-child),
html body #serviceModal>div>button:first-child{
  position:absolute!important;top:10px!important;right:10px!important;left:auto!important;z-index:2!important;
  display:grid!important;place-items:center!important;box-sizing:border-box!important;
  width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;padding:0!important;margin:0!important;
  border:0!important;border-radius:10px!important;background:transparent!important;box-shadow:none!important;
  color:var(--w-muted)!important;font-size:22px!important;line-height:1!important;cursor:pointer;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-close,.lead-close,.exit-close,.popup-close,.vm-close,.weem-dialog-close,#serviceModal>div>button:first-child):hover,
html body #serviceModal>div>button:first-child:hover{background:var(--w-surface-2)!important;color:var(--w-ink)!important}

/* --- Formulario -------------------------------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) form{display:flex!important;flex-direction:column!important;gap:14px!important;margin:0!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.popup-form-scroll,.vm-head,.vm-form){display:flex;flex-direction:column;gap:14px;max-height:none!important;overflow:visible!important;padding:0!important;flex:none!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.popup-form-scroll,.vm-head)>:is(h2,h3,p){margin-bottom:0!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) form div{margin-top:0!important;margin-bottom:0!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.row,.vm-row,.popup-form-scroll>div:first-child:has(>div+div),form>div:first-child:not(.popup-form-scroll):has(>div+div>label)){
  display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(label:not(.wd-pill),.wd-label,legend){
  display:block!important;font-family:var(--w-font)!important;font-size:13px!important;line-height:1.4!important;font-weight:600!important;
  letter-spacing:0!important;text-transform:none!important;color:var(--w-ink)!important;margin:0 0 6px!important;padding:0!important;opacity:1!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not(.wd-native),select,textarea){
  box-sizing:border-box!important;width:100%!important;min-width:0!important;max-width:100%!important;
  height:var(--w-h)!important;min-height:var(--w-h)!important;padding:0 12px!important;margin:0!important;
  border:1px solid var(--w-line-strong)!important;border-radius:var(--w-radius)!important;
  background:var(--w-surface)!important;color:var(--w-ink)!important;-webkit-text-fill-color:var(--w-ink)!important;
  font:inherit!important;font-family:var(--w-font)!important;font-size:16px!important;line-height:1.4!important;
  box-shadow:0 1px 2px rgba(0,0,0,.04)!important;outline:0!important;opacity:1!important;
  transition:border-color var(--m-fast,120ms) ease,box-shadow var(--m-fast,120ms) ease;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) textarea:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not(.wd-native){height:auto!important;min-height:88px!important;padding:10px 12px!important;resize:vertical}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(input,textarea)::placeholder{color:var(--w-muted)!important;-webkit-text-fill-color:var(--w-muted)!important;opacity:.75!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) select option{background:var(--w-surface)!important;color:var(--w-ink)!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=submit]):not(.wd-native),select,textarea):focus{
  border-color:var(--w-accent)!important;box-shadow:0 0 0 3px var(--w-accent-soft)!important;outline:0!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(button,a,summary,[tabindex]):focus-visible{
  outline:2px solid var(--w-accent)!important;outline-offset:2px!important;
}

/* Prefijo telefónico y selector de país. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(div:has(>#leadPhone),div:has(>#svcPhone),.vm-phone,.wd-phone){display:flex!important;gap:8px!important;align-items:stretch!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(#ccBtn,.vm-phone-prefix,.cc-trigger,.wd-prefix,div:has(+#svcPhone)){
  display:inline-flex!important;align-items:center!important;gap:6px!important;flex:none!important;box-sizing:border-box!important;
  height:var(--w-h)!important;min-height:var(--w-h)!important;padding:0 12px!important;
  border:1px solid var(--w-line-strong)!important;border-radius:var(--w-radius)!important;
  background:var(--w-surface-2)!important;color:var(--w-ink)!important;font-size:15px!important;font-weight:500!important;white-space:nowrap;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(#ccDropdown,.cc-dropdown,.vm-cc-dropdown){
  background:var(--w-surface)!important;color:var(--w-ink)!important;border:1px solid var(--w-line-strong)!important;border-radius:12px!important;box-shadow:var(--wd-shadow)!important;z-index:10!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.cc-country,.vm-cc-item,#ccList>*){color:var(--w-ink)!important;min-height:44px}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.cc-country,.vm-cc-item,#ccList>*):hover{background:var(--w-surface-2)!important}

html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) div:has(>#ccBtn){position:relative!important;flex:none!important;display:flex!important;border:0!important;background:none!important;padding:0!important;height:auto!important;min-height:0!important;box-shadow:none!important}

/* Selector de país de owncoding-ui (inputs.js) dentro del diálogo. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) .oc-input-editor :is(button[aria-haspopup],.shrink-0>button){
  min-height:var(--w-h)!important;border:1px solid var(--w-line-strong)!important;border-radius:var(--w-radius)!important;
  background:var(--w-surface-2)!important;color:var(--w-ink)!important;box-shadow:none!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) .oc-input-editor :is(button[aria-haspopup],.shrink-0>button)[aria-expanded=true]{border-color:var(--w-accent)!important;box-shadow:0 0 0 3px var(--w-accent-soft)!important}

/* Opciones como tarjetas con letra (formato examen): radios A/B/C de ancho completo. */
html body .wd-card,html body .wd-card *,html body .wd-card *::before,html body .wd-card *::after{box-sizing:border-box}
html body .wd-card .wd-group{border:0;margin:0;padding:0;min-inline-size:0}
html body .wd-card .wd-pills{display:grid;gap:10px;counter-reset:wd-option}
html body .wd-card .wd-pill{position:relative;display:flex;margin:0;counter-increment:wd-option}
html body .wd-card .wd-pill input{position:absolute;inset:0;width:100%;height:100%;opacity:0;margin:0;cursor:pointer;z-index:1}
html body .wd-card .wd-pill>span{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:12px 14px;border:1.5px solid var(--w-line-strong);border-radius:14px;background:var(--w-surface-2);font-size:15px;font-weight:500;line-height:1.35;text-align:left;color:var(--w-ink);cursor:pointer;transition:border-color var(--m-fast,120ms) ease,background var(--m-fast,120ms) ease}
html body .wd-card .wd-pill>span::before{content:attr(data-key);flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:999px;border:1px solid var(--w-line-strong);background:var(--w-surface);font-family:'JetBrains Mono',ui-monospace,monospace;font-size:12px;font-weight:600;color:var(--w-muted)}
html body .wd-card .wd-pill>span:not([data-key])::before{content:counter(wd-option,upper-alpha)}
html body .wd-card .wd-pill input:hover+span{border-color:var(--w-accent)}
html body .wd-card .wd-pill input:checked+span{border-color:var(--w-accent);background:color-mix(in srgb,var(--w-accent) 9%,var(--w-surface));font-weight:600}
html body .wd-card .wd-pill input:checked+span::before{background:var(--w-accent);border-color:var(--w-accent);color:var(--w-accent-ink)}
html body .wd-card .wd-pill input:focus-visible+span{outline:2px solid var(--w-accent);outline-offset:2px}

/* Lo que una página oculta con [hidden] sigue oculto aunque otra regla le dé display. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) [hidden]{display:none!important}

/* --- Botón principal (ancho completo) --------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-btn,button[type=submit],.btn-submit,.btn-red,.cta-btn,.cta-wa,.vm-cta,#leadSubmitBtn,#svcSubmitBtn,#submitBtn,#submit-btn){
  display:flex!important;align-items:center!important;justify-content:center!important;gap:8px;box-sizing:border-box!important;
  width:100%!important;min-height:var(--w-h-lg)!important;height:auto!important;padding:10px 16px!important;margin:4px 0 0!important;
  border:1px solid var(--w-accent)!important;border-radius:12px!important;
  background:var(--w-accent)!important;color:var(--w-accent-ink)!important;-webkit-text-fill-color:var(--w-accent-ink)!important;
  font-family:var(--w-font)!important;font-size:16px!important;font-weight:600!important;line-height:1.3!important;letter-spacing:0!important;text-transform:none!important;
  text-decoration:none!important;text-align:center!important;white-space:normal!important;box-shadow:none!important;cursor:pointer;
  transition:background-color var(--m-fast,120ms) ease,filter var(--m-fast,120ms) ease;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-btn,button[type=submit],.btn-submit,.btn-red,.cta-btn,.cta-wa,.vm-cta,#leadSubmitBtn,#svcSubmitBtn,#submitBtn,#submit-btn):hover{filter:brightness(1.06)}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-btn,button[type=submit],.btn-submit,.btn-red,.cta-btn,.vm-cta,#leadSubmitBtn,#svcSubmitBtn,#submitBtn,#submit-btn):disabled{opacity:.6!important;cursor:wait!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) .popup-sticky-cta{position:static!important;display:flex;flex-direction:column;gap:8px;padding:0!important;margin:0!important;border:0!important;background:none!important;box-shadow:none!important}

/* Notas, enlace secundario y «Ahora no». */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-note,.popup-sticky-cta p,.skip,.terms,form>p:last-child,.exit-popup>p:last-child){
  font-size:12.5px!important;line-height:1.45!important;color:var(--w-muted)!important;text-align:center!important;margin:8px 0 0!important;opacity:1!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.skip,.exit-popup>p:last-child){display:block!important;min-height:44px;line-height:44px!important;cursor:pointer}

/* --- Error y estado de éxito ----------------------------------------- */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-error,.quote-error,.modal-error,.form-error,.vm-error p){
  color:var(--w-danger)!important;font-size:13.5px!important;line-height:1.45!important;margin:0!important;padding:10px 12px!important;
  border:1px solid color-mix(in srgb,var(--w-danger) 35%,transparent)!important;border-radius:var(--w-radius)!important;
  background:color-mix(in srgb,var(--w-danger) 8%,transparent)!important;text-align:left!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-error,.quote-error) a{color:inherit!important;font-weight:600;text-decoration:underline}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-error,.quote-error,.modal-error,.form-error)[hidden]{display:none!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-success,.quote-success,.success-msg,#leadSuccess,#svcSuccess,#form-success){text-align:center!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.wd-success,.quote-success,.success-msg,#leadSuccess,#svcSuccess,#form-success) :is(h2,h3,p){text-align:center!important;margin-left:0!important;margin-right:0!important}
html body .wd-card .wd-success-icon,
html body .lead-overlay>.quote-popup .quote-success::before{
  display:grid;place-items:center;width:48px;height:48px;margin:4px auto 14px;border-radius:999px;
  background:color-mix(in srgb,var(--w-success) 14%,transparent);color:var(--w-success);font-size:24px;font-weight:700;
}
html body .lead-overlay>.quote-popup .quote-success::before{content:'✓'}

/* Resumen de cotización (calculadora). */
html body .lead-overlay>.quote-popup .quote-summary{background:var(--w-surface-2)!important;border:1px solid var(--w-line-strong)!important;border-radius:12px!important;margin:0 0 16px!important;padding:12px 14px!important}
html body .lead-overlay>.quote-popup .quote-summary dt{color:var(--w-muted)!important}
html body .lead-overlay>.quote-popup .quote-summary dd{color:var(--w-ink)!important}
html body .lead-overlay>.quote-popup .quote-field{display:grid!important;gap:0!important}

/* --- Móvil: hoja inferior --------------------------------------------- */
@media (max-width:599.98px){
  html body :is(.wd-overlay,.lead-overlay,.exit-overlay,.popup-overlay,.vm-overlay,#serviceModal){align-items:flex-end!important;justify-content:stretch!important;padding:0!important;padding-top:max(16px,env(safe-area-inset-top))!important}
  html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div){
    width:100%!important;max-width:none!important;margin:auto 0 0!important;
    max-height:calc(100dvh - max(16px,env(safe-area-inset-top)))!important;
    border-bottom:0!important;border-radius:var(--wd-radius) var(--wd-radius) 0 0!important;
    padding:20px 20px calc(20px + env(safe-area-inset-bottom))!important;
    animation:wd-sheet .26s var(--wd-ease);
  }
  html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.row,.vm-row,.popup-form-scroll>div:first-child:has(>div+div),form>div:first-child:not(.popup-form-scroll):has(>div+div>label)){grid-template-columns:1fr!important}
}
@media (prefers-reduced-motion:reduce){
  html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div){animation:none!important}
  html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) *{transition:none!important}
}

/* Marca: versión oscura sobre fondo claro y clara sobre fondo oscuro. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.vm-brand) img{content:url('/brand/weem-firma-horizontal-clara.svg')!important;filter:none!important}
html[data-theme=dark] body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.vm-brand) img,
html.dark body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.vm-brand) img{content:url('/brand/weem-firma-horizontal-oscura.svg')!important}

/* --- Con una ventana abierta, nada flota encima ------------------------ */
/* El aviso de cookies, el de instalar la app, la barra inferior y la barra del resultado de las herramientas
   se ocultan mientras haya un formulario abierto; vuelven al cerrarlo. */
html:has(:is(.wd-overlay,.lead-overlay,.exit-overlay,.popup-overlay,.vm-overlay,#serviceModal).active) :is(#cookieConsent,#v-pwa-banner,.v-bottom-nav,.kit-dock){visibility:hidden!important;pointer-events:none!important}

/* ==========================================================================
   Formato examen (referencia: examen con calificación). Cabecera con insignia
   redondeada + título + línea de estado + cerrar; cuerpo con pregunta grande y
   opciones con letra; pie con botón principal de ancho completo, fijo abajo.
   «:is(.wd-card,#_)» da a estas reglas el mismo peso que las anteriores
   (que incluyen #serviceModal), así ganan por orden sin más !important.
   ========================================================================== */
html body :is(.wd-card,#_).wd-card--exam{padding:0!important;display:flex!important;flex-direction:column!important;overflow:hidden!important}
html body :is(.wd-card,#_).wd-card--exam .wd-flow:not([hidden]){display:flex!important;flex-direction:column!important;flex:1 1 auto!important;min-height:0!important;gap:0!important;margin:0!important}
html body :is(.wd-card,#_) .wd-head{display:flex;align-items:center;gap:12px;padding:18px 16px 14px 18px;border-bottom:1px solid var(--w-line-strong);flex:none}
html body :is(.wd-card,#_) .wd-badge{flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:12px;background:var(--w-accent);color:var(--w-accent-ink)}
html body :is(.wd-card,#_) .wd-badge svg{width:22px;height:22px}
html body :is(.wd-card,#_) .wd-head__text{flex:1;min-width:0}
html body :is(.wd-card,#_) .wd-head .wd-title{font-size:18px!important;font-weight:700!important;margin:0!important}
html body :is(.wd-card,#_) .wd-head .wd-sub{font-size:13px!important;line-height:1.4!important;color:var(--w-muted)!important;margin:2px 0 0!important}
html body :is(.wd-card,#_) .wd-head .wd-close{position:static!important;flex:none}
html body :is(.wd-card,#_) .wd-progress{flex:none;height:4px;background:var(--w-surface-2)}
html body :is(.wd-card,#_) .wd-progress span{display:block;height:100%;width:var(--wd-step,50%);background:var(--w-accent);border-radius:0 4px 4px 0;transition:width .3s var(--wd-ease)}
html body :is(.wd-card,#_) .wd-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:20px 18px;display:flex;flex-direction:column;gap:14px}
html body :is(.wd-card,#_) .wd-body .wd-question{display:block;font-size:20px!important;line-height:1.3!important;font-weight:700!important;letter-spacing:-.015em!important;color:var(--w-ink)!important;margin:0 0 4px!important;padding:0!important}
html body :is(.wd-card,#_) .wd-body .wd-desc{margin:0 0 4px!important}
html body :is(.wd-card,#_) .wd-body .wd-flow-step:not([hidden]){display:flex;flex-direction:column;gap:14px}
html body :is(.wd-card,#_) .wd-foot{flex:none;display:grid;gap:4px;padding:14px 18px 18px;border-top:1px solid var(--w-line-strong);background:var(--w-surface)}
html body :is(.wd-card,#_) .wd-foot .wd-btn{margin:0!important}
html body :is(.wd-card,#_) .wd-foot :is([hidden],#_){display:none!important}
/* «Cambiar la opción»: .w-btn.w-btn--ghost de ancho completo, en gris. */
html body :is(.wd-card,#_) .wd-link{width:100%;--_fg:var(--w-muted);font-size:14px}
html body :is(.wd-card,#_) .wd-link:hover{--_fg:var(--w-ink)}
html body :is(.wd-card,#_).wd-card--exam .wd-success{padding:24px 18px 20px}
html body :is(.wd-card,#_) .wd-btn .wd-arrow{width:18px;height:18px;flex:none}

/* Diálogos existentes: misma familia visual sin tocar su marcado ni sus formularios. */
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.popup-logo,.vm-brand){
  position:relative!important;display:block!important;width:44px!important;height:44px!important;margin:0 0 14px!important;
  border-radius:12px!important;background:var(--w-accent)!important;font-size:0!important;color:transparent!important;
}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.popup-logo,.vm-brand)>*{display:none!important}
html body :is(.wd-card,.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.weem-dialog-brand,[data-weem-dialog-brand],.popup-logo,.vm-brand)::after{
  content:"";position:absolute;inset:0;background:var(--w-accent-ink);
  -webkit-mask:url('/brand/weem-symbol.svg') center/26px no-repeat;mask:url('/brand/weem-symbol.svg') center/26px no-repeat;
}

@media (max-width:599.98px){
  html body :is(.wd-card,#_).wd-card--exam{padding:0!important}
  html body :is(.wd-card,#_) .wd-foot{padding-bottom:calc(16px + env(safe-area-inset-bottom))}
  /* Pie fijo: el botón principal queda visible mientras se desplaza el formulario. */
  /* Se fija el contenedor del botón (o el botón si es hijo directo del formulario), porque «sticky» solo se mueve dentro de su padre. */
  html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) :is(.popup-sticky-cta,form>:is(button[type=submit],.btn-submit,.cta-btn,.vm-cta,#leadSubmitBtn,#svcSubmitBtn,#submitBtn,#submit-btn)){
    position:sticky!important;bottom:0!important;z-index:3!important;background:var(--w-surface)!important;box-shadow:0 -14px 14px -4px var(--w-surface),0 10px 0 10px var(--w-surface)!important;
  }
  html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) form>:is(button[type=submit],.btn-submit,.cta-btn,.vm-cta,#leadSubmitBtn,#svcSubmitBtn,#submitBtn,#submit-btn){background:var(--w-accent)!important}
}

/* Opciones de radio de los formularios existentes («¿Ya importaste?»): tarjetas con letra, como el examen. */
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) div:has(>label>input[type=radio]){display:grid!important;gap:8px!important;counter-reset:wd-radio}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio]){
  counter-increment:wd-radio;display:flex!important;align-items:center!important;gap:12px!important;min-height:52px!important;margin:0!important;padding:10px 14px!important;
  border:1.5px solid var(--w-line-strong)!important;border-radius:14px!important;background:var(--w-surface-2)!important;color:var(--w-ink)!important;
  font-size:15px!important;font-weight:500!important;cursor:pointer;
}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio])::before{
  content:counter(wd-radio,upper-alpha);flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:999px;
  border:1px solid var(--w-line-strong);background:var(--w-surface);font-family:'JetBrains Mono',ui-monospace,monospace;font-size:12px;font-weight:600;color:var(--w-muted);
}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio]):hover{border-color:var(--w-accent)!important}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio]:checked){border-color:var(--w-accent)!important;font-weight:600!important;color:var(--w-ink)!important}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio]:checked)::before{background:var(--w-accent);border-color:var(--w-accent);color:var(--w-accent-ink)}
html body :is(.lead-overlay>.lead-popup,.exit-overlay>.exit-popup,.popup-overlay>.popup,.vm-overlay>.vm-card,#serviceModal>div) label:has(>input[type=radio]:focus-visible){outline:2px solid var(--w-accent)!important;outline-offset:2px}
@media (prefers-reduced-motion:reduce){
  html body :is(.wd-card,#_) .wd-progress span{transition:none}
}
