/* ==========================================================================
   Demo pública del diseñador de procesos (layout lead_demo, /demo).
   Página comercial: mucho aire, mensajes grandes, color de la instancia
   (--ld-brand / --ld-brand-rgb, del branding por defecto).
   ========================================================================== */

.ld-body {
  --ld-brand: #1f6f5c;
  --ld-brand-rgb: 31, 111, 92;
  --ld-ink: #0f172a;
  --ld-muted: #5b6678;
  --ld-line: #e2e6ee;
  --ld-card: #ffffff;
  --ld-radius: 18px;
  --ld-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 40px -12px rgba(15, 23, 42, .18);

  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ld-ink);
  background: #f4f6fa;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.ld-body *, .ld-body *::before, .ld-body *::after { box-sizing: border-box; }
.ld-body.ld-noscroll { overflow: hidden; }
.ld-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ld-body [hidden] { display: none !important; }

.ld-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(50% 55% at 0% 0%, rgba(var(--ld-brand-rgb), .16), transparent 70%),
    radial-gradient(45% 50% at 100% 100%, rgba(var(--ld-brand-rgb), .12), transparent 70%),
    linear-gradient(180deg, #f7f8fb 0%, #eef1f6 100%);
}

/* ---- Cabecera ---------------------------------------------------------- */
.ld-header {
  display: flex; align-items: center; gap: 24px;
  padding: 18px 32px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(247, 248, 251, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, .05);
}
.ld-logo img { height: 34px; width: auto; display: block; }

.ld-progress {
  list-style: none; margin: 0 auto; padding: 0;
  display: flex; gap: 6px; align-items: center;
}
.ld-progress li {
  display: flex; align-items: center; gap: 8px;
  color: var(--ld-muted); font-size: 13px; font-weight: 600;
}
.ld-progress li + li::before {
  content: ""; width: 28px; height: 2px; border-radius: 2px;
  background: var(--ld-line); margin-right: 6px;
}
.ld-progress li.is-done + li::before,
.ld-progress li.is-current::before { background: rgba(var(--ld-brand-rgb), .5); }
.ld-progress-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px;
  background: #fff; border: 2px solid var(--ld-line);
}
.ld-progress li.is-done .ld-progress-dot { background: rgba(var(--ld-brand-rgb), .12); border-color: transparent; color: var(--ld-brand); }
.ld-progress li.is-current { color: var(--ld-ink); }
.ld-progress li.is-current .ld-progress-dot { background: var(--ld-brand); border-color: var(--ld-brand); color: #fff; }

/* Selector de idioma: el mismo de la pantalla de login (.lg-lang). */
.ld-lang {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 42px; border-radius: 999px;
  background: #fff; border: 1px solid var(--ld-line);
  box-shadow: 0 6px 18px -10px rgba(15, 23, 42, .35);
  color: var(--ld-ink); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ld-lang:hover { border-color: rgba(var(--ld-brand-rgb), .5); }
.ld-lang:focus-within { border-color: rgb(var(--ld-brand-rgb)); box-shadow: 0 0 0 4px rgba(var(--ld-brand-rgb), .15); }
.ld-lang > svg { width: 18px; height: 18px; flex: 0 0 18px; color: rgb(var(--ld-brand-rgb)); }
.ld-lang select {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  padding: 0 22px 0 0; margin-right: -20px;
  font: inherit; font-size: .92rem; font-weight: 700; color: var(--ld-ink); cursor: pointer;
}
.ld-lang select:focus { outline: none; }
.ld-lang .ld-lang-caret { width: 14px; height: 14px; flex: 0 0 14px; color: var(--ld-muted); pointer-events: none; }

/* ---- Cuerpo ------------------------------------------------------------ */
.ld-main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 40px 24px 64px; }
.ld-footer {
  display: flex; justify-content: center; align-items: center; gap: 16px;
  padding: 20px; font-size: 12px; color: var(--ld-muted);
}
.ld-inline { display: inline; margin: 0; }
.ld-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ld-muted); text-decoration: underline; cursor: pointer; }

.ld-kicker {
  margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ld-brand);
}
.ld-title { margin: 0 0 14px; font-size: clamp(28px, 3.6vw, 44px); line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
.ld-text { font-size: 17px; color: #334155; }
.ld-text p { margin: 0 0 10px; }
.ld-muted { color: var(--ld-muted); margin: 0 0 18px; }
.ld-center { text-align: center; }

/* ---- Botones ----------------------------------------------------------- */
.ld-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 15px; text-decoration: none;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.ld-btn svg { width: 18px; height: 18px; }
.ld-btn:hover { transform: translateY(-1px); }
.ld-btn--primary { background: var(--ld-brand); color: #fff; box-shadow: 0 10px 24px -10px rgba(var(--ld-brand-rgb), .8); }
.ld-btn--primary:hover { box-shadow: 0 14px 30px -10px rgba(var(--ld-brand-rgb), .9); }
.ld-btn--ghost { background: #fff; color: var(--ld-ink); border-color: var(--ld-line); }
.ld-btn--light { background: #fff; color: var(--ld-brand); }
.ld-btn--subtle { background: transparent; color: var(--ld-muted); border-color: transparent; }
.ld-btn--subtle:hover { color: #b91c1c; background: #fef2f2; }
.ld-btn--danger { background: #dc2626; color: #fff; box-shadow: 0 10px 24px -10px rgba(220, 38, 38, .7); }
.ld-btn--lg { padding: 15px 28px; font-size: 16px; border-radius: 14px; }
.ld-btn.is-busy { opacity: .7; pointer-events: none; }
.ld-btn.is-busy::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: ld-spin .8s linear infinite;
}
.ld-body form.button_to { display: inline; margin: 0; }

/* ---- Mensaje comercial (stage) ---------------------------------------- */
.ld-stage {
  background: var(--ld-card); border-radius: 24px; box-shadow: var(--ld-shadow);
  padding: 28px; margin-bottom: 28px; animation: ld-in .45s ease both;
}
.ld-slides { position: relative; }
.ld-slide { display: none; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; }
.ld-slide.is-active { display: grid; animation: ld-fade .5s ease both; }
.ld-slide-media {
  aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden;
  background: #0f172a; display: grid; place-items: center;
}
.ld-slide-media img, .ld-slide-media video, .ld-slide-media iframe {
  width: 100%; height: 100%; object-fit: contain; border: 0; display: block;
}
/* Imágenes: completas y con su proporción, sin recortar ni marco oscuro. */
.ld-slide-media--image { aspect-ratio: auto; background: transparent; }
.ld-slide-media--image img { height: auto; max-height: 520px; border-radius: 16px; }
.ld-slide-media--default {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: #fff;
  background:
    radial-gradient(60% 70% at 20% 10%, rgba(255,255,255,.22), transparent 60%),
    linear-gradient(135deg, var(--ld-brand), rgba(var(--ld-brand-rgb), .65));
}
.ld-slide-media--default svg { width: 34%; height: auto; opacity: .95; }
.ld-slide-copy { padding: 8px 8px 8px 0; }
.ld-dots { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.ld-dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: var(--ld-line); cursor: pointer; transition: width .2s; }
.ld-dot.is-active { width: 26px; border-radius: 6px; background: var(--ld-brand); }
.ld-stage-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

.ld-stage--compact { box-shadow: none; padding: 0; margin-bottom: 18px; }
.ld-stage--compact .ld-slide { grid-template-columns: 1fr; gap: 20px; }
.ld-stage--compact .ld-title { font-size: 26px; }
.ld-stage--compact .ld-text { font-size: 15px; }

/* ---- Portada ----------------------------------------------------------- */
.ld-cta-row { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: center; margin: 8px 0 32px; }
.ld-cta-row .ld-muted { margin: 0; }
.ld-how { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.ld-how-item { background: rgba(255,255,255,.75); border: 1px solid var(--ld-line); border-radius: var(--ld-radius); padding: 22px; }
.ld-how-item h3 { margin: 10px 0 6px; font-size: 17px; }
.ld-how-item p { margin: 0; color: var(--ld-muted); font-size: 14px; }
.ld-how-num {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(var(--ld-brand-rgb), .12); color: var(--ld-brand); font-weight: 800;
}

/* ---- Tarjetas y formularios ------------------------------------------- */
.ld-step { animation: ld-in .4s ease both; }
.ld-card { background: var(--ld-card); border-radius: 22px; box-shadow: var(--ld-shadow); padding: 34px; }
.ld-card--narrow { max-width: 720px; margin: 0 auto; }
.ld-card-title { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }

.ld-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.ld-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.ld-field { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; color: #334155; }
.ld-field input {
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ld-ink);
  width: 100%; min-width: 0;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ld-line); background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s;
}
.ld-field input:focus { outline: none; border-color: var(--ld-brand); box-shadow: 0 0 0 4px rgba(var(--ld-brand-rgb), .14); background: #fff; }
.ld-hint { font-size: 12px; font-weight: 500; color: var(--ld-muted); }
.ld-form-note { margin: -4px 0 0; }
.ld-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #334155; cursor: pointer; }
.ld-check input { flex: none; margin-top: 3px; width: 17px; height: 17px; accent-color: var(--ld-brand); }
.ld-form-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.ld-captcha:empty { display: none; }
.ld-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ld-alert { border-radius: 14px; padding: 14px 18px; margin: 0 0 18px; font-size: 14px; }
.ld-alert p { margin: 4px 0 10px; }
.ld-alert ul { margin: 0; padding-left: 18px; }
.ld-flash { max-width: 720px; margin: 0 auto 18px; }
.ld-alert--error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.ld-alert--info { background: rgba(var(--ld-brand-rgb), .07); border: 1px solid rgba(var(--ld-brand-rgb), .25); }

.ld-drop {
  position: relative; display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 36px 20px; border: 2px dashed rgba(var(--ld-brand-rgb), .35); border-radius: 18px;
  background: rgba(var(--ld-brand-rgb), .04); cursor: pointer; transition: background .15s, border-color .15s;
}
.ld-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ld-drop svg { width: 42px; height: 42px; color: var(--ld-brand); }
.ld-drop strong { font-size: 16px; }
.ld-drop small { color: var(--ld-muted); }
.ld-drop.is-over, .ld-drop:hover { background: rgba(var(--ld-brand-rgb), .09); border-color: var(--ld-brand); }
.ld-drop.has-file { border-style: solid; background: rgba(var(--ld-brand-rgb), .08); }
.ld-tips { margin: 0; padding-left: 18px; color: var(--ld-muted); font-size: 13px; display: grid; gap: 4px; }

/* ---- Espera ------------------------------------------------------------ */
.ld-working {
  display: flex; gap: 18px; align-items: center; max-width: 720px; margin: 0 auto 12px;
  background: var(--ld-card); border-radius: 18px; box-shadow: var(--ld-shadow); padding: 20px 24px;
}
.ld-spinner {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid rgba(var(--ld-brand-rgb), .18); border-top-color: var(--ld-brand);
  animation: ld-spin 1s linear infinite;
}
.ld-working-body { flex: 1; min-width: 0; }
.ld-working-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ld-percent { font-weight: 800; color: var(--ld-brand); font-variant-numeric: tabular-nums; }
.ld-bar { height: 10px; margin: 10px 0 4px; border-radius: 999px; background: rgba(var(--ld-brand-rgb), .12); overflow: hidden; }
.ld-bar span {
  display: block; height: 100%; border-radius: inherit; transition: width 2s linear;
  background-color: var(--ld-brand);
  background-image: linear-gradient(45deg, rgba(255,255,255,.22) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.22) 50%, rgba(255,255,255,.22) 75%, transparent 75%, transparent);
  background-size: 18px 18px;
  animation: ld-stripes 1s linear infinite;
}
@keyframes ld-stripes { from { background-position: 0 0; } to { background-position: 18px 0; } }
.ld-phases { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ld-muted); }
.ld-phases li::before { content: "○ "; }
.ld-phases li.is-current { color: var(--ld-brand); font-weight: 700; }
.ld-phases li.is-current::before { content: "● "; }
.ld-phases li.is-done { color: var(--ld-ink); }
.ld-phases li.is-done::before { content: "✓ "; color: var(--ld-brand); }
.ld-waiting .ld-stage { margin-top: 18px; }

/* ---- Diseño ------------------------------------------------------------ */
.ld-design-head { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.ld-design-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ld-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ld-chips li { background: #fff; border: 1px solid var(--ld-line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ld-muted); }
.ld-chips li strong { color: var(--ld-ink); }
.ld-chips li.is-ai { border-color: rgba(var(--ld-brand-rgb), .35); background: rgba(var(--ld-brand-rgb), .07); }
.ld-chips li.is-locked { background: #fff7ed; border-color: #fed7aa; }

/* Cabecera del diseño con el botón de ayuda a la derecha. La tarjeta se abre
   flotando sobre el diseño, sin empujarlo hacia abajo. */
.ld-design-top { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.ld-design-top .ld-design-head { flex-direction: column; align-items: flex-start; justify-content: flex-start; margin-bottom: 0; }
.ld-help { position: relative; flex: none; }
.ld-help summary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 8px; border-radius: 999px;
  background: #fff; border: 1px solid rgba(var(--ld-brand-rgb), .25);
  box-shadow: 0 6px 18px -10px rgba(15, 23, 42, .35);
  font-weight: 800; font-size: 14px; cursor: pointer; list-style: none; white-space: nowrap;
  transition: border-color .15s, box-shadow .15s;
}
.ld-help summary:hover, .ld-help[open] summary { border-color: var(--ld-brand); box-shadow: 0 0 0 4px rgba(var(--ld-brand-rgb), .12); }
.ld-help summary::-webkit-details-marker { display: none; }
.ld-help summary::after { content: "▾"; color: var(--ld-muted); transition: transform .2s; }
.ld-help[open] summary::after { transform: rotate(180deg); }
.ld-help-badge {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ld-brand); color: #fff; font-size: 14px; font-weight: 800;
}
.ld-help ul {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30;
  width: min(380px, calc(100vw - 32px));
  list-style: none; margin: 0; padding: 18px; display: grid; gap: 12px;
  background: #fff; border: 1px solid rgba(var(--ld-brand-rgb), .22); border-radius: 18px;
  box-shadow: 0 24px 60px -18px rgba(15, 23, 42, .45);
  animation: ld-in .2s ease both;
}
.ld-help li { display: flex; gap: 10px; align-items: flex-start; }
.ld-help-icon { flex: none; width: 22px; text-align: center; font-size: 15px; line-height: 1.4; }
.ld-help strong { font-size: 13.5px; }
.ld-help p { margin: 1px 0 0; font-size: 13px; color: var(--ld-muted); line-height: 1.45; }

.ld-modal-box--sm { width: min(480px, 100%); text-align: center; }
.ld-modal-box.ld-modal-box--sm .ld-cta-row { justify-content: center; margin-top: 18px; }
.ld-modal-box--sm .ld-text { font-size: 15px; }
.ld-modal-icon {
  width: 56px; height: 56px; margin: 4px auto 14px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(var(--ld-brand-rgb), .12); color: var(--ld-brand);
}
.ld-modal-icon--danger { background: #fef2f2; color: #dc2626; }
.ld-modal-cancel { display: block; margin: 14px auto 0; }
.ld-modal-small { font-size: 13px; margin: 10px 0 0; }
.ld-modal-icon svg { width: 28px; height: 28px; }
.ld-modal-title { margin: 0 0 8px; font-size: 22px; font-weight: 800; }

/* Prompts en redacción con el diseño ya a la vista. */
.ld-drafting {
  display: flex; gap: 14px; align-items: center; margin: 0 0 16px; padding: 14px 18px;
  border-radius: 16px; background: rgba(var(--ld-brand-rgb), .07); border: 1px solid rgba(var(--ld-brand-rgb), .25);
}
.ld-drafting p { margin: 2px 0 0; font-size: 14px; color: var(--ld-muted); }
.ld-drafting--done { background: #ecfdf5; border-color: #a7f3d0; }
.ld-spinner--sm { width: 28px; height: 28px; border-width: 3px; }
.ld-mini-spinner {
  display: inline-block; width: 11px; height: 11px; vertical-align: -1px; border-radius: 50%;
  border: 2px solid rgba(var(--ld-brand-rgb), .25); border-top-color: var(--ld-brand);
  animation: ld-spin .9s linear infinite;
}
.ld-chips li.is-drafting { border-color: rgba(var(--ld-brand-rgb), .35); color: var(--ld-brand); font-weight: 600; }
.ld-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.ld-doc { width: 100%; height: 75vh; border: 1px solid var(--ld-line); border-radius: 16px; background: #fff; }

.ld-banner {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  margin-top: 32px; padding: 24px 28px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--ld-brand), rgba(var(--ld-brand-rgb), .75));
  box-shadow: 0 18px 40px -18px rgba(var(--ld-brand-rgb), .9);
}
.ld-banner p { margin: 4px 0 0; opacity: .9; }
.ld-exit { display: flex; justify-content: center; margin-top: 22px; }

/* ---- Modal ------------------------------------------------------------- */
.ld-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.ld-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.ld-modal-box {
  position: relative; width: min(620px, 100%); max-height: 92vh; overflow: auto;
  background: #fff; border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px -20px rgba(15,23,42,.5);
  animation: ld-in .3s ease both;
}
.ld-modal-box .ld-cta-row { margin: 0; justify-content: flex-start; }
.ld-modal-x { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ld-muted); cursor: pointer; }

/* ---- Gracias ----------------------------------------------------------- */
.ld-thanks-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; color: #fff; background: var(--ld-brand);
}

@keyframes ld-spin { to { transform: rotate(360deg); } }
@keyframes ld-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ld-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- Móvil ------------------------------------------------------------- */
@media (max-width: 860px) {
  .ld-header { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .ld-progress { order: 3; width: 100%; justify-content: center; }
  .ld-progress-label { display: none; }
  .ld-main { padding: 24px 16px 48px; }
  .ld-slide, .ld-slide.is-active { grid-template-columns: 1fr; gap: 20px; }
  .ld-stage, .ld-card { padding: 20px; }
  .ld-grid, .ld-how { grid-template-columns: minmax(0, 1fr); }
  .ld-design-top { flex-direction: column-reverse; }
  .ld-help ul { right: auto; left: 0; }
  .ld-lang { height: 38px; padding: 0 12px; }
}
/* Con "reducir movimiento" se quitan las animaciones decorativas, pero no las
   que indican que la aplicación sigue trabajando (spinner y barra). */
@media (prefers-reduced-motion: reduce) {
  .ld-body *:not(.ld-spinner):not(.ld-mini-spinner):not(.ld-bar span):not(.ld-btn.is-busy) { animation: none !important; transition: none !important; }
  .ld-spinner { animation-duration: 1.4s !important; }
}
