/* ==========================================================================
   Onboarding ZAK · estilos de interfaz
   Todos los colores vienen de tokens.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out);
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--itech-white); color: var(--itech-purple);
  padding: 8px 14px; border-radius: var(--radius-input); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Tipografía de marca ---------- */
.h1, .h2, .brand-text { font-family: var(--font-brand); font-weight: 400; letter-spacing: -0.01em; }
.h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.02; margin: 0; }
.h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; margin: 0; }
.highlight { font-family: var(--font-brand); color: var(--accent-text); }
.eyebrow {
  font-size: .72rem; font-weight: 600; letter-spacing: .28em; text-transform: uppercase;
}

/* ---------- Superficie de marca: degradado + retícula + resplandor ---------- */
.brand-surface {
  position: relative; isolation: isolate; overflow: hidden;
  background: var(--itech-gradient); color: var(--itech-white);
}
.brand-surface::before { /* retícula de puntos */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1.4px, transparent 1.6px);
  background-size: 48px 48px; background-position: 24px 24px;
}
.brand-surface::after { /* resplandor magenta en la esquina */
  content: ''; position: absolute; z-index: -1;
  width: 70vmax; height: 70vmax; right: -25vmax; top: -30vmax;
  background: radial-gradient(circle, rgba(167, 45, 188, .75) 0%, rgba(167, 45, 188, 0) 62%);
  pointer-events: none;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: var(--radius-pill);
  border: 0; font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--itech-gradient); color: var(--itech-white); }
.btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(83, 3, 123, .30); }
.btn-white { background: var(--itech-white); color: var(--itech-purple); }
.btn-white:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(28, 28, 28, .25); }
.btn-white:hover .btn-arrow { transform: translateX(4px); }
.btn-ghost-white { background: transparent; color: var(--itech-white); border: 1.5px solid rgba(255, 255, 255, .55); }
.btn-ghost-white:hover { background: rgba(255, 255, 255, .1); }
.btn-ghost { background: transparent; color: var(--accent-text); border: 1.5px solid var(--chip-border); }
.btn-ghost:hover { background: var(--chip-hover); }
.btn-text {
  background: none; border: 0; color: var(--accent-text); font-weight: 600;
  padding: 8px 10px; border-radius: var(--radius-input); min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-text:hover { background: var(--chip-hover); }
.btn-arrow { transition: transform var(--dur-fast) var(--ease-out); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: .92rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--chip-hover); }
.icon { width: 20px; height: 20px; flex: none; }

/* ==========================================================================
   1. Bienvenida
   ========================================================================== */
.welcome { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 28px 16px; }
@media (min-width: 768px) { .welcome { padding: 40px 56px; } }
.welcome-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.welcome-top .logo { width: 132px; height: auto; } /* ≥110 px: tamaño mínimo del logotipo */
.welcome-top .eyebrow { color: rgba(255, 255, 255, .78); display: none; }
@media (min-width: 640px) { .welcome-top .eyebrow { display: block; } }
.welcome-main { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 820px; padding: 48px 0; }
.welcome-main .eyebrow { color: rgba(255, 255, 255, .8); margin-bottom: 20px; }
.welcome-main .lead { font-size: clamp(1.05rem, 2vw, 1.3rem); max-width: 34em; margin: 22px 0 8px; color: rgba(255, 255, 255, .95); }
.welcome-main .meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 18px 0 36px; color: rgba(255, 255, 255, .85); font-size: .95rem; }
.welcome-main .meta span { display: inline-flex; align-items: center; gap: 8px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.welcome-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: rgba(255, 255, 255, .75); font-size: .9rem; }
.welcome-foot .brand-text { color: var(--itech-white); font-size: 1.05rem; }

/* ==========================================================================
   2. Encabezado fijo + progreso
   ========================================================================== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-row { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.header-row .logo { width: 110px; height: auto; }
.header-row .logo-positive { display: var(--logo-positive); }
.header-row .logo-negative { display: var(--logo-negative); }
.header-spacer { flex: 1; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions .btn-text span { display: none; }
@media (min-width: 640px) { .header-actions .btn-text span { display: inline; } }

.progress-wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 12px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: .7rem; color: var(--text-muted); margin-bottom: 8px; }
.progress-meta .eyebrow { font-size: .68rem; letter-spacing: .2em; }
.progress-meta .section-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.progress-seg { height: 6px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; position: relative; }
.progress-seg > i {
  position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--fill, 0));
  background: var(--itech-gradient); background-size: calc(100% * var(--n, 14)) 100%;
  transition: transform var(--dur-med) var(--ease-out);
}

/* ==========================================================================
   3. Chat
   ========================================================================== */
.chat-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.chat-log {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 24px 16px 32px; display: flex; flex-direction: column; gap: 14px;
}
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.msg-agent { padding-right: 8%; }
.msg-user { justify-content: flex-end; padding-left: 12%; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--card); display: grid; place-items: center; border: 1px solid var(--border);
}
.avatar img { width: 24px; height: auto; } /* isotipo ≥ 24 px */
.avatar-spacer { width: 40px; flex: none; }
.bubble {
  padding: 12px 16px; border-radius: var(--radius-bubble); max-width: 100%;
  overflow-wrap: anywhere;
}
.msg-agent .bubble { background: var(--card); color: var(--text); border-bottom-left-radius: 6px; }
.msg-user .bubble { background: var(--itech-gradient); color: var(--itech-white); border-bottom-right-radius: 6px; }
.bubble p { margin: 0; }
.bubble p + p { margin-top: 6px; }
.bubble .hint { font-size: .9rem; color: var(--text-muted); margin-top: 6px; }
.bubble .q-label { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; display: block; }
.answer-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.answer-lines .k { opacity: .82; font-size: .82rem; display: block; }
.answer-meta { display: flex; justify-content: flex-end; }
.edit-link {
  background: none; border: 0; color: var(--text-muted); font-size: .82rem; font-weight: 600;
  padding: 4px 8px; border-radius: 8px; display: inline-flex; gap: 4px; align-items: center;
}
.edit-link:hover { color: var(--accent-text); background: var(--chip-hover); }
.msg.is-editing .bubble { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Tarjeta de transición de sección */
.section-card {
  margin: 18px 0 6px; padding: 18px 20px; border-radius: var(--radius-card);
  display: flex; gap: 16px; align-items: center;
}
.section-card .num {
  font-family: var(--font-brand); font-size: 2rem; line-height: 1; min-width: 2ch; text-align: center;
  color: var(--itech-white);
}
.section-card .eyebrow { color: rgba(255, 255, 255, .8); font-size: .64rem; }
.section-card .title { font-family: var(--font-brand); font-size: 1.2rem; line-height: 1.2; }

.section-card.brand-surface::after { width: 320px; height: 320px; right: -120px; top: -160px; }
.section-card.brand-surface::before { background-size: 28px 28px; background-position: 14px 14px; }

/* Indicador «escribiendo…» con el nodo pulsante */
.typing { display: inline-flex; gap: 6px; align-items: center; padding: 14px 18px; }
.node { width: 8px; height: 8px; border-radius: 50%; background: var(--itech-gradient); animation: node-pulse 1.2s var(--ease-out) infinite; }
.node:nth-child(2) { animation-delay: .16s; }
.node:nth-child(3) { animation-delay: .32s; }
@keyframes node-pulse {
  0%, 80%, 100% { transform: scale(.6); opacity: .45; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* Entrada de mensajes */
.enter { animation: msg-in var(--dur-med) var(--ease-out) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   4. Dock de respuesta (componentes de entrada)
   ========================================================================== */
.dock {
  position: sticky; bottom: 0; z-index: 15;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.dock-card {
  max-width: 760px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 16px; display: grid; gap: 14px;
  max-height: min(62vh, 560px); overflow: auto;
}
.dock-banner { font-size: .85rem; color: var(--accent-text); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.field { display: grid; gap: 8px; }
.field-label { font-size: .9rem; font-weight: 600; }
.field-label .opt { font-weight: 400; color: var(--text-muted); }
.field-hint { font-size: .82rem; color: var(--text-muted); margin-top: -4px; }
.field-error { font-size: .85rem; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }

.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius-input);
  background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: .8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2353037B' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F5F2F8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.row-2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }

/* Chips (respuestas rápidas) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 16px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--chip-border);
  background: var(--chip-bg); color: var(--chip-text); font-weight: 500; font-size: .95rem; text-align: left;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.chip:hover { background: var(--chip-hover); transform: translateY(-1px); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  background: var(--itech-gradient); color: var(--itech-white); border-color: transparent;
}
.chip .check { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid currentColor; display: grid; place-items: center; flex: none; }
.chip[aria-checked="true"] .check { background: var(--itech-white); border-color: var(--itech-white); color: var(--itech-purple); }
.chip .check svg { width: 12px; height: 12px; opacity: 0; }
.chip[aria-checked="true"] .check svg { opacity: 1; }

/* Carga de archivos */
.dropzone {
  border: 1.5px dashed var(--chip-border); border-radius: var(--radius-input); padding: 16px;
  display: flex; align-items: center; gap: 12px; background: var(--surface-soft); color: var(--text);
  cursor: pointer; transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--focus); }
.dropzone:focus-within { border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-ring); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone .dz-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--itech-gradient); color: #fff; display: grid; place-items: center; flex: none; }
.dropzone small { color: var(--text-muted); display: block; }
.file-list { display: grid; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: var(--radius-input); background: var(--card); font-size: .92rem; }
.file-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .state { color: var(--text-muted); font-size: .82rem; }

/* Tablas editables (usuarios, planes) */
.rows { display: grid; gap: 10px; }
.row-card { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--card); position: relative; }
.row-card .row-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row-card .row-grid { grid-template-columns: 1fr 1fr 1.4fr; } }
.row-card .row-head { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--text-muted); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.row-card .input, .row-card .select { min-height: 44px; }

/* Cuadrícula (ZAK / ERP) */
.grid-table { display: grid; gap: 8px; }
.grid-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; border-radius: 14px; background: var(--card); }
.grid-row .label { font-weight: 600; font-size: .95rem; }

/* Acciones del dock: la última fila queda fija al pie del panel aunque el formulario sea largo. */
.dock-card > .dock-actions:last-child {
  position: sticky; bottom: -16px; z-index: 1; background: var(--surface);
  margin: 0 -16px -16px; padding: 10px 16px 16px; border-top: 1px solid var(--border);
}
@media (max-width: 480px) {
  .dock-card > .dock-actions:last-child, .dock-card > .dock-actions:last-child .left { flex-wrap: nowrap; }
  .dock-actions .left .btn-text { padding: 8px 6px; font-size: .88rem; }
  .dock-actions .left .btn-text .lbl-long { display: none; }
  .dock-actions .right .btn { padding: 0 16px; }
}
.dock-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.dock-actions .left, .dock-actions .right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kbd-hint { font-size: .78rem; color: var(--text-muted); display: none; }
@media (min-width: 768px) { .kbd-hint { display: inline; } }

/* ==========================================================================
   5. Panel «Mis respuestas» (cajón / hoja inferior)
   ========================================================================== */
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 40; animation: fade-in var(--dur-fast) both; }
.drawer {
  position: fixed; z-index: 41; background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; box-shadow: var(--shadow);
  left: 0; right: 0; bottom: 0; max-height: 86vh; border-radius: 24px 24px 0 0;
  animation: sheet-in var(--dur-med) var(--ease-out) both;
}
@media (min-width: 900px) {
  .drawer { left: auto; top: 0; bottom: 0; width: 420px; max-height: none; border-radius: 24px 0 0 24px; animation-name: drawer-in; }
}
.drawer-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.drawer-body { overflow: auto; padding: 12px 12px 24px; }
.drawer-section { margin-top: 10px; }
.drawer-section h3 { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--text-muted); margin: 12px 8px 6px; font-weight: 600; }
.drawer-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  background: none; border: 0; padding: 10px 8px; border-radius: 12px; color: var(--text);
}
.drawer-item:hover { background: var(--chip-hover); }
.drawer-item:disabled { opacity: .45; cursor: default; background: none; }
.drawer-item .qid { font-size: .78rem; color: var(--text-muted); font-weight: 600; min-width: 2.8em; padding-top: 2px; }
.drawer-item .qtext { font-size: .92rem; flex: 1; }
.dot-state { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; border: 1.5px solid var(--border-strong); }
.dot-state.done { background: var(--itech-gradient); border-color: transparent; }
.dot-state.current { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes drawer-in { from { transform: translateX(100%); } }

/* ==========================================================================
   6. Resumen
   ========================================================================== */
.summary { max-width: 900px; margin: 0 auto; padding: 32px 16px 140px; }
.summary-head { display: grid; gap: 10px; margin-bottom: 24px; }
.summary-head .eyebrow { color: var(--accent-text); }
.summary-head p { margin: 0; color: var(--text-muted); max-width: 40em; }
.summary-grid { display: grid; gap: 16px; }
.s-card { background: var(--card); border-radius: var(--radius-card); padding: 20px; animation: msg-in var(--dur-med) var(--ease-out) both; }
.s-card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.s-card-head .num {
  font-family: var(--font-brand); width: 36px; height: 36px; border-radius: 12px; flex: none;
  background: var(--itech-gradient); color: #fff; display: grid; place-items: center; font-size: 1rem;
}
.s-card-head h2 { font-family: var(--font-brand); font-weight: 400; font-size: 1.2rem; margin: 0; line-height: 1.25; }
.s-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.s-item .q { font-size: .88rem; color: var(--text-muted); }
.s-item .a { grid-column: 1 / 2; font-size: .96rem; white-space: pre-line; overflow-wrap: anywhere; }
.s-item .edit-link { grid-column: 2; grid-row: 1 / 3; align-self: start; }
.s-item .a .k { color: var(--text-muted); }
.s-item.pending .a { color: var(--danger); }
.summary-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: var(--header-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.summary-bar-inner { max-width: 900px; margin: 0 auto; display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.demo-badge { font-size: .78rem; font-weight: 600; color: var(--accent-text); background: var(--card); border-radius: var(--radius-pill); padding: 6px 12px; }

/* Modal de edición */
.modal {
  position: fixed; z-index: 41; inset: 0; margin: auto; height: fit-content; /* centrado sin transform (la animación lo usa) */
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 20px; display: grid; gap: 16px; animation: msg-in var(--dur-med) var(--ease-out) both;
}
.modal .q-title { font-family: var(--font-brand); font-size: 1.15rem; line-height: 1.3; margin: 0; }

/* Estado de envío / error */
.status-card {
  display: grid; gap: 12px; padding: 20px; border-radius: var(--radius-card);
  background: var(--card); margin-top: 16px;
}
.status-card.error { background: var(--danger-bg); }
.status-card.error strong { color: var(--danger); }
.status-card p { margin: 0; }

/* ==========================================================================
   7. Éxito
   ========================================================================== */
.success { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 28px 16px; }
@media (min-width: 768px) { .success { padding: 40px 56px; } }
.success-main h1:focus { outline: none; }
.success-main { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; gap: 18px; max-width: 680px; margin: 0 auto; padding: 32px 0; }
.success-mark { width: 112px; height: 112px; border-radius: 30px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .25); animation: mark-in 900ms var(--ease-out) both; }
.success-mark img { width: 58px; animation: mark-float 4s ease-in-out 900ms infinite; }
@keyframes mark-in { from { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.04); } to { transform: none; } }
@keyframes mark-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.ref-box { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28); border-radius: 16px; padding: 12px 20px; display: grid; gap: 2px; }
.ref-box .eyebrow { font-size: .62rem; color: rgba(255, 255, 255, .8); }
.ref-box .ref { font-family: var(--font-brand); font-size: 1.6rem; letter-spacing: .04em; }
.next-steps { text-align: left; background: var(--itech-white); color: var(--itech-carbon); border-radius: var(--radius-card); padding: 20px 22px; width: 100%; }
.next-steps h2 { font-family: var(--font-brand); font-weight: 400; font-size: 1.2rem; margin: 0 0 12px; color: var(--itech-purple); }
.next-steps ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: s; }
.next-steps li { display: flex; gap: 12px; counter-increment: s; }
.next-steps li::before {
  content: counter(s); flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--itech-gradient); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .85rem;
}
.success .welcome-top .logo { width: 132px; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .node { animation: none; opacity: .8; }
}

/* ==========================================================================
   8. Presentación audiovisual (primer mensaje del chat)
   ========================================================================== */
.msg-media { padding-right: 0; }
.bubble-media { padding: 8px; width: 100%; max-width: 640px; }
.intro-video { display: grid; gap: 8px; }
.iv-frame { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--itech-purple); }
.iv-video { width: 100%; height: 100%; display: block; object-fit: cover; background: #000; }
.iv-stage { position: absolute; inset: 0; }
.iv-stage::after { width: 70%; height: 140%; right: -30%; top: -60%; }
.iv-stage::before { background-size: 26px 26px; background-position: 13px 13px; }
.iv-scene {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(6px, 2vw, 14px); padding: 6%; text-align: center; opacity: 0; visibility: hidden;
  transition: opacity 420ms var(--ease-out), visibility 0s linear 420ms;
}
.iv-scene.is-on { opacity: 1; visibility: visible; transition: opacity 420ms var(--ease-out); }
.intro-video.is-paused .iv-scene * { animation-play-state: paused !important; }

/* Animaciones de entrada: solo corren en la escena activa. */
.iv-scene.is-on .iv-title, .iv-scene.is-on .iv-sub, .iv-scene.is-on .iv-tag,
.iv-scene.is-on .iv-zak span, .iv-scene.is-on .iv-acro span, .iv-scene.is-on .iv-stat,
.iv-scene.is-on .iv-tile, .iv-scene.is-on .iv-step, .iv-scene.is-on .iv-cmd, .iv-scene.is-on .iv-note {
  animation: iv-up 700ms var(--ease-out) both;
}
.iv-scene.is-on .iv-sub { animation-delay: 1500ms; }
.iv-scene.is-on .iv-tag { animation-delay: 900ms; }
.iv-scene.is-on .iv-note { animation-delay: 2600ms; }
@keyframes iv-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.iv-iso { position: relative; width: clamp(64px, 16vw, 110px); aspect-ratio: 1; display: grid; place-items: center; }
.iv-iso img { width: 62%; position: relative; }
.iv-scene.is-on .iv-iso img { animation: iv-pop 900ms var(--ease-out) both; }
.iv-ring { position: absolute; inset: 0; border-radius: 30%; border: 1.5px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .1); }
.iv-scene.is-on .iv-ring { animation: iv-pop 700ms var(--ease-out) both, iv-pulse 2.4s ease-in-out 900ms infinite; }
.iv-iso-sm { width: clamp(44px, 10vw, 64px); }
@keyframes iv-pop { from { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.05); } to { transform: none; } }
@keyframes iv-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); } 50% { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); } }

.iv-title { font-family: var(--font-brand); font-size: clamp(1.25rem, 4.2vw, 2.3rem); line-height: 1.1; }
.iv-title.iv-small { font-size: clamp(1rem, 3vw, 1.5rem); opacity: .95; }
.iv-sub { font-size: clamp(.72rem, 1.8vw, .95rem); opacity: .9; }
.iv-tag { font-family: var(--font-brand); font-size: clamp(.8rem, 2vw, 1rem); opacity: .85; }
.iv-zak { font-family: var(--font-brand); font-size: clamp(3rem, 14vw, 7rem); line-height: .9; letter-spacing: .04em; display: flex; }
.iv-zak span { display: inline-block; }
.iv-acro { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .45em; font-size: clamp(.8rem, 2.4vw, 1.2rem); letter-spacing: .06em; }
.iv-acro span { display: inline-block; opacity: .92; }
.iv-acro b { font-weight: 700; color: var(--itech-white); }

.iv-stats { display: flex; gap: clamp(14px, 5vw, 48px); }
.iv-stat { display: grid; justify-items: center; }
.iv-num { font-family: var(--font-brand); font-size: clamp(2.4rem, 10vw, 4.6rem); line-height: 1; }
.iv-lbl { font-size: clamp(.7rem, 1.8vw, .9rem); letter-spacing: .22em; text-transform: uppercase; opacity: .85; }

.iv-cmd {
  display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .95); color: var(--itech-carbon);
  border-radius: var(--radius-pill); padding: 8px 16px 8px 8px; font-size: clamp(.78rem, 2.2vw, 1.05rem); max-width: 92%;
}
.iv-mic { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--itech-gradient); color: #fff; flex: none; }
.iv-caret { width: 2px; height: 1.1em; background: var(--itech-purple); animation: iv-blink 1s steps(1) infinite; }
@keyframes iv-blink { 50% { opacity: 0; } }
.iv-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 560px; }
.iv-tile { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); border-radius: 12px; padding: 8px; display: grid; gap: 2px; text-align: left; }
.iv-tile span { font-size: clamp(.55rem, 1.5vw, .72rem); opacity: .85; }
.iv-tile b { font-family: var(--font-brand); font-weight: 400; font-size: clamp(.85rem, 2.6vw, 1.3rem); }
.iv-note { font-size: .62rem; opacity: .7; letter-spacing: .12em; text-transform: uppercase; }
.iv-cycle { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.iv-step { padding: 6px 14px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .95); color: var(--itech-purple); font-weight: 600; font-size: clamp(.75rem, 2.2vw, 1rem); }

.iv-bigplay {
  position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; z-index: 2;
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border: 0;
  border-radius: var(--radius-pill); background: rgba(255, 255, 255, .96); color: var(--itech-purple); font-weight: 600;
  box-shadow: 0 10px 30px rgba(28, 28, 28, .25); transition: transform var(--dur-fast) var(--ease-out);
}
.iv-bigplay > span:first-child { width: 40px; height: 40px; border-radius: 50%; background: var(--itech-gradient); color: #fff; display: grid; place-items: center; }
.iv-bigplay:hover { transform: scale(1.04); }
.intro-video.is-playing .iv-bigplay, .intro-video.is-paused .iv-bigplay { display: none; }
.intro-video.is-ended .iv-frame::after { content: ''; position: absolute; inset: 0; background: rgba(28, 28, 28, .28); z-index: 1; }

.iv-bar { display: flex; align-items: center; gap: 6px; }
.iv-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--accent-text); display: grid; place-items: center; }
.iv-btn:hover:not(:disabled) { background: var(--chip-hover); }
.iv-btn:disabled { opacity: .4; cursor: not-allowed; }
.iv-progress { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.iv-seg { height: 4px; border-radius: var(--radius-pill); background: var(--border-strong); overflow: hidden; }
.iv-seg i { display: block; height: 100%; width: 0; background: var(--itech-gradient); }
.iv-seg.done i { width: 100%; }
.intro-video.is-playing .iv-seg.on i { width: 100%; transition: width 4.2s linear; }
.iv-caption { margin: 0 4px 4px; font-size: .95rem; color: var(--text); min-height: 2.9em; }

/* ==========================================================================
   9. Selector de módulos
   ========================================================================== */
.mod-picker { display: grid; gap: 14px; }
.mod-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mod-count { font-size: .88rem; font-weight: 600; color: var(--accent-text); }
.mod-group { display: grid; gap: 8px; }
.mod-group-head { display: flex; justify-content: space-between; align-items: center; }
.mod-group-head .eyebrow { font-size: .66rem; color: var(--text-muted); letter-spacing: .2em; }
.btn-xs { min-height: 32px; padding: 4px 8px; font-size: .82rem; }
.mod-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .mod-grid { grid-template-columns: 1fr 1fr; } }
.mod-card {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 16px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color var(--dur-fast), background-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.mod-card:hover { border-color: var(--chip-border); transform: translateY(-1px); }
.mod-card[aria-checked="true"] { border-color: var(--focus); background: var(--surface-soft); }
.mod-ico { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--card); color: var(--accent-text); }
.mod-card[aria-checked="true"] .mod-ico { background: var(--itech-gradient); color: #fff; }
.mod-txt { display: grid; gap: 2px; flex: 1; min-width: 0; }
.mod-name { font-weight: 600; font-size: .93rem; line-height: 1.25; }
.mod-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.35; }
.mod-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; color: transparent; }
.mod-check .icon { width: 14px; height: 14px; }
.mod-card[aria-checked="true"] .mod-check { background: var(--itech-gradient); border-color: transparent; color: #fff; }

/* Checklist (cuadrícula apilada: requisito arriba, estados abajo) */
.grid-bulk { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid-table.is-stacked .grid-row { display: grid; gap: 8px; }
.grid-table.is-stacked .grid-row .label { font-weight: 500; }
.grid-row.is-answered { outline: 1.5px solid var(--chip-border); outline-offset: -1.5px; }
.grid-table .chip { min-height: 38px; padding: 6px 14px; font-size: .88rem; }

/* ==========================================================================
   10. Diagnóstico de preparación
   ========================================================================== */
.ready-card { background: var(--surface); color: var(--text); border-radius: 16px; padding: 16px; display: grid; gap: 14px; margin: 8px 0; border: 1px solid var(--border); }
.ready-head { display: flex; gap: 16px; align-items: center; }
.ready-head p { margin: 2px 0 0; color: var(--text-muted); font-size: .9rem; }
.ready-head .eyebrow { font-size: .62rem; color: var(--text-muted); letter-spacing: .2em; }
.ready-level { font-family: var(--font-brand); font-weight: 400; font-size: 1.25rem; margin: 2px 0 0; color: var(--accent-text); }
.ready-ring {
  --p: 0; width: 96px; height: 96px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--itech-purple) 0%, var(--itech-magenta) calc(var(--p) * 1%), var(--border) 0);
}
.ready-ring::before { content: ''; grid-area: 1 / 1; width: 76px; height: 76px; border-radius: 50%; background: var(--surface); }
.ready-pct { grid-area: 1 / 1; position: relative; font-family: var(--font-brand); font-size: 1.7rem; line-height: 1; color: var(--text); }
.ready-pct small { font-size: .9rem; margin-left: 1px; }
.ready-mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ready-mods li { display: grid; grid-template-columns: minmax(0, 1fr) 90px 52px; gap: 10px; align-items: center; font-size: .86rem; }
.ready-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ready-bar { height: 8px; border-radius: var(--radius-pill); background: var(--border); overflow: hidden; }
.ready-bar i { display: block; height: 100%; background: var(--itech-gradient); border-radius: inherit; }
.ready-val { white-space: nowrap; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.ready-missing summary { cursor: pointer; font-weight: 600; color: var(--accent-text); padding: 4px 0; }
.ready-miss-mod { margin-top: 10px; font-size: .88rem; }
.ready-miss-mod ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.ready-state { margin-left: 8px; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.st-no { background: var(--danger-bg); color: var(--danger); }
.st-proc { background: var(--card); color: var(--accent-text); border: 1px solid var(--chip-border); }
.ready-ok { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--accent-text); font-weight: 600; }
.s-ready { padding: 8px; }
.s-ready .ready-card { margin: 0; border: 0; }
.bubble p { white-space: pre-line; }
