:root {
  --bg: #08080c;
  --bg2: #0d0d14;
  --panel: #11111b;
  --panel2: #15151f;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .12);
  --ink: #ECEAF4;
  --ink2: #c3c0d4;
  --mut: #8d8aa3;
  --mut2: #605d75;
  --violet: #6C5CE7;
  --violet-d: #534AB7;
  --violet-l: rgba(108, 92, 231, .15);
  --acid: #C6F24E;
  --acid-d: #9bcc2e;
  --rose: #FF6B8B;
  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Hanken Grotesk', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(108, 92, 231, .14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(198, 242, 78, .06), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; max-width: 1040px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 9px;
}
.beta {
  font-family: var(--font-mono); font-size: .58rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--acid); background: rgba(198, 242, 78, .1); border: 1px solid rgba(198, 242, 78, .25);
  padding: 2px 7px; border-radius: 999px; transform: translateY(-1px);
}
.by { font-family: var(--font-mono); font-size: .72rem; color: var(--mut); letter-spacing: .04em; }

/* Layout */
.wrap {
  max-width: 1040px; margin: 10px auto 60px; padding: 0 24px;
  display: grid; grid-template-columns: 240px 1fr; gap: 26px; align-items: start;
}

/* Rail */
.rail { position: sticky; top: 20px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--mut); cursor: pointer; transition: .15s; font-size: .92rem;
}
.step:hover { background: var(--panel); color: var(--ink2); }
.step .dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .76rem; border: 1px solid var(--line2); flex: none;
}
.step.active { color: var(--ink); background: var(--panel); }
.step.active .dot { background: var(--violet); border-color: var(--violet); color: #fff; }
.step.ok .dot { background: rgba(198,242,78,.15); border-color: var(--acid); color: var(--acid); }
.rail-foot { margin-top: 18px; padding: 0 12px; font-size: .78rem; color: var(--mut2); line-height: 1.5; }

/* Card */
.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: 20px; padding: 34px 36px 22px;
  box-shadow: 0 30px 80px -40px rgba(0,0,0,.8);
  min-height: 460px; display: flex; flex-direction: column;
}
.panel { display: none; animation: fade .25s ease; flex: 1; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 6px; }
.sub { color: var(--mut); margin: 0 0 24px; line-height: 1.55; max-width: 48ch; }

/* Fields */
.field { margin-bottom: 18px; }
label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 7px; color: var(--ink2); }
.hint { font-weight: 400; color: var(--mut2); font-size: .8rem; }
input[type=text], textarea, select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 11px;
  color: var(--ink); font-family: var(--font-body); font-size: .96rem; padding: 12px 14px; transition: .15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-l); }
input.invalid, textarea.invalid { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(255, 107, 139, .18); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238d8aa3' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* Preguntas */
.qlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.qrow { display: flex; gap: 8px; align-items: center; }
.qrow input { flex: 1; }
.qrow .del { background: none; border: none; color: var(--mut2); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.qrow .del:hover { color: var(--rose); background: rgba(255,107,139,.08); }

/* Connect */
.connect {
  display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 12px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 13px;
}
.connect.stacked { flex-direction: column; align-items: stretch; gap: 14px; }
.c-row { display: flex; align-items: center; gap: 14px; }
.c-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--violet-l); color: var(--violet); flex: none; }
.c-body { flex: 1; }
.c-title { font-weight: 600; font-size: .98rem; }
.c-desc { color: var(--mut); font-size: .83rem; margin-top: 2px; line-height: 1.4; }
.btn-conn {
  background: transparent; color: var(--ink); border: 1px solid var(--line2); border-radius: 10px;
  padding: 9px 16px; font-family: var(--font-body); font-weight: 600; font-size: .86rem; cursor: pointer; transition: .15s; flex: none;
}
.btn-conn:hover { border-color: var(--violet); color: #fff; }
.connect.connected { border-color: rgba(198,242,78,.4); }
.connect.connected .c-ico { background: rgba(198,242,78,.12); color: var(--acid); }
.btn-conn.ok { background: rgba(198,242,78,.12); border-color: rgba(198,242,78,.4); color: var(--acid); cursor: default; }
.concierge-note { margin: -4px 4px 14px; font-size: .8rem; color: var(--mut); line-height: 1.5; display: none; }
.concierge-note.show { display: block; }
.concierge-note b { color: var(--ink2); }
.c-choice { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.opt { display: flex; align-items: center; gap: 10px; font-weight: 400; color: var(--ink2); cursor: pointer; font-size: .92rem; }
.opt em { color: var(--acid); font-style: normal; font-size: .8rem; }
.opt input { accent-color: var(--violet); width: 16px; height: 16px; }

/* Toggles */
.toggle-row { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: none; }
.t-title { font-weight: 600; }
.t-desc { color: var(--mut); font-size: .85rem; margin-top: 3px; line-height: 1.45; }
.switch { position: relative; flex: none; width: 46px; height: 27px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.track { position: absolute; inset: 0; background: var(--bg2); border: 1px solid var(--line2); border-radius: 999px; transition: .2s; }
.track::before { content: ""; position: absolute; width: 19px; height: 19px; left: 3px; top: 3px; border-radius: 50%; background: var(--mut); transition: .2s; }
.switch input:checked + .track { background: var(--violet); border-color: var(--violet); }
.switch input:checked + .track::before { transform: translateX(19px); background: #fff; }
.sub-field { margin-top: 14px; max-width: 320px; }
.sub-field { display: none; }
.sub-field.show { display: block; }

/* Resumen */
.resumen { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin-bottom: 18px; }
.r-item { display: flex; justify-content: space-between; gap: 16px; padding: 13px 16px; background: var(--bg2); font-size: .9rem; }
.r-item .k { color: var(--mut); }
.r-item .v { color: var(--ink); text-align: right; font-weight: 500; }
.r-item .v .tag { font-family: var(--font-mono); font-size: .72rem; color: var(--acid); }
.cfg { margin-top: 4px; }
.cfg summary { cursor: pointer; color: var(--mut); font-size: .84rem; font-family: var(--font-mono); }
.cfg pre { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 16px; overflow: auto; font-family: var(--font-mono); font-size: .76rem; color: var(--ink2); line-height: 1.5; }

/* Done */
.panel.done { text-align: center; padding-top: 30px; }
.done-mark { width: 74px; height: 74px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(198,242,78,.1); border: 1px solid rgba(198,242,78,.3); }
.panel.done .sub { margin: 0 auto 22px; }
.panel.done .ver-panel { display: inline-block; text-decoration: none; background: var(--violet); color: #fff; border-radius: 11px; padding: 12px 26px; font-weight: 700; font-size: .92rem; margin: 0 0 14px; }
.panel.done .ver-panel:hover { background: var(--violet-d); }
.panel.done #restart { display: block; margin: 0 auto; }

/* Nav */
.nav { display: flex; align-items: center; gap: 16px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.progress { flex: 1; height: 4px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 20%; background: linear-gradient(90deg, var(--violet), var(--acid)); transition: width .3s; }
button.primary {
  background: var(--violet); color: #fff; border: none; border-radius: 11px; padding: 12px 26px;
  font-family: var(--font-body); font-weight: 700; font-size: .92rem; cursor: pointer; transition: .15s;
}
button.primary:hover { background: var(--violet-d); }
button.ghost {
  background: transparent; color: var(--ink2); border: 1px solid var(--line2); border-radius: 11px;
  padding: 11px 20px; font-family: var(--font-body); font-weight: 600; font-size: .9rem; cursor: pointer; transition: .15s;
}
button.ghost:hover { border-color: var(--violet); color: #fff; }
button.ghost:disabled { opacity: .35; cursor: not-allowed; }
#addPregunta { margin-top: 2px; }

/* Catálogo + precios */
.catalogo { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.prod-row { display: flex; gap: 8px; align-items: center; }
.prod-row input { flex: 1; }
.prod-row input.precio { flex: 0 0 150px; }
.prod-row .del { background: none; border: none; color: var(--mut2); cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.prod-row .del:hover { color: var(--rose); background: rgba(255, 107, 139, .08); }
.field-note { margin: 8px 0 0; font-size: .8rem; color: var(--mut2); }

/* Proveedor de CRM al conectar */
#crmConectar { max-width: 360px; }

/* Límites del human-in-the-loop */
#hitlChannel { max-width: 460px; }
.hitl-conecta { margin-top: 12px; }
.hitl-conecta .btn-conn { margin-bottom: 2px; }
.limits-label { font-size: .86rem; font-weight: 600; color: var(--ink2); margin-bottom: 10px; }
.limits { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.chk { display: flex; align-items: flex-start; gap: 10px; font-size: .9rem; color: var(--ink2); cursor: pointer; line-height: 1.4; }
.chk input { accent-color: var(--acid); width: 17px; height: 17px; margin-top: 1px; flex: none; }
.fixed-note { font-size: .8rem; color: var(--mut); line-height: 1.5; margin: 0 0 16px; padding: 10px 12px; background: var(--bg2); border-radius: 10px; border: 1px solid var(--line); }

/* Responsive */
@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; gap: 14px; }
  .rail { position: static; }
  .steps { flex-direction: row; overflow-x: auto; gap: 2px; }
  .step .lbl { display: none; }
  .step { padding: 8px; }
  .rail-foot { display: none; }
  .card { padding: 26px 20px 18px; border-radius: 16px; }
  h1 { font-size: 1.35rem; }
}
