/* ==========================================================================
   Showabit · Presentation Tool — interfaz (línea visual Flyabit)
   ========================================================================== */

/* Tipografía corporativa M20: el servidor de flyabit.es no permite cargarla desde otro dominio (CORS).
   Para usarla, copiar M20_SP-RANKER.woff2 en assets/fonts/ y descomentar:
@font-face { font-family: 'M20'; src: url('../assets/fonts/M20_SP-RANKER.woff2') format('woff2'); font-display: swap; }
*/

:root {
  --black: #0F0F10;
  --bg: #161618;
  --panel: #1E1F22;
  --panel-2: #26272B;
  --panel-3: #2E3034;
  --charcoal: #2A2B2D;
  --line: rgba(255,255,255,.08);
  --line-2: rgba(255,255,255,.14);
  --text: #ECECEC;
  --muted: #9A9CA1;
  --dim: #6C6F75;
  --lime: #D8DA00;
  --lime-2: #C8D800;
  --purple: #714997;
  --purple-2: #8A5DB5;
  --pink: #CC3366;
  --rose: #ECB3D3;
  --cyan: #6EC1E4;
  --red: #E52320;
  --green: #43AB34;
  --display: 'M20', 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --ui: 'Poppins', system-ui, sans-serif;
  --r: 12px;
  --top: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }

.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .01em; line-height: .95; color: var(--lime); margin: 0; }
.display.sm { font-size: 30px; }
.eyebrow-ui { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); }
.eyebrow-ui.ok { color: var(--lime); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* ---------- Botones ---------- */
.btn-primary, .btn-ghost, .btn-dashed {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; font-weight: 700; border: 0; transition: transform .15s, background .2s, box-shadow .2s, opacity .2s;
  white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--lime); color: #151515; padding: 12px 22px; }
.btn-primary:hover:not(:disabled) { background: #E6E83A; box-shadow: 0 6px 24px rgba(216,218,0,.25); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }
.btn-ghost { background: var(--panel-3); color: var(--text); padding: 12px 20px; border: 1px solid var(--line-2); }
.btn-ghost:hover { background: #393B40; }
.btn-dashed { width: 100%; padding: 11px; background: transparent; border: 1.5px dashed var(--line-2); color: var(--muted); border-radius: 10px; font-weight: 600; }
.btn-dashed:hover { border-color: var(--lime); color: var(--lime); }
.sm { padding: 8px 15px; font-size: 13px; }
.lg { padding: 16px 30px; font-size: 16px; }
.btn-primary svg, .btn-ghost svg, .btn-dashed svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link { background: none; border: 0; padding: 0; color: var(--cyan); font-size: 12.5px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; background: transparent; border: 0; color: var(--muted); }
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn:disabled { opacity: .25; cursor: default; background: none; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Campos ---------- */
.input, .textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border .15s, box-shadow .15s; font-size: 13.5px;
}
.input.lg { padding: 14px 16px; font-size: 15px; }
.textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.input:focus, .textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216,218,0,.15); }
.lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.lbl:first-child { margin-top: 0; }

/* ==========================================================================
   Barra superior
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  padding: 0 20px; background: var(--black); border-bottom: 1px solid var(--line);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; }
.tb-right { justify-content: flex-end; }
.fly-logo { display: flex; align-items: center; }
.fly-logo img { height: 27px; display: block; }
.fly-word { font-family: var(--ui); font-weight: 700; font-size: 22px; letter-spacing: -.02em; color: #fff; }
.tb-sep { width: 1px; height: 24px; background: var(--line-2); }
.tb-product { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 19px; letter-spacing: .02em; color: #fff; }
.tb-product em { font-style: normal; color: var(--lime); }
.btn-contacta { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 7px 14px; border-radius: 99px;
  background: #fff; color: var(--purple); text-decoration: none; white-space: nowrap; transition: background .2s, transform .15s; }
.btn-contacta:hover { background: var(--purple); color: #fff; transform: translateY(-1px); }

.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; color: var(--dim); font-weight: 600; font-size: 13px; }
.stepper li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); font-size: 12px; }
.stepper li + li::before { content: ""; width: 22px; height: 1px; background: var(--line-2); margin: 0 6px 0 -14px; }
.stepper li.is-done { color: var(--muted); }
.stepper li.is-done span { background: var(--purple); color: #fff; }
.stepper li.is-current { color: #fff; background: var(--panel-2); }
.stepper li.is-current span { background: var(--lime); color: #151515; }
#btnHelp svg, .tb-right .btn-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================================================
   Paso 1 · Marca
   ========================================================================== */
.screen-setup { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); min-height: calc(100vh - var(--top)); }
.setup-hero { position: relative; background: var(--charcoal); overflow: hidden; display: flex; align-items: flex-start; }
.hero-in { position: relative; padding: 64px 56px 220px; max-width: 620px; }
.hero-in h1 { font-size: clamp(46px, 5vw, 80px); margin: 14px 0 22px; }
.hero-in p { font-size: 16px; color: #D5D6D8; max-width: 46ch; margin: 0 0 26px; }
.hero-in p b { color: #fff; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; color: #C9CACD; font-size: 14px; }
.hero-points i { width: 22px; height: 2px; background: var(--c); border-radius: 2px; }

.setup-form { padding: 44px clamp(24px, 4vw, 64px) 48px; max-width: 860px; width: 100%; }
.field-block { margin-bottom: 30px; }
.step-title { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.step-title span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--purple); color: #fff; font-size: 13px; }
.field-block .hint { margin: 0 0 14px 40px; }
.field-block > .input, .field-block > .font-grid { margin-top: 12px; }

.brand-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.brand-card {
  position: relative; text-align: left; padding: 0; border-radius: 14px; overflow: hidden; background: var(--panel);
  border: 1.5px solid var(--line); transition: transform .2s, border-color .2s, box-shadow .2s;
}
.brand-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 14px 36px rgba(0,0,0,.35); }
.brand-card.is-selected { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216,218,0,.18), 0 14px 36px rgba(0,0,0,.35); }
.brand-card .bc-img { position: relative; height: 128px; background-size: cover; background-position: center; }
.brand-card .bc-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, var(--bc) 100%); opacity: .92; }
.brand-card .bc-logo { position: absolute; left: 14px; bottom: 12px; z-index: 1; color: #fff; }
.brand-card .bc-logo .logo { display: flex; align-items: center; gap: 8px; }
.brand-card .bc-logo svg { width: 28px; height: 28px; }
.brand-card .bc-logo b { display: block; font-size: 13px; letter-spacing: .16em; }
.brand-card .bc-logo i { display: block; font-style: normal; font-size: 8px; letter-spacing: .22em; opacity: .85; }
.brand-card .bc-body { padding: 12px 14px 14px; }
.brand-card .bc-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.brand-card .bc-sector { color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand-card .bc-sw { display: flex; gap: 5px; margin-top: 10px; }
.brand-card .bc-sw i { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15); }
.brand-card .bc-check {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 26px; height: 26px; border-radius: 50%;
  background: var(--lime); color: #151515; display: grid; place-items: center; transform: scale(0); transition: transform .2s;
}
.brand-card.is-selected .bc-check { transform: scale(1); }
.bc-check svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.font-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.font-opt { padding: 14px 12px 12px; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); text-align: left; transition: border-color .2s, background .2s; }
.font-opt:hover { border-color: var(--line-2); }
.font-opt.is-selected { border-color: var(--lime); background: var(--panel-2); }
.font-opt .aa { display: block; font-size: 32px; line-height: 1; color: #fff; }
.font-opt .fn { display: block; font-weight: 700; font-size: 13px; margin-top: 10px; }
.font-opt .fd { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.font-opt .rec { display: inline-block; margin-top: 6px; font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); }
.font-grid.compact { grid-template-columns: 1fr 1fr; gap: 8px; }
.font-grid.compact .font-opt { padding: 10px; }
.font-grid.compact .aa { font-size: 24px; }
.font-grid.compact .fd { display: none; }

.setup-cta { display: flex; align-items: center; gap: 18px; padding-top: 8px; border-top: 1px solid var(--line); padding: 24px 0 0; }
.setup-cta .btn-primary svg { width: 20px; height: 20px; }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; margin-bottom: 26px; border-radius: 12px; background: rgba(113,73,151,.22); border: 1px solid rgba(138,93,181,.5); }
.resume b { display: block; font-size: 14px; }
.resume span { color: #CDBDE0; font-size: 12.5px; }

/* ==========================================================================
   Paso 2 · Editor
   ========================================================================== */
.screen-editor { display: grid; grid-template-columns: 290px minmax(0, 1fr) 360px; height: calc(100vh - var(--top)); }
.panel { background: var(--panel); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.panel-left { border-right: 1px solid var(--line); padding: 18px 16px 24px; }
.panel-right { border-left: 1px solid var(--line); }

.doc-card { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel-2); margin-bottom: 16px; }
.doc-thumb { flex: none; width: 74px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: #000 center/cover; position: relative; }
.doc-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--tc, #000) 10%, transparent); opacity: .7; }
.doc-meta { min-width: 0; flex: 1; }
.doc-name { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; margin-left: -6px; font-weight: 700; font-size: 14px; outline: none; text-overflow: ellipsis; }
.doc-name:hover { border-color: var(--line-2); }
.doc-name:focus { border-color: var(--lime); background: var(--panel); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 10px; background: var(--black); margin-bottom: 14px; }
.tab { border: 0; background: none; padding: 8px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; }
.tab.is-active { background: var(--panel-3); color: #fff; }

.section-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.sec-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .2s;
}
.sec-item:hover { background: var(--panel-2); }
.sec-item.is-selected { background: var(--panel-2); border-color: var(--lime); }
.sec-item.is-off .sec-label, .sec-item.is-off .sec-ic { opacity: .4; }
.sec-item.drag-over { border-color: var(--cyan); border-style: dashed; }
.sec-item.dragging { opacity: .4; }
.sec-grip { color: var(--dim); cursor: grab; display: grid; }
.sec-grip svg { width: 14px; height: 14px; fill: currentColor; }
.sec-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-3); color: var(--lime); }
.sec-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sec-label { flex: 1; min-width: 0; }
.sec-label b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-label span { display: block; font-size: 11px; color: var(--dim); }

.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #45474D; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + i { background: var(--lime); }
.switch input:checked + i::after { transform: translateX(14px); background: #151515; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(216,218,0,.3); }

.add-wrap { position: relative; }
.add-menu { margin-top: 8px; padding: 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; gap: 2px; animation: pop .18s ease-out; }
.add-menu button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border: 0; background: none; border-radius: 8px; }
.add-menu button:hover { background: var(--panel-3); }
.add-menu b { display: block; font-size: 13px; font-weight: 600; }
.add-menu span.d { display: block; font-size: 11px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.color input { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 1px solid rgba(255,255,255,.2); border-radius: 6px; }
.logo-row { display: flex; gap: 12px; align-items: center; }
.logo-prev { flex: none; width: 120px; height: 64px; border-radius: 10px; display: grid; place-items: center; padding: 8px; color: #fff; overflow: hidden; }
.logo-prev .logo { display: flex; align-items: center; gap: 6px; }
.logo-prev svg { width: 22px; height: 22px; }
.logo-prev b { display: block; font-size: 10px; letter-spacing: .14em; }
.logo-prev i { display: block; font-size: 6px; font-style: normal; letter-spacing: .18em; opacity: .85; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-actions { display: grid; gap: 8px; justify-items: start; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Lienzo / vista previa ---------- */
.canvas { position: relative; display: flex; flex-direction: column; background: #0B0B0C; min-width: 0; }
.canvas-bar { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.live { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(67,171,52,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(67,171,52,0); } 100% { box-shadow: 0 0 0 0 rgba(67,171,52,0); } }
.zoom { margin-left: auto; display: flex; padding: 3px; border-radius: 8px; background: var(--panel); }
.zoom button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.zoom button.is-active { background: var(--panel-3); color: #fff; }
#preview { flex: 1; width: 100%; border: 0; background: #0B0B0C; }

/* ---------- Inspector (panel derecho) ---------- */
.insp-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.insp-head .sec-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--purple); color: #fff; }
.insp-head .sec-ic svg { width: 19px; height: 19px; }
.insp-title { flex: 1; min-width: 0; }
.insp-title small { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.insp-title b { display: block; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 22px; line-height: 1; color: var(--lime); margin-top: 3px; }
.insp-body { padding: 6px 18px 28px; }
.insp-off { margin: 14px 18px 0; padding: 10px 12px; border-radius: 10px; background: rgba(204,51,102,.14); border: 1px solid rgba(204,51,102,.4); color: #F2B8CB; font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.insp-foot { display: flex; gap: 8px; padding: 14px 18px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.insp-foot .btn-ghost { flex: 1; padding: 9px 12px; font-size: 12.5px; }
.insp-foot .danger:hover { background: rgba(229,35,32,.2); border-color: var(--red); color: #FFB4B2; }
.insp-empty { padding: 40px 26px; text-align: center; color: var(--muted); }
.insp-empty svg { width: 54px; height: 54px; stroke: var(--purple-2); fill: none; stroke-width: 1.4; margin-bottom: 10px; }

.fld { margin-top: 16px; }
.fld .lbl { margin: 0 0 7px; }
.fld-help { font-size: 11.5px; color: var(--dim); margin-top: 5px; }
.fld-help.ok { color: var(--green); }
.fld-help.warn { color: #F0A35E; }

.img-field { display: grid; grid-template-columns: 116px 1fr; gap: 12px; align-items: start; }
.img-thumb { width: 116px; aspect-ratio: 4/3; border-radius: 9px; background: var(--panel-3) center/cover; border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.img-thumb.flash { animation: flash .7s; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--lime); } 100% { box-shadow: 0 0 0 0 transparent; } }
.img-actions { display: grid; gap: 6px; }
.img-actions .btn-ghost { padding: 7px 12px; font-size: 12px; justify-content: flex-start; }
.img-actions .btn-ghost svg { width: 15px; height: 15px; }
.img-url { display: flex; gap: 6px; margin-top: 8px; grid-column: 1 / -1; }
.img-url .input { padding: 7px 10px; font-size: 12px; }
.img-url .btn-primary { padding: 7px 12px; font-size: 12px; }
.img-bank { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-top: 8px; }
.img-bank button { aspect-ratio: 1; border-radius: 6px; border: 1.5px solid transparent; background: center/cover; padding: 0; }
.img-bank button:hover { border-color: var(--lime); }

.item-card { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.item-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-card-head b { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.item-card .fld { margin-top: 10px; }
.item-card .fld:first-of-type { margin-top: 0; }
.item-card .img-field { grid-template-columns: 90px 1fr; }
.item-card .img-thumb { width: 90px; }
.row2 { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.add-item { margin-top: 12px; }
.gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gallery-slot { position: relative; }
.gallery-slot .img-thumb { width: 100%; }
.gallery-slot .slot-actions { position: absolute; inset: auto 6px 6px 6px; display: flex; gap: 4px; }
.gallery-slot .slot-actions .btn-ghost { flex: 1; padding: 5px 6px; font-size: 11px; background: rgba(20,20,22,.85); backdrop-filter: blur(4px); }
.gallery-slot .tag { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(20,20,22,.85); }

.tbl-editor { overflow-x: auto; margin-top: 4px; border-radius: 10px; border: 1px solid var(--line-2); }
.tbl-editor table { border-collapse: collapse; width: 100%; min-width: 100%; }
.tbl-editor td { border: 1px solid var(--line); padding: 0; min-width: 92px; }
.tbl-editor tr:first-child td { background: rgba(113,73,151,.25); }
.tbl-editor tr:first-child input { font-weight: 700; }
.tbl-editor input { width: 100%; background: transparent; border: 0; padding: 8px 9px; font-size: 12.5px; outline: none; }
.tbl-editor input:focus { background: rgba(216,218,0,.08); box-shadow: inset 0 0 0 1.5px var(--lime); }
.tbl-editor td.ctl { min-width: 32px; width: 32px; text-align: center; background: var(--panel); }
.tbl-tools { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tbl-tools .btn-ghost { padding: 7px 12px; font-size: 12px; }
.tbl-tools .btn-ghost svg { width: 15px; height: 15px; }

/* ==========================================================================
   Modal · Generar
   ========================================================================== */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(8,8,9,.72); backdrop-filter: blur(6px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { position: relative; width: min(880px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .25s ease-out; }
.modal-x { position: absolute; top: 12px; right: 14px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel-3); color: var(--text); font-size: 22px; line-height: 1; }
.gen-progress { padding: 56px 40px; text-align: center; }
.gen-progress .display { margin: 22px 0 18px; }
.spinner { display: inline-flex; gap: 6px; height: 46px; align-items: flex-end; }
.spinner i { width: 6px; border-radius: 3px; animation: eq 1s ease-in-out infinite; }
.spinner i:nth-child(1) { background: var(--red); } .spinner i:nth-child(2) { background: var(--rose); animation-delay: .1s; }
.spinner i:nth-child(3) { background: var(--lime); animation-delay: .2s; } .spinner i:nth-child(4) { background: var(--cyan); animation-delay: .3s; }
.spinner i:nth-child(5) { background: var(--purple-2); animation-delay: .4s; } .spinner i:nth-child(6) { background: var(--green); animation-delay: .5s; }
@keyframes eq { 0%, 100% { height: 10px; } 50% { height: 46px; } }
.gen-steps { list-style: none; padding: 0; margin: 0 auto; display: inline-grid; gap: 8px; text-align: left; }
.gen-steps li { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13.5px; transition: color .3s; }
.gen-steps li::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--dim); transition: all .3s; }
.gen-steps li.done { color: var(--text); }
.gen-steps li.done::before { border-color: var(--lime); background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12 4 4 8-8' fill='none' stroke='%23151515' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/11px no-repeat; }

.gen-done { display: grid; grid-template-columns: 1.05fr 1fr; gap: 30px; padding: 34px; align-items: center; }
.gen-thumb { position: relative; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.45); transform: rotate(-1.5deg); }
.gen-thumb .stack { position: absolute; inset: 0; }
.gen-info .display { font-size: 34px; margin: 8px 0 4px; }
.gen-actions { display: grid; gap: 10px; margin: 20px 0 10px; }
.gen-actions button { justify-content: flex-start; padding: 13px 20px; }
.pdf-hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.gen-cta { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-radius: 14px; background: var(--purple); }
.gen-cta b { display: block; font-size: 15px; }
.gen-cta span { font-size: 13px; color: #E6DAF2; }

/* ==========================================================================
   Asistente guía
   ========================================================================== */
.guide {
  position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 330px; border-radius: 16px; overflow: hidden;
  background: #fff; color: #1E1F22; box-shadow: 0 20px 60px rgba(0,0,0,.45); animation: pop .3s ease-out;
}
.guide-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--purple); color: #fff; }
.guide-head b { display: block; font-size: 13.5px; }
.guide-head span { display: block; font-size: 11.5px; opacity: .8; }
.guide-head > div { flex: 1; }
.guide-min { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 18px; line-height: 1; }
.guide-ava { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--black); display: flex; align-items: center; justify-content: center; gap: 3px; }
.guide-ava i { width: 3px; border-radius: 2px; animation: eq 1.2s ease-in-out infinite; }
.guide-ava i:nth-child(1) { background: var(--lime); height: 10px; } .guide-ava i:nth-child(2) { background: var(--cyan); animation-delay: .2s; } .guide-ava i:nth-child(3) { background: var(--rose); animation-delay: .4s; }
.guide-ava i { animation-name: eqs; }
@keyframes eqs { 0%, 100% { height: 6px; } 50% { height: 16px; } }
.guide-body { padding: 14px 16px 14px; }
.guide-msg { margin: 0; font-size: 13.5px; line-height: 1.55; min-height: 42px; }
.guide-msg b { color: var(--purple); }
.guide-msg.in { animation: msgIn .35s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } }
.guide-bar { height: 4px; border-radius: 4px; background: #ECECEC; margin: 14px 0 10px; overflow: hidden; }
.guide-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple), var(--pink)); transition: width .5s; }
.guide-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.guide-tasks li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #6B6E73; }
.guide-tasks li::before { content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #C5C7CB; }
.guide-tasks li.is-next { color: #1E1F22; font-weight: 600; }
.guide-tasks li.is-next::before { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(113,73,151,.15); }
.guide-tasks li.is-done { color: #A2A4A8; text-decoration: line-through; }
.guide-tasks li.is-done::before { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12 4 4 8-8' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat; }
.guide-fab { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--purple); display: grid; place-items: center; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.guide-fab.ping::after { content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); border: 2px solid var(--bg); }

body:not(.is-editor) .guide { right: auto; left: 18px; width: 360px; }
@media (min-width: 1101px) { body:not(.is-editor) .guide { width: min(360px, calc(46vw - 36px)); left: max(18px, calc(24vw - 180px)); } }
body:not(.is-editor) .guide-tasks, body:not(.is-editor) .guide-bar { display: none; }
body.is-editor .guide, body.is-editor .guide-fab { right: auto; left: calc(290px + 18px); }
@media (max-width: 1280px) { body.is-editor .guide, body.is-editor .guide-fab { left: calc(260px + 18px); } }
@media (max-width: 960px) { body.is-editor .guide, body.is-editor .guide-fab { left: auto; right: 18px; } }

/* ---------- Bienvenida: el asistente arranca centrado en pantalla ---------- */
.welcome { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 20px; background: rgba(8,8,9,.62); backdrop-filter: blur(4px); animation: fade .25s; }
.welcome-card { width: min(520px, 100%); border-radius: 20px; overflow: hidden; background: #fff; color: #1E1F22; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .3s ease-out; }
.welcome-card .guide-head { padding: 16px 20px; }
.welcome-card .guide-head b { font-size: 15px; }
.welcome-card .guide-ava { width: 42px; height: 42px; }
.welcome-body { padding: 24px 26px 26px; }
.welcome-hi { margin: 0 0 16px; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 32px; line-height: 1; color: var(--purple); }
.welcome-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.welcome-points li { display: flex; gap: 12px; font-size: 15px; line-height: 1.5; color: #3A3C40; }
.welcome-points i { flex: none; width: 22px; height: 3px; margin-top: 11px; border-radius: 2px; background: var(--c); }
.welcome-points li:nth-child(2) i { background: #B9BB00; }   /* el lima, algo más oscuro para que se vea sobre blanco */
.welcome-points b { color: #1E1F22; }
.welcome-body .btn-primary { width: 100%; padding: 15px 22px; font-size: 15px; }
.welcome-more { margin: -8px 0 20px 34px; font-size: 14px; color: #3A3C40; }
.welcome-more a { color: var(--purple); font-weight: 700; }

/* ---------- Vídeo de Showabit ---------- */
.video-card { position: relative; width: min(960px, 100%); border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .25s ease-out; }
.video-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-card .modal-x { background: rgba(0,0,0,.55); color: #fff; }

/* ---------- Indicaciones con flecha (coach marks) ---------- */
.coach-layer { position: fixed; inset: 0; z-index: 65; pointer-events: none; }
.coach { position: fixed; left: 0; top: 0; display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity .3s; will-change: transform; }
.coach.is-on { opacity: 1; }
.coach.p-top { flex-direction: column; }           /* etiqueta encima, flecha hacia abajo */
.coach.p-bottom { flex-direction: column-reverse; } /* etiqueta debajo, flecha hacia arriba */
.coach.p-left { flex-direction: row; }              /* etiqueta a la izquierda, flecha hacia la derecha */
.coach.p-right { flex-direction: row-reverse; }     /* etiqueta a la derecha, flecha hacia la izquierda */
.coach-label {
  max-width: 290px; padding: 10px 14px; border-radius: 10px; background: var(--lime); color: #151515;
  font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 19px; line-height: 1.05; letter-spacing: .01em;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
body.coach-start #startHint { visibility: hidden; }
.coach.is-wide .coach-label { max-width: 420px; }
.coach-arrow { position: relative; flex: none; width: 34px; height: 34px; color: var(--lime); filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.coach-arrow svg { width: 100%; height: 100%; display: block; }
.p-top .coach-arrow { animation: nudgeY 1.1s ease-in-out infinite; }
.p-bottom .coach-arrow { animation: nudgeY 1.1s ease-in-out infinite reverse; transform: rotate(180deg); }
.p-left .coach-arrow { animation: nudgeX 1.1s ease-in-out infinite; transform: rotate(-90deg); }
.p-right .coach-arrow { animation: nudgeX 1.1s ease-in-out infinite reverse; transform: rotate(90deg); }
@keyframes nudgeY { 0%, 100% { translate: 0 -4px; } 50% { translate: 0 4px; } }
@keyframes nudgeX { 0%, 100% { translate: -4px 0; } 50% { translate: 4px 0; } }
.coach-ring { position: fixed; left: 0; top: 0; border-radius: 12px; border: 2px solid var(--lime); opacity: 0; transition: opacity .3s; animation: ring 1.6s ease-out infinite; }
.coach-ring.is-on { opacity: 1; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(216,218,0,.45); } 100% { box-shadow: 0 0 0 12px rgba(216,218,0,0); } }
@media (max-width: 960px) { .coach-layer { display: none; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; padding: 11px 18px; border-radius: 99px; background: var(--lime); color: #151515; font-weight: 600; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toastIn .25s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1500px) {
  /* En el editor la cabecera suma «Generar documento»: los otros botones se quedan sólo con el icono */
  body.is-editor .tb-right .btn-ghost span { display: none; }
  body.is-editor .tb-right .btn-ghost.sm { padding: 8px 10px; }
}
@media (max-width: 1280px) {
  .screen-editor { grid-template-columns: 260px minmax(0, 1fr) 330px; }
  .tb-product em { display: none; }
}
@media (max-width: 1100px) {
  .screen-setup { grid-template-columns: 1fr; }
  .hero-in { padding: 44px 32px 120px; }
  .stepper li { font-size: 0; gap: 0; padding: 4px; }
  .stepper li span { font-size: 12px; }
  .stepper li + li::before { margin: 0 6px 0 -2px; }
}
@media (max-width: 960px) {
  .screen-editor { grid-template-columns: 1fr; height: auto; }
  .panel-left, .panel-right { border: 0; overflow: visible; }
  .canvas { height: 62vh; order: -1; position: sticky; top: var(--top); z-index: 5; }
  .canvas-bar .count { display: none; }
  .gen-done { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --top: 56px; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; gap: 10px; }
  .tb-sep, .tb-product, .btn-contacta, #btnHelp span, .tb-right .btn-ghost span { display: none; }
  .tb-right { gap: 6px; }
  .tb-right .btn-ghost.sm { padding: 8px 10px; }
  /* Con los botones de MarTech y Showabit no cabe el indicador de pasos: la propia pantalla ya indica el paso */
  .stepper { display: none; }
  .topbar { grid-template-columns: auto 1fr; }
  .stepper { justify-content: center; }
  #btnGenerate { font-size: 0; padding: 9px; gap: 0; }
  .brand-grid { grid-template-columns: 1fr; }
  .brand-card { display: grid; grid-template-columns: 120px 1fr; }
  .brand-card .bc-img { height: auto; min-height: 100px; }
  .brand-card .bc-logo { display: none; }
  .font-grid { grid-template-columns: 1fr 1fr; }
  .setup-form { padding: 28px 16px 120px; }
  .hero-in { padding: 34px 16px 90px; }
  .setup-cta { flex-direction: column; align-items: stretch; }
  .canvas { height: 46vh; }
  .guide, body.is-editor .guide, body:not(.is-editor) .guide { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .guide-tasks { display: none; }
  .gen-done { padding: 24px 18px; }
  .gen-cta { flex-direction: column; align-items: flex-start; }
}
