/* =========================================================
   PERSONALIZAR · editor tipo app (barra lateral + lienzo)
   Mundo propio de esta pantalla: lienzo gris claro, paneles
   claros con filetes finos, controles tipo iOS. Mismos tokens
   y la misma letra (Recursive) que el resto de Ecuatrend.
   ========================================================= */

:root {
  --ed-canvas: var(--paper-2);
  --ed-surface: color-mix(in srgb, var(--paper) 45%, #ffffff);
  --ed-fill: color-mix(in srgb, var(--ink) 5.5%, var(--ed-surface));
  --ed-fill-hover: color-mix(in srgb, var(--ink) 9%, var(--ed-surface));
  --ed-hair: color-mix(in srgb, var(--ink) 11%, transparent);
  --ed-hair-strong: color-mix(in srgb, var(--ink) 18%, transparent);
  --ed-lift: 0 1px 2px color-mix(in srgb, #000 14%, transparent), 0 1px 1px color-mix(in srgb, #000 6%, transparent);
  --ed-float: 0 12px 32px -12px color-mix(in srgb, #000 30%, transparent), 0 2px 6px color-mix(in srgb, #000 8%, transparent);
  --ed-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent);
  --ed-bezel: #121211;
  --ed-panel-w: 380px;
  --ed-bar-h: 56px;
}
:root[data-theme="dark"] {
  --ed-canvas: color-mix(in srgb, var(--paper) 62%, #000000);
  --ed-surface: var(--paper-2);
  --ed-fill: color-mix(in srgb, var(--ink) 7%, var(--ed-surface));
  --ed-fill-hover: color-mix(in srgb, var(--ink) 11%, var(--ed-surface));
  --ed-hair: color-mix(in srgb, var(--ink) 10%, transparent);
  --ed-hair-strong: color-mix(in srgb, var(--ink) 17%, transparent);
  --ed-lift: 0 1px 2px color-mix(in srgb, #000 45%, transparent);
  --ed-float: 0 14px 36px -12px color-mix(in srgb, #000 70%, transparent);
  --ed-bezel: #3b3b37;
}
:root[data-theme="dark"] .ed-frame { box-shadow: var(--ed-float), 0 0 0 1px var(--ed-hair-strong); }

.editor-body { height: 100dvh; overflow: hidden; background: var(--ed-canvas); }
.editor-body ::selection { background: color-mix(in srgb, var(--accent) 65%, transparent); color: var(--on-accent); }
.editor { height: 100dvh; display: grid; grid-template-rows: var(--ed-bar-h) minmax(0, 1fr); }

/* ---------- Barra superior ---------- */
.ed-bar { position: relative; z-index: 20; padding: 0 12px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; border-bottom: 1px solid var(--ed-hair); background: var(--ed-surface); }
.ed-title { min-width: 0; display: grid; line-height: 1.15; }
.ed-title strong { font-size: 15px; font-weight: 720; }
.ed-title span { overflow: hidden; color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.ed-icon-button { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-decoration: none; transition: background-color .2s var(--ease-out); }
.ed-icon-button:hover { background: var(--ed-fill-hover); }
.ed-icon-button .icon { width: 20px; height: 20px; }
.ed-icon-button:focus-visible, .ed-row:focus-visible, .ed-primary:focus-visible, .ed-text-button:focus-visible, .ed-device button:focus-visible { outline: none; box-shadow: var(--ed-ring); }

/* Teléfono / Computadora: control segmentado con pastilla elevada. */
.ed-device { position: relative; padding: 3px; display: inline-flex; gap: 2px; border-radius: 11px; background: var(--ed-fill); }
.ed-device button { min-height: 32px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; transition: background-color .25s var(--ease-out), color .25s var(--ease-out), box-shadow .25s var(--ease-out); }
.ed-device button .icon { width: 17px; height: 17px; }
.ed-device button[aria-pressed="true"] { background: var(--ed-surface); color: var(--ink); box-shadow: var(--ed-lift); }

.ed-save { justify-self: end; min-width: 0; display: flex; align-items: center; gap: 10px; }
.ed-save-state { min-width: 0; margin: 0; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; font-weight: 550; }
.ed-save-state span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-save-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ed-hair-strong); transition: background-color .25s var(--ease-out); }
.ed-save.is-dirty .ed-save-state { color: var(--ink); }
.ed-save.is-dirty .ed-save-dot { background: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent); animation: ed-pulse 1.8s var(--ease-out) infinite; }
.ed-save.has-errors .ed-save-state { color: var(--danger); }
.ed-save.has-errors .ed-save-dot { background: var(--danger); }
@keyframes ed-pulse { 0% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent); } 70%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent), 0 0 0 7px transparent; } }
.ed-text-button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 13.5px; font-weight: 600; transition: background-color .2s var(--ease-out); }
.ed-text-button:hover { background: var(--ed-fill-hover); }
.ed-text-button[hidden] { display: none; }
.ed-primary { min-height: 36px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 700; transition: transform .2s var(--ease-out), opacity .2s var(--ease-out); }
.ed-primary:hover { opacity: .9; }
.ed-primary:active { transform: scale(.97); }
.ed-save.is-dirty .ed-primary { animation: ed-ready .5s var(--ease-out); }
@keyframes ed-ready { 40% { transform: translateY(-2px); } }

/* ---------- Área principal ---------- */
.ed-main { min-height: 0; display: grid; grid-template-columns: var(--ed-panel-w) minmax(0, 1fr); }

/* ---------- Panel lateral ---------- */
.ed-panel { position: relative; z-index: 10; min-height: 0; overflow: auto; border-right: 1px solid var(--ed-hair); background: var(--ed-surface); scrollbar-width: thin; scrollbar-color: var(--ed-hair-strong) transparent; }
.ed-sheet-handle { display: none; }
.ed-panel-error { margin: 12px 16px 0; }

/* Sin JavaScript todo queda apilado y se puede editar igual. */
.ed-home, .ed-section { padding-bottom: 24px; }
.ed-js .ed-panel { overflow: hidden; }
.ed-js .ed-home, .ed-js .ed-section { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--ed-hair-strong) transparent; transition: transform .38s var(--ease-out), opacity .3s var(--ease-out), visibility 0s .38s; }
.ed-js .ed-section { transform: translateX(28px); opacity: 0; visibility: hidden; }
.ed-js .ed-section.is-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.ed-js .ed-home { transition-delay: 0s; }
.ed-js .ed-panel.is-section .ed-home { transform: translateX(-28px); opacity: 0; visibility: hidden; transition-delay: 0s, 0s, .38s; }

.ed-home-title { padding: 22px 20px 10px; font-size: 22px; font-weight: 780; letter-spacing: -.02em; }
.ed-home-hint { display: none; }
.ed-home-lead { margin: -4px 20px 4px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
/* Grupos tipo Ajustes: título pequeño y filas en una tarjeta suave. */
.ed-list-title { margin: 18px 22px 6px; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.ed-list { margin: 0 10px; padding: 3px; display: grid; gap: 0; border-radius: 14px; background: color-mix(in srgb, var(--ink) 3%, var(--ed-surface)); list-style: none; }
.ed-list li + li .ed-row::before { content: ""; position: absolute; top: 0; right: 10px; left: 60px; border-top: 1px solid var(--ed-hair); }
.ed-list li + li .ed-row:hover::before, .ed-list li:hover + li .ed-row::before { opacity: 0; }
.ed-list .ed-row { position: relative; }
.ed-row { width: 100%; min-height: 60px; padding: 9px 10px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 18px; align-items: center; gap: 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; transition: background-color .2s var(--ease-out); }
.ed-row:hover { background: var(--ed-fill); }
.ed-row.is-current { background: var(--ed-fill-hover); }
.ed-row-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--ed-fill); color: var(--ink); transition: background-color .2s var(--ease-out); }
.ed-row:hover .ed-row-icon { background: var(--ed-surface); box-shadow: var(--ed-lift); }
.ed-row-icon .icon { width: 19px; height: 19px; }
.ed-row-text { min-width: 0; display: grid; gap: 1px; }
.ed-row-text strong { font-size: 14.5px; font-weight: 650; }
.ed-row-text span { min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ed-row-text span.is-warning { color: var(--danger); font-weight: 600; }
.ed-row-swatch { width: 11px; height: 11px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--ed-hair-strong); }
.ed-row-chevron { width: 16px; height: 16px; color: var(--ink-2); transition: transform .25s var(--ease-out); }
.ed-row:hover .ed-row-chevron { transform: translateX(2px); }
.ed-home-note { margin: 14px 20px 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }

.ed-section-head { position: sticky; top: 0; z-index: 2; padding: 10px 12px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--ed-hair); background: color-mix(in srgb, var(--ed-surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.ed-section-head h2 { font-size: 16px; font-weight: 720; }
.ed-section-body { padding: 18px 20px 28px; display: grid; gap: 20px; }
.ed-intro { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.ed-group { display: grid; gap: 14px; }
.ed-group + .ed-group { padding-top: 18px; border-top: 1px solid var(--ed-hair); }
.ed-group-title { color: var(--ink-2); font-size: 12px; font-weight: 700; }
.ed-dependent { display: grid; gap: 20px; transition: opacity .3s var(--ease-out); }
.ed-dependent.is-off { opacity: .45; }

/* ---------- Campos ---------- */
.ed-field { min-width: 0; margin: 0; padding: 0; display: grid; gap: 7px; border: 0; }
.ed-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0; font-size: 13px; font-weight: 650; }
.ed-label .mono { color: var(--ink-2); font-weight: 500; }
.ed-help { color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.ed-error, .ed-error ul { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 12.5px; font-weight: 600; }

.ed-panel input:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]),
.ed-panel textarea,
.ed-panel select { min-height: 40px; padding: 9px 12px; border: 1px solid transparent; border-radius: 10px; background: var(--ed-fill); font-size: 14.5px; transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.ed-panel textarea { min-height: 88px; }
.ed-panel input:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]):hover,
.ed-panel textarea:hover { border-color: transparent; background: var(--ed-fill-hover); }
.ed-panel input:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]):focus,
.ed-panel textarea:focus { border-color: var(--ed-hair-strong); background: var(--ed-surface); box-shadow: var(--ed-ring); }
.ed-panel input[aria-invalid="true"]:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]) { border-color: var(--danger); }
.ed-panel input::placeholder, .ed-panel textarea::placeholder { color: color-mix(in srgb, var(--ink-2) 80%, transparent); }

/* Segmentado (hasta 3 opciones) y rejilla de opciones (4 o más). */
.ed-segmented { padding: 3px; display: grid; grid-template-columns: repeat(var(--count), minmax(0, 1fr)); gap: 2px; border-radius: 11px; background: var(--ed-fill); }
.ed-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ed-option { position: relative; min-width: 0; cursor: pointer; }
.ed-option input { position: absolute; opacity: 0; pointer-events: none; }
.ed-option span { min-height: 34px; padding: 6px 8px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.2; text-align: center; transition: background-color .25s var(--ease-out), color .25s var(--ease-out), box-shadow .25s var(--ease-out); }
.ed-segmented .ed-option:hover span { color: var(--ink); }
.ed-segmented .ed-option input:checked + span { background: var(--ed-surface); color: var(--ink); box-shadow: var(--ed-lift); }
.ed-options .ed-option:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ed-options .ed-option span { min-height: 40px; border: 1px solid var(--ed-hair); border-radius: 10px; background: var(--ed-surface); }
.ed-options .ed-option:hover span { border-color: var(--ed-hair-strong); color: var(--ink); }
.ed-options .ed-option input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.ed-option input:focus-visible + span { box-shadow: var(--ed-ring); }
.ed-option input[value="casual"] + span { --casl: 1; }
.ed-option input[value="tecnica"] + span { --mono: 1; }
.ed-option input[value="elegante"] + span { font-style: oblique 9deg; }

/* Interruptor tipo iOS. */
.ed-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.ed-switch-text { display: grid; gap: 3px; font-size: 14px; font-weight: 600; }
.ed-switch-text small { color: var(--ink-2); font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.ed-switch { position: relative; width: 46px; height: 28px; flex: none; }
.ed-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ed-switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--ed-hair-strong); pointer-events: none; transition: background-color .25s var(--ease-out); }
.ed-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px color-mix(in srgb, #000 30%, transparent); transition: transform .3s var(--ease-out); }
.ed-switch input:checked + .ed-switch-track { background: var(--ink); }
:root[data-theme="dark"] .ed-switch input:checked + .ed-switch-track { background: var(--accent); }
.ed-switch input:checked + .ed-switch-track::after { transform: translateX(18px); }
.ed-switch input:focus-visible + .ed-switch-track { box-shadow: var(--ed-ring); }

/* Deslizador. */
.ed-range input[type="range"] { width: 100%; height: 24px; }
.ed-range input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--ed-hair-strong); }
.ed-range input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--ed-hair-strong); }
.ed-range input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; border: 0; background: #ffffff; box-shadow: 0 1px 4px color-mix(in srgb, #000 32%, transparent); }
.ed-range input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; background: #ffffff; box-shadow: 0 1px 4px color-mix(in srgb, #000 32%, transparent); }

/* Color. */
.ed-color-row { display: flex; align-items: center; gap: 12px; }
.ed-color-well { position: relative; width: 44px; height: 44px; flex: none; overflow: hidden; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--ed-hair-strong); }
.ed-color-well input[type="color"] { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); padding: 0; border: 0; cursor: pointer; }
.ed-color-hex { padding: 8px 12px; border-radius: 10px; background: var(--ed-fill); font-size: 13.5px; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-swatch { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 14%, transparent); transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.ed-swatch:hover { transform: scale(1.1); }
.ed-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ed-surface), 0 0 0 4px var(--ink); }
.ed-swatch:focus-visible { outline: none; box-shadow: var(--ed-ring); }

/* Imagen. */
.ed-image-drop { position: relative; padding: 10px; display: flex; align-items: center; gap: 12px; border: 1px dashed var(--ed-hair-strong); border-radius: 12px; cursor: pointer; transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out); }
.ed-image-drop:hover, .ed-image-drop.is-dragging { border-color: var(--ink-2); background: var(--ed-fill); }
.ed-image-drop:focus-within { box-shadow: var(--ed-ring); }
.ed-image-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ed-image-thumb { width: 56px; height: 56px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--ed-fill); color: var(--ink-2); }
.ed-image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-image-thumb .icon { width: 22px; height: 22px; }
.ed-image-text { min-width: 0; display: grid; gap: 2px; }
.ed-image-text strong { overflow: hidden; font-size: 13.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ed-image-text small { color: var(--ink-2); font-size: 12px; line-height: 1.4; }
.ed-image-clear { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 550; }
.ed-image-clear input { width: 16px; height: 16px; }

/* Dirección web con prefijo. */
.ed-prefixed { display: flex; align-items: center; border-radius: 10px; background: var(--ed-fill); transition: box-shadow .2s var(--ease-out), background-color .2s var(--ease-out); }
.ed-prefixed:focus-within { background: var(--ed-surface); box-shadow: inset 0 0 0 1px var(--ed-hair-strong), var(--ed-ring); }
.ed-prefixed span { padding-left: 12px; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; --mono: 1; }
.ed-panel .ed-prefixed input:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]) { min-width: 0; padding-left: 2px; background: transparent; box-shadow: none; --mono: 1; }
.ed-slug [data-slug-warning] { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--ink); }
.ed-slug [data-slug-warning][hidden] { display: none; }

/* Plantillas: miniaturas de tienda en dos columnas. */
.ed-templates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ed-template { position: relative; display: grid; gap: 7px; cursor: pointer; }
.ed-template input { position: absolute; opacity: 0; pointer-events: none; }
.ed-template-shot { position: relative; height: 168px; overflow: hidden; border-radius: 12px; background: var(--ed-fill); box-shadow: inset 0 0 0 1px var(--ed-hair); transition: box-shadow .25s var(--ease-out), transform .3s var(--ease-out); }
.ed-template-shot .demo-mini { position: absolute; top: 0; left: 0; width: 268px; zoom: .6; pointer-events: none; }
.ed-template-shot .demo-mini .demo-screen { height: 296px; border: 0; border-radius: 0; }
.ed-template:hover .ed-template-shot { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--ed-hair-strong), var(--ed-float); }
.ed-template input:checked ~ .ed-template-shot { box-shadow: 0 0 0 2px var(--ed-surface), 0 0 0 4px var(--ink); }
.ed-template input:focus-visible ~ .ed-template-shot { box-shadow: var(--ed-ring); }
.ed-template-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 650; line-height: 1.25; }
.ed-template-name .icon { width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: var(--ink); color: var(--paper); stroke-width: 2.4; opacity: 0; transform: scale(.6); transition: opacity .2s var(--ease-out), transform .3s var(--ease-out); }
.ed-template input:checked ~ .ed-template-name .icon { opacity: 1; transform: none; }
.ed-template.is-picked .ed-template-shot { animation: ed-picked .5s var(--ease-out); }
@keyframes ed-picked { 40% { transform: scale(.96); } }

/* Muestra de los títulos, en la misma lógica que la tienda. */
.ed-sample.heading-sample { min-height: 112px; border: 0; border-radius: 14px; background: var(--ed-fill); }
.ed-sample.heading-sample span { font-size: 34px; }

/* Ideas con un toque. */
.ed-panel .suggest-chips { margin-top: 2px; gap: 6px; }
.ed-panel .suggest-chip { min-height: 30px; padding: 4px 11px; border: 0; border-radius: 999px; background: var(--ed-fill); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.ed-panel .suggest-chip:hover { background: var(--ed-fill-hover); color: var(--ink); font-weight: 600; }
.ed-panel .suggest-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Editor de enlaces dentro del panel angosto. */
.ed-links .field > label { font-size: 13px; font-weight: 650; }
.ed-panel .link-rows { border-top: 0; gap: 8px; }
.ed-panel .link-row { padding: 10px; grid-template-columns: 36px minmax(0, 1fr); border: 0; border-radius: 12px; background: var(--ed-fill); }
.ed-panel .link-site { width: 36px; height: 36px; grid-row: 1 / 3; align-self: start; border: 0; background: var(--ink); color: var(--paper); }
.ed-panel .link-site:has(use[href="#i-globe"]) { background: var(--ed-surface); color: var(--ink); }
.ed-panel .link-tools { grid-column: 2; }
.ed-panel .link-row .variant-error { grid-column: 2; }
.ed-panel .link-row input:not([type="range"]):not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]) { min-height: 36px; background: var(--ed-surface); }
.ed-panel .link-empty { border: 1px dashed var(--ed-hair-strong); border-radius: 12px; }

/* ---------- Lienzo con la vista previa ---------- */
.ed-canvas { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 20px 28px 64px; background: var(--ed-canvas); }
.ed-stage { --scale: .8; --sw: 390; --sh: 844; display: grid; place-items: center; }
.ed-stage[data-device="desktop"] { --sw: 1280; --sh: 800; }
.ed-frame { position: relative; padding: 10px; border-radius: 46px; background: var(--ed-bezel); box-shadow: var(--ed-float), 0 0 0 1px var(--ed-hair); transition: border-radius .45s var(--ease-out), padding .45s var(--ease-out); }
.ed-stage[data-device="desktop"] .ed-frame { padding: 30px 0 0; border-radius: 14px; background: color-mix(in srgb, var(--ink) 8%, var(--ed-surface)); }
.ed-stage[data-device="desktop"] .ed-frame::before { content: ""; position: absolute; top: 11px; left: 14px; width: 44px; height: 9px; background: radial-gradient(circle at 4.5px 50%, var(--ed-hair-strong) 4.5px, transparent 5px) 0 0 / 15px 9px repeat-x; }
.ed-frame-island { position: absolute; z-index: 4; top: 18px; left: 50%; width: calc(96px * var(--scale)); height: calc(28px * var(--scale)); border-radius: 999px; background: var(--ed-bezel); transform: translateX(-50%); transition: opacity .3s var(--ease-out); }
.ed-stage[data-device="desktop"] .ed-frame-island { opacity: 0; }
.ed-screen { position: relative; width: calc(var(--sw) * var(--scale) * 1px); height: calc(var(--sh) * var(--scale) * 1px); overflow: hidden; border-radius: 37px; background: var(--paper); transition: width .45s var(--ease-out), height .45s var(--ease-out), border-radius .45s var(--ease-out); }
.ed-stage[data-device="desktop"] .ed-screen { border-radius: 0 0 14px 14px; }
.ed-screen iframe { position: absolute; top: 0; left: 0; width: calc(var(--sw) * 1px); height: calc(var(--sh) * 1px); border: 0; background: var(--paper); transform: scale(var(--scale)); transform-origin: 0 0; visibility: hidden; }
.ed-screen iframe.is-shown { visibility: visible; }
.ed-screen .preview-curtain { border-radius: inherit; }

/* Qué acabas de cambiar: pastilla flotante bajo la tienda. */
.ed-change { position: absolute; bottom: 16px; left: 50%; max-width: calc(100% - 48px); min-height: 34px; padding: 6px 14px; display: flex; align-items: center; gap: 9px; border-radius: 999px; background: var(--ed-surface); box-shadow: var(--ed-lift), 0 0 0 1px var(--ed-hair); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; transform: translateX(-50%); }
.ed-change strong { color: var(--ink); font-weight: 720; }
.ed-change > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.ed-change-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); }
.ed-change.is-new > span:nth-child(2) { animation: ed-change-in .45s var(--ease-out); }
.ed-change.is-new .ed-change-dot { animation: ed-dot .6s var(--ease-out); }
.ed-change-status:empty { display: none; }
@keyframes ed-change-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes ed-dot { 30% { transform: scale(1.8); } }

/* Mensajes del sitio y aviso flotante sobre el editor. */
.editor-body .message-stack { top: calc(var(--ed-bar-h) + 10px); }
.editor-body .toast { top: auto; bottom: 72px; left: calc(var(--ed-panel-w) + (100% - var(--ed-panel-w)) / 2); }

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1180px) {
  :root { --ed-panel-w: 340px; }
  .ed-device button span { display: none; }
  .ed-device button { padding: 0 10px; }
}

/* ---------- Celular: tienda a pantalla completa y panel que sube ---------- */
@media (max-width: 860px) {
  .ed-bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; padding: 0 8px; }
  .ed-device { display: none; }
  .ed-save:not(.is-dirty):not(.has-errors) .ed-save-state { display: none; }
  .ed-save-state { font-size: 12.5px; }
  .ed-save-dot { display: none; }
  /* En el celular el título es el nombre de la tienda: el panel ya dice «Tu tienda». */
  .ed-title strong { display: none; }
  .ed-title span { color: var(--ink); font-size: 15px; font-weight: 720; }
  /* Señal en vivo sin ocupar ancho: punto lima sobre «Guardar» mientras hay cambios. */
  .ed-primary { position: relative; }
  .ed-save.is-dirty .ed-primary::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--ed-surface); }
  .ed-save { gap: 4px; }
  .ed-main { position: relative; grid-template-columns: minmax(0, 1fr); }
  .ed-canvas { padding: 0; place-items: stretch; }
  .ed-stage { place-items: stretch; }
  .ed-frame, .ed-stage[data-device="desktop"] .ed-frame { padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .ed-stage[data-device="desktop"] .ed-frame::before { content: none; }
  .ed-stage[data-device="desktop"] .ed-screen { border-radius: 0; }
  .ed-frame-island, .ed-change { display: none; }
  .ed-screen { border-radius: 0; }

  .ed-js .ed-panel { --sheet-peek: 60px; position: absolute; z-index: 30; right: 0; bottom: 0; left: 0; height: min(64dvh, 560px); overflow: hidden; border: 0; border-radius: 20px 20px 0 0; box-shadow: var(--ed-float), 0 0 0 1px var(--ed-hair); transform: translateY(calc(100% - var(--sheet-peek))); transition: transform .42s var(--ease-out); }
  .ed-js .ed-panel.is-expanded { transform: translateY(var(--sheet-drag, 0px)); }
  .ed-js .ed-panel.is-dragging { transition: none; }
  .ed-js .ed-sheet-handle { position: absolute; z-index: 5; top: 0; left: 50%; width: 120px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; transform: translateX(-50%); touch-action: none; cursor: grab; }
  .ed-js .ed-sheet-handle span:first-child { width: 38px; height: 5px; border-radius: 999px; background: var(--ed-hair-strong); }
  .ed-js .ed-home, .ed-js .ed-section { top: 14px; }
  .ed-js .ed-panel:not(.is-expanded) .ed-home { overflow: hidden; }
  .ed-home-title { padding: 12px 18px 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 18px; }
  .ed-js .ed-home-hint { display: inline; color: var(--ink-2); font-size: 13px; font-weight: 600; letter-spacing: 0; transition: opacity .25s var(--ease-out); }
  .ed-panel.is-expanded .ed-home-hint { opacity: 0; }
  .ed-row { min-height: 54px; }
  .editor-body .toast { left: 50%; bottom: 96px; }
}
@media (max-width: 420px) {
  .ed-section-body { padding: 16px 16px 28px; }
  .ed-templates { gap: 10px; }
}

/* ---------- Banners dentro del editor ---------- */
.ed-banner-home, .ed-banner-editor { display: grid; gap: 16px; }
.ed-banner-home[hidden], .ed-banner-editor[hidden] { display: none; }
.ed-banner-list { margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.ed-banner-row { padding: 8px 10px 8px 8px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-radius: 12px; background: var(--ed-fill); }
.ed-banner-chip { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--chip-bg); color: var(--chip-fg); font-size: 15px; font-weight: 800; box-shadow: inset 0 0 0 1px var(--ed-hair); }
.ed-banner-open { min-width: 0; padding: 2px 0; display: grid; gap: 2px; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.ed-banner-open strong { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ed-banner-open small { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.ed-banner-open:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.ed-banner-open:focus-visible { outline: none; border-radius: 6px; box-shadow: var(--ed-ring); }
.ed-banner-empty { padding: 18px; border: 1px dashed var(--ed-hair-strong); border-radius: 12px; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.ed-banner-empty[hidden] { display: none; }
.ed-add { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--ed-hair-strong); border-radius: 12px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 650; transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out); }
.ed-add:hover { border-style: solid; background: var(--ed-fill); }
.ed-add:focus-visible { outline: none; box-shadow: var(--ed-ring); }
.ed-add .icon { width: 18px; height: 18px; }
.ed-banner-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ed-banner-editor-head .ed-text-button { display: inline-flex; align-items: center; gap: 4px; padding-left: 4px; }
.ed-banner-editor-head .icon { width: 16px; height: 16px; }
.ed-banner-editor-head strong { font-size: 14px; font-weight: 700; }
.ed-panel .banner-editor-preview { margin: 0; padding: 12px; display: grid; gap: 8px; border: 0; border-radius: 14px; background: var(--ed-fill); }
.ed-panel .banner-editor-preview-heading { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 12px; }
.ed-panel .banner-editor-preview-heading strong { color: var(--ink); font-size: 12px; font-weight: 700; }
.ed-panel .store-banner-preview { border-radius: 10px; overflow: hidden; }
.ed-color-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ed-color-trio .ed-color-well { width: 100%; height: 40px; }
.ed-banner-actions { padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--ed-hair); }
.ed-banner-actions .ed-primary { margin-left: auto; }
.ed-danger { color: var(--danger); }
.ed-danger[hidden] { display: none; }
.ed-error[hidden] { display: none; }
