/* Constructor de correos (correos.js y public/correos/): la lista de plantillas y el editor. La interfaz usa los colores
   por uso de espacio.css (siguen al tema claro u oscuro y a la marca); el correo del lienzo se ve siempre con los suyos
   (color-scheme: light), como le llega a quien lo recibe. El movimiento usa los tokens --mov-* y --curva-* (skill
   animaciones): nada teatral, el editor es una herramienta. */

/* ---------- Piezas comunes ---------- */

.ce-boton-principal, .ce-boton-suave {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; margin: 0; padding: 0.45rem 0.9rem;
  border-radius: 999px; font: inherit; font-size: 0.88rem; line-height: 1.2; white-space: nowrap; cursor: pointer;
  transition: background-color var(--mov-rapido) ease, border-color var(--mov-rapido) ease, scale var(--mov-instante) var(--curva-frena);
}
.ce-boton-principal { border: 1px solid transparent; background: var(--brand); color: white; font-weight: 600; }
.ce-boton-suave { border: 1px solid var(--borde); background: var(--superficie); color: var(--texto); }
.ce-boton-principal:active, .ce-boton-suave:active { scale: calc(1 - 0.03 * var(--mov-intensidad)); }
@media (hover: hover) and (pointer: fine) {
  .ce-boton-principal:hover { background: color-mix(in srgb, var(--brand) 86%, black); }
  .ce-boton-suave:hover { border-color: color-mix(in srgb, var(--foco) 45%, var(--borde)); background: var(--encima); }
}
.ce-boton-suave.es-peligro, .ce-enlace-suave.es-peligro, .ce-herramienta.es-peligro { color: oklch(0.55 0.2 25); }
.ce-boton-principal .menu-icono, .ce-boton-suave .menu-icono { width: 1rem; height: 1rem; }
.ce-herramienta {
  display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; margin: 0; padding: 0; border: 0;
  border-radius: 0.55rem; background: none; color: var(--texto-suave); cursor: pointer;
  transition: background-color var(--mov-rapido) ease, color var(--mov-rapido) ease;
}
@media (hover: hover) and (pointer: fine) { .ce-herramienta:hover:not(:disabled) { background: var(--encima); color: var(--texto); } }
.ce-herramienta:disabled { opacity: 0.35; cursor: default; }
.ce-enlace-suave { justify-self: start; margin: 0; padding: 0; border: 0; background: none; color: var(--texto-suave); font: inherit; font-size: 0.82rem; text-decoration: underline; cursor: pointer; }
.ce-pista { margin: 0; color: var(--texto-suave); font-size: 0.82rem; line-height: 1.45; }
.ce-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ce-miniatura { display: block; position: relative; height: 11rem; overflow: hidden; background: #f4f4f5; color-scheme: light; }
.ce-miniatura iframe { width: 300%; height: 300%; border: 0; transform: scale(0.3333); transform-origin: 0 0; pointer-events: none; background: #fff; }

/* ---------- Lista ---------- */

[data-shown="emails"] > main.wide { max-width: 72rem; }
.ce-lista-cabeza { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.ce-lista-cabeza h2 { margin: 0 0 0.25rem; }
.ce-tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem; }
.ce-tarjeta { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--borde); border-radius: 1rem; background: var(--superficie);
  transition: border-color var(--mov-rapido) ease, box-shadow var(--mov-rapido) ease; }
@media (hover: hover) and (pointer: fine) {
  .ce-tarjeta:hover { border-color: color-mix(in srgb, var(--foco) 40%, var(--borde)); box-shadow: 0 14px 30px -20px color-mix(in srgb, var(--tinta) 55%, transparent); }
}
.ce-tarjeta-abrir { display: block; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--borde); background: none; cursor: pointer; }
.ce-tarjeta-texto { display: grid; gap: 0.15rem; padding: 0.8rem 1rem 0.25rem; min-width: 0; }
.ce-tarjeta-texto strong, .ce-tarjeta-texto .ce-pista { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-tarjeta-acciones { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.6rem 1rem 1rem; }
.ce-tarjeta-acciones .ce-boton-suave { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.ce-lista-vacia { display: grid; justify-items: center; gap: 0.6rem; padding: 3rem 1rem; border: 1px dashed var(--borde); border-radius: 1rem; color: var(--texto-suave); }
.ce-lista-vacia .menu-icono { width: 2rem; height: 2rem; }

/* ---------- Diálogos ---------- */

/* Crecen desde el centro y el fondo se oscurece a la par (foco; entra con --mov-medio y sale más rápido). */
.ce-dialogo {
  --dur: var(--mov-rapido);
  width: min(60rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--borde); border-radius: 1rem; background: var(--superficie); color: var(--texto);
  box-shadow: 0 30px 70px -24px rgb(0 0 0 / 0.45);
  opacity: 0; scale: calc(1 - 0.04 * var(--mov-intensidad));
  transition: opacity var(--dur) var(--curva-frena), scale var(--dur) var(--curva-frena), display var(--dur) allow-discrete, overlay var(--dur) allow-discrete;
}
.ce-dialogo[open] { --dur: var(--mov-medio); opacity: 1; scale: 1; }
@starting-style { .ce-dialogo[open] { opacity: 0; scale: calc(1 - 0.04 * var(--mov-intensidad)); } }
.ce-dialogo::backdrop { background: rgb(8 14 15 / 0); transition: background-color var(--mov-medio) ease, display var(--mov-medio) allow-discrete, overlay var(--mov-medio) allow-discrete; }
.ce-dialogo[open]::backdrop { background: rgb(8 14 15 / 0.45); }
@starting-style { .ce-dialogo[open]::backdrop { background: rgb(8 14 15 / 0); } }
.ce-dialogo-cabeza { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.ce-dialogo-cabeza h3 { flex: 1; margin: 0; font-size: 1.05rem; }
.ce-dialogo-acciones, .ce-dialogo-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.ce-dialogo-pie { padding-top: 0.75rem; border-top: 1px solid var(--borde); }
.ce-opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; }
.ce-opcion { display: grid; justify-items: start; gap: 0.35rem; margin: 0; padding: 1.25rem; border: 1px solid var(--borde); border-radius: 0.9rem;
  background: var(--superficie-baja); color: var(--texto); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--mov-rapido) ease; }
.ce-opcion .menu-icono { width: 1.5rem; height: 1.5rem; color: var(--foco); }
.ce-opcion strong { font-size: 1rem; }
@media (hover: hover) and (pointer: fine) { .ce-opcion:hover { border-color: var(--foco); } }
.ce-importar { display: grid; gap: 0.75rem; }
.ce-plantillas { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.85rem; }
.ce-plantilla { display: grid; gap: 0.3rem; margin: 0; padding: 0.5rem 0.5rem 0.75rem; border: 1px solid var(--borde); border-radius: 0.85rem; background: var(--superficie);
  color: var(--texto); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--mov-rapido) ease; }
.ce-plantilla .ce-miniatura { height: 9rem; border-radius: 0.5rem; }
@media (hover: hover) and (pointer: fine) { .ce-plantilla:hover { border-color: var(--foco); } }
.ce-conflicto { width: min(34rem, calc(100vw - 2rem)); }
.ce-atajos { width: min(36rem, calc(100vw - 2rem)); }
.ce-atajos-lista { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.55rem 1.25rem; margin: 0; }
.ce-atajos-lista dt { white-space: nowrap; color: var(--texto-suave); }
.ce-atajos-lista dd { margin: 0; }
.ce-atajos kbd { padding: 0.05rem 0.4rem; border: 1px solid var(--borde); border-bottom-width: 2px; border-radius: 0.35rem; background: var(--superficie-baja); color: var(--texto); font: 500 0.78rem/1.6 ui-monospace, monospace; }

/* ---------- El editor, a toda la pantalla ---------- */

body.espacio[data-shown="email-editor"] > main { display: flex; flex-direction: column; max-width: none; height: 100vh; height: 100dvh; padding: 0; overflow: hidden; }
/* Los avisos flotan arriba al centro en vez de empujar el editor. */
body.espacio[data-shown="email-editor"] > main > #message:empty { display: none; }
body.espacio[data-shown="email-editor"] > main > #message:not(:empty) {
  position: fixed; top: 4.25rem; left: 50%; z-index: 50; transform: translateX(-50%); max-width: min(36rem, 90vw); margin: 0; padding: 0.45rem 1rem;
  border: 1px solid var(--borde); border-radius: 999px; background: var(--superficie); box-shadow: 0 8px 24px -10px rgb(0 0 0 / 0.35); font-size: 0.88rem;
}
section[data-view="email-editor"]:not([hidden]) { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
@media (max-width: 56rem) {
  body.espacio[data-shown="email-editor"] { grid-template-columns: minmax(0, 1fr); }
  body.espacio[data-shown="email-editor"] > .menu { display: none; }
}

/* La barra de arriba: volver, el nombre (se edita ahí), el estado del guardado y las acciones. */
.ce-arriba { display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: center; gap: 0.5rem; max-width: none; min-height: 3.5rem; margin: 0;
  padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--borde); background: var(--superficie); }
.ce-arriba .menu-icono { width: 1.1rem; height: 1.1rem; }
.ce-volver { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; padding: 0.4rem 0.6rem; border: 0; border-radius: 999px; background: none; color: var(--texto-suave); font: inherit; font-size: 0.88rem; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .ce-volver:hover { background: var(--encima); color: var(--texto); } }
.ce-nombre { field-sizing: content; flex: 0 1 auto; width: auto; min-width: 6rem; max-width: 22rem; margin: 0; padding: 0.3rem 0.5rem; border: 1px solid transparent;
  border-radius: 0.55rem; background: none; color: var(--texto); font: inherit; font-size: 1rem; font-weight: 650; text-overflow: ellipsis; }
@media (hover: hover) and (pointer: fine) { .ce-nombre:hover { border-color: var(--borde); } }
.ce-nombre:focus { border-color: var(--foco); background: var(--superficie); outline: none; }
.ce-estado { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--texto-suave); font-size: 0.8rem; white-space: nowrap; }
.ce-estado::before { content: ''; flex: none; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: oklch(0.62 0.14 150); }
.ce-estado:is([data-estado="pending"], [data-estado="saving"])::before { background: oklch(0.74 0.14 75); }
/* Guardando: un pulso de opacidad mientras dure (indica un estado, así que sigue con movimiento reducido). */
.ce-estado[data-estado="saving"]::before { animation: ce-pulso 1.2s ease-in-out infinite; }
.ce-estado:is([data-estado="offline"], [data-estado="stale"], [data-estado="error"]) { color: oklch(0.55 0.2 25); }
.ce-estado:is([data-estado="offline"], [data-estado="stale"], [data-estado="error"])::before { background: oklch(0.6 0.2 25); }
@keyframes ce-pulso { 50% { opacity: 0.3; } }
.ce-avisos-boton { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; padding: 0.25rem 0.6rem; border: 0; border-radius: 999px;
  background: color-mix(in srgb, oklch(0.78 0.14 75) 22%, transparent); color: var(--texto); font: inherit; font-size: 0.78rem; cursor: pointer; }
.ce-avisos-boton .menu-icono { width: 0.95rem; height: 0.95rem; color: oklch(0.6 0.15 65); }
.ce-avisos { padding: 0.5rem 1rem; border-bottom: 1px solid var(--borde); background: color-mix(in srgb, oklch(0.8 0.13 80) 14%, var(--superficie)); font-size: 0.85rem; }
.ce-avisos ul { margin: 0; padding-left: 1.1rem; }
.ce-arriba-espacio { flex: 1; }
.ce-arriba-grupo { display: inline-flex; gap: 2px; }
.ce-conmutador { display: inline-flex; padding: 3px; border-radius: 0.7rem; background: var(--encima); }
.ce-conmutador button { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; padding: 0.3rem 0.6rem; border: 0; border-radius: 0.55rem; background: transparent;
  color: var(--texto-suave); font: inherit; font-size: 0.82rem; cursor: pointer; transition: background-color var(--mov-rapido) ease, color var(--mov-rapido) ease; }
.ce-conmutador button[aria-pressed="true"] { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.ce-conmutador .menu-icono { width: 1rem; height: 1rem; }

/* El cuerpo: el riel, el lienzo y el panel. El cajón del riel flota sobre el lienzo. */
.ce-cuerpo { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) minmax(17rem, 20rem); overflow: hidden; overflow: clip; }
.ce-riel { position: relative; z-index: 4; display: flex; flex-direction: column; gap: 0.25rem; padding: 0.6rem 0.4rem; border-right: 1px solid var(--borde); background: var(--superficie); }
.ce-riel-boton { display: grid; justify-items: center; gap: 0.25rem; margin: 0; padding: 0.55rem 0.15rem; border: 0; border-radius: 0.75rem; background: none;
  color: var(--texto-suave); font: inherit; font-size: 0.66rem; line-height: 1.15; cursor: pointer; transition: background-color var(--mov-rapido) ease, color var(--mov-rapido) ease; }
.ce-riel-boton .menu-icono { width: 1.25rem; height: 1.25rem; }
@media (hover: hover) and (pointer: fine) { .ce-riel-boton:hover { background: var(--encima); color: var(--texto); } }
.ce-riel-boton[aria-pressed="true"] { background: var(--activo); color: var(--texto); }

/* El cajón llega entero desde el riel (orientación: entra con --mov-lento y la curva de los cajones, sale con
   --mov-medio). Con movimiento reducido no se desliza: se funde. */
.ce-cajon {
  --dur: var(--mov-medio);
  position: absolute; top: 0; bottom: 0; left: 4.5rem; z-index: 3; width: 19.5rem; overflow-y: auto;
  border-right: 1px solid var(--borde); background: var(--superficie); box-shadow: 18px 0 36px -26px rgb(0 0 0 / 0.45);
  translate: calc(-100% * var(--mov-intensidad)) 0; visibility: hidden;
  transition: translate var(--dur) var(--curva-cajon), opacity var(--dur) ease, visibility 0s linear var(--dur);
}
.ce-cajon.is-open { --dur: var(--mov-lento); translate: 0 0; opacity: 1; visibility: visible; transition-delay: 0s; }
@media (prefers-reduced-motion: reduce) { .ce-cajon { opacity: 0; } .ce-cajon.is-open { opacity: 1; } }
.ce-cajon-cabeza { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem 0.5rem; background: var(--superficie); }
.ce-cajon-cabeza h3 { margin: 0; font-size: 1rem; }
.ce-cajon-cuerpo { display: grid; gap: 0.6rem; padding: 0.25rem 1rem 1.5rem; }
.ce-cajon-grupo { margin: 0.6rem 0 0; color: var(--texto-suave); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ce-cajon-grilla { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.ce-cajon-lista { display: grid; gap: 0.4rem; }
.ce-cajon-item { display: grid; justify-items: center; align-content: center; gap: 0.4rem; min-height: 4.5rem; margin: 0; padding: 0.6rem 0.3rem; border: 1px solid var(--borde);
  border-radius: 0.75rem; background: var(--superficie); color: var(--texto); font: inherit; font-size: 0.74rem; line-height: 1.2; text-align: center; cursor: grab;
  transition: border-color var(--mov-rapido) ease, background-color var(--mov-rapido) ease; }
.ce-cajon-item .menu-icono { width: 1.3rem; height: 1.3rem; color: var(--foco); }
@media (hover: hover) and (pointer: fine) { .ce-cajon-item:hover { border-color: color-mix(in srgb, var(--foco) 55%, var(--borde)); background: var(--encima); } }
.ce-cajon-item:active { cursor: grabbing; }
.ce-cajon-lista .ce-cajon-item { grid-template-columns: auto minmax(0, 1fr); justify-items: start; min-height: 0; padding: 0.6rem 0.75rem; font-size: 0.82rem; text-align: left; }
.ce-estructura { display: flex; gap: 3px; width: 100%; height: 1.15rem; }
.ce-estructura span { border-radius: 3px; background: color-mix(in srgb, var(--foco) 45%, transparent); }
.ce-secciones { display: grid; gap: 0.75rem; }
.ce-seccion { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem; align-items: start; }
.ce-seccion .ce-cajon-item { grid-template-columns: minmax(0, 1fr); justify-items: stretch; padding: 0.4rem 0.4rem 0.55rem; text-align: left; font-size: 0.82rem; }
.ce-seccion .ce-miniatura { height: 6rem; border-radius: 0.45rem; }
.ce-cajon .ce-plantillas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.ce-cajon .ce-plantilla .ce-miniatura { height: 7.5rem; }
.ce-cajon-vacio { display: grid; justify-items: center; gap: 0.4rem; padding: 2rem 0.5rem; text-align: center; color: var(--texto-suave); }
.ce-cajon-vacio p { margin: 0; }
.ce-cajon-vacio .menu-icono { width: 1.75rem; height: 1.75rem; color: var(--foco); }
.ce-version { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 0.05rem 0.6rem; width: 100%; margin: 0; padding: 0.55rem 0.6rem; border: 0; border-radius: 0.6rem;
  background: none; color: var(--texto); font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .ce-version:hover { background: var(--encima); } }
.ce-version-hora { grid-row: span 2; color: var(--texto-suave); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.ce-version-nombre { font-weight: 500; font-size: 0.9rem; }
.ce-version.tiene-nombre .ce-version-nombre { color: var(--texto-fuerte); font-weight: 650; }
.ce-version .ce-pista { grid-column: 2; font-size: 0.76rem; }
.ce-version-nombrar { display: flex; flex: 1; gap: 0.4rem; min-width: min(100%, 18rem); }
.ce-version-nombrar input { flex: 1; margin: 0; }

/* El lienzo: el fondo con puntos del tablero y, encima, el sobre (asunto y vista previa) y el correo. */
.ce-escenario-marco { position: relative; min-width: 0; min-height: 0; background: var(--lienzo-fondo);
  background-image: radial-gradient(var(--lienzo-puntos) 1px, transparent 1.2px); background-size: 18px 18px; }
.ce-escenario { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; padding: 1.5rem 2.75rem 5rem; overflow: auto; overscroll-behavior: contain; }
.ce-sobre { display: grid; gap: 0.4rem; width: min(100%, 37.5rem); }
.ce-sobre-fila { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto auto; align-items: center; gap: 0.5rem; padding: 0.3rem 0.35rem 0.3rem 0.85rem;
  border: 1px solid var(--borde); border-radius: 0.75rem; background: var(--superficie); transition: border-color var(--mov-rapido) ease; }
.ce-sobre-fila:focus-within { border-color: var(--foco); }
.ce-sobre-nombre { color: var(--texto-suave); font-size: 0.8rem; }
.ce-linea { min-height: 1.6em; padding: 0.15rem 0; overflow-x: auto; color: var(--texto); font-size: 0.92rem; white-space: nowrap; outline: none; scrollbar-width: none; }
.ce-linea.is-vacio::before { content: attr(data-placeholder); color: var(--texto-suave); pointer-events: none; }
.ce-contador { color: var(--texto-suave); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.ce-contador.is-largo { color: oklch(0.62 0.15 60); font-weight: 600; }

/* El correo, con sus propios colores. Su fondo exterior (el de la bandeja) se ve como un marco. */
.ce-email { position: relative; flex: none; max-width: 100%; margin: 0 auto; color-scheme: light; color: #333; line-height: 1.5; border-radius: 3px;
  box-shadow: 0 0 0 1.25rem var(--ce-fondo-correo, #f4f4f5), 0 1.25rem 3rem 0.5rem rgb(0 0 0 / 0.16);
  transition: width var(--mov-medio) var(--curva-suave); }
.ce-email.is-mobile { box-shadow: 0 0 0 0.6rem var(--ce-fondo-correo, #f4f4f5), 0 1rem 2.5rem 0.4rem rgb(0 0 0 / 0.16); }
.ce-email a { color: var(--ce-link); }
.ce-vacio { padding: 3.5rem 1rem; color: #6b7280; text-align: center; font-family: system-ui, sans-serif; }
.ce-vacio p { margin: 0 0 0.75rem; }
.ce-vacio .ce-boton-suave { background: #fff; color: #333; border-color: #d4d4d8; }
.ce-mas-final { display: flex; align-items: center; justify-content: center; gap: 0.4rem; width: 100%; margin: 0; padding: 0.7rem; border: 0;
  border-top: 1px dashed #c4b5fd; background: transparent; color: #6d5bd0; font: 500 0.82rem/1.2 system-ui, sans-serif; cursor: pointer; opacity: 0.75;
  transition: opacity var(--mov-rapido) ease, background-color var(--mov-rapido) ease; }
@media (hover: hover) and (pointer: fine) { .ce-mas-final:hover { opacity: 1; background: #f5f3ff; } }
.ce-mas-final .menu-icono { width: 1rem; height: 1rem; }

/* Secciones y bloques: un contorno al pasar, otro al elegirlos. */
.ce-seg { position: relative; outline: 1px dashed transparent; outline-offset: -1px; }
.ce-row { display: flex; }
.ce-cell { position: relative; min-width: 0; min-height: 2.75rem; box-sizing: border-box; }
.ce-seg.is-apilada > .ce-row { flex-direction: column; }
.ce-seg.is-apilada > .ce-row > .ce-cell { flex: 0 0 auto !important; width: 100%; }
.ce-block { position: relative; outline: 1px dashed transparent; outline-offset: -1px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .ce-seg:hover:not(:has(.ce-block:hover)) { outline-color: color-mix(in srgb, var(--foco) 45%, transparent); }
  .ce-block:hover { outline-color: color-mix(in srgb, var(--foco) 60%, transparent); }
}
.ce-seg.is-selected { z-index: 1; outline: 2px solid var(--foco); }
.ce-block.is-selected { z-index: 2; outline: 2px solid var(--foco); cursor: default; }
.ce-block:focus-visible { outline: 2px solid var(--foco); }
.ce-block.is-arrastrando, .ce-seg.is-arrastrando { opacity: 0.4; }
/* Oculto en este tamaño (Celular o Escritorio): se ve tenue y tachado, con su aviso. */
.ce-block.is-oculto > .ce-contenido, .ce-seg.is-oculto > .ce-row { opacity: 0.4; text-decoration: line-through; }
.ce-seg.is-oculto::before { content: attr(data-oculto); position: absolute; top: 0.35rem; left: 0.35rem; z-index: 1; padding: 0.05rem 0.45rem; border-radius: 999px;
  background: #1c1b19; color: #fff; font: 500 0.7rem/1.6 system-ui, sans-serif; }
.ce-celda-vacia { display: none; }
.ce-cell.is-vacia > .ce-celda-vacia { display: flex; align-items: center; justify-content: center; gap: 0.35rem; width: calc(100% - 0.8rem); margin: 0.4rem; padding: 1rem 0.5rem;
  border: 1.5px dashed #c4b5fd; border-radius: 0.5rem; background: #faf9ff; color: #6d5bd0; font: 500 0.82rem/1.2 system-ui, sans-serif; cursor: pointer; }
.ce-celda-vacia .menu-icono { width: 1rem; height: 1rem; }

/* Las herramientas del bloque (arriba a la derecha) y de la sección (arriba a la izquierda), al pasar o con lo elegido. */
.ce-herramientas { position: absolute; top: 0; right: 0; z-index: 4; display: flex; align-items: center; gap: 1px; padding: 2px; translate: 0 -100%;
  border-radius: 0.5rem 0.5rem 0 0; background: var(--foco); color: #fff; opacity: 0; pointer-events: none; transition: opacity var(--mov-rapido) ease; }
.ce-herramientas-seg { right: auto; left: 0; background: #2b2a33; }
.ce-herramientas .ce-herramienta { width: 1.75rem; height: 1.6rem; border-radius: 0.4rem; color: inherit; }
.ce-herramientas .ce-herramienta .menu-icono { width: 0.95rem; height: 0.95rem; }
@media (hover: hover) and (pointer: fine) { .ce-herramientas .ce-herramienta:hover { background: rgb(255 255 255 / 0.18); color: #fff; } }
.ce-herramientas-nombre { padding: 0 0.4rem 0 0.15rem; font: 500 0.72rem/1 system-ui, sans-serif; }
.ce-manija { cursor: grab; }
.ce-manija:active { cursor: grabbing; }
@media (hover: hover) and (pointer: fine) {
  .ce-block:hover > .ce-herramientas, .ce-seg:hover:not(:has(.ce-block:hover)) > .ce-herramientas { opacity: 1; pointer-events: auto; }
}
.ce-block.is-selected > .ce-herramientas, .ce-seg.is-selected > .ce-herramientas, .ce-block:focus-within > .ce-herramientas { opacity: 1; pointer-events: auto; }
/* El bloque que se está escribiendo esconde sus herramientas: la barra del texto ocupa ese lugar. */
.ce-block.is-selected:has(.ce-text-body:focus) > .ce-herramientas { opacity: 0; pointer-events: none; }

/* «＋» para agregar: debajo de cada bloque (al centro) y antes de cada sección (al costado). Aparecen al pasar. */
.ce-mas, .ce-mas-seg { position: absolute; z-index: 5; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; margin: 0; padding: 0; border-radius: 50%;
  cursor: pointer; opacity: 0; pointer-events: none; scale: calc(1 - 0.25 * var(--mov-intensidad));
  transition: opacity var(--mov-rapido) var(--curva-frena), scale var(--mov-rapido) var(--curva-frena); }
.ce-mas { bottom: 0; left: 50%; translate: -50% 50%; border: 2px solid #fff; background: var(--foco); color: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 0.22); }
.ce-mas-seg { top: 0; left: -2.15rem; translate: 0 -50%; border: 1px solid var(--borde); background: var(--superficie); color: var(--texto-suave); }
.ce-mas .menu-icono, .ce-mas-seg .menu-icono { width: 0.95rem; height: 0.95rem; }
@media (hover: hover) and (pointer: fine) {
  .ce-block:hover > .ce-mas, .ce-seg:hover > .ce-mas-seg, .ce-mas:focus-visible, .ce-mas-seg:focus-visible { opacity: 1; pointer-events: auto; scale: 1; }
}
.ce-block.is-selected > .ce-mas, .ce-seg.is-selected > .ce-mas-seg { opacity: 1; pointer-events: auto; scale: 1; }
.ce-block.is-selected:has(.ce-text-body:focus) > .ce-mas { opacity: 0; pointer-events: none; }

/* El contenido de cada tipo de bloque. */
.ce-contenido { position: relative; }
.ce-text-body { position: relative; min-height: 1.5em; overflow-wrap: anywhere; outline: none; }
/* El contorno ya lo pone el bloque elegido: el texto no suma otro al escribir. */
.ce-email .ce-text-body:focus, .ce-email .ce-text-body:focus-visible, .ce-linea:focus-visible { outline: none; }
.ce-text-body[contenteditable="true"] { cursor: text; }
.ce-text-body.is-vacio::before { content: 'Escribe algo, o «/» para agregar un bloque'; position: absolute; inset: 0 auto auto 0; color: #9ca3af; pointer-events: none; }
.ce-text-body p { margin: 0 0 0.6em; }
.ce-text-body > :last-child { margin-bottom: 0; }
.ce-text-body :is(ul, ol) { margin: 0 0 0.6em; padding-left: 1.4em; }
/* Los títulos con la letra, el color y el tamaño del correo, no los de la interfaz. */
.ce-email .ce-text-body :is(h1, h2, h3) { margin: 0.3em 0; color: inherit; font-family: var(--ce-titulos, inherit); letter-spacing: normal; line-height: 1.25; }
.ce-email .ce-text-body h1 { font-size: 2em; }
.ce-email .ce-text-body h2 { font-size: 1.5em; }
.ce-email .ce-text-body h3 { font-size: 1.17em; }
/* Una variable: un chip con su nombre («Nombre del cliente»); en el documento queda {{…}}. */
.ce-var { display: inline-block; margin: 0 0.05em; padding: 0 0.45em; border: 1px solid #d6ccfb; border-radius: 999px; background: #f1edfe; color: #4c3a9e;
  font: 500 0.84em/1.5 system-ui, sans-serif; text-decoration: none; vertical-align: baseline; white-space: nowrap; cursor: pointer; user-select: all; }
.ce-linea .ce-var { border-color: color-mix(in srgb, var(--foco) 40%, transparent); background: color-mix(in srgb, var(--foco) 16%, transparent); color: var(--texto); }
/* En un título el chip no crece con la letra: se lee como etiqueta, no como texto. */
.ce-text-body :is(h1, h2, h3) .ce-var { font-size: 0.6em; vertical-align: 0.2em; }
.ce-image-wrap img { max-width: 100%; height: auto; vertical-align: top; }
.ce-image-empty { display: grid; justify-items: center; gap: 0.5rem; padding: 1.5rem 0.75rem; border-radius: 0.4rem; background: #f1f1f4; color: #52525b;
  font: 0.85rem/1.4 system-ui, sans-serif; overflow-wrap: anywhere; }
.ce-image-empty .menu-icono { width: 1.6rem; height: 1.6rem; color: #a1a1aa; }
.ce-image-empty .ce-boton-suave { background: #fff; color: #3f3f46; border-color: #d4d4d8; }
.ce-button-face { display: inline-block; padding: 12px 24px; font-weight: 600; line-height: 1.2; }
.ce-button-face.is-full { display: block; text-align: center; }
.ce-divider-line { margin: 0 auto; }
.ce-spacer-box { display: flex; align-items: center; justify-content: center; color: #a1a1aa; font: 0.7rem system-ui, sans-serif;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgb(161 161 170 / 0.14) 6px 12px); }
.ce-social-row, .ce-menu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
/* Como en el correo: el ícono blanco sobre el color de la red. Sin link no sale: se ve tenue. */
.ce-social-row img { border-radius: 3px; }
.ce-social-row img.is-empty { opacity: 0.35; }
.ce-html-frame { display: block; width: 100%; height: 16rem; border: 0; background: #fff; pointer-events: none; }
.ce-drop-line { height: 4px; margin: -2px 0; border-radius: 2px; background: var(--foco); box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco) 28%, transparent); pointer-events: none; }

/* ---------- La barra del texto y sus globos ---------- */

/* Aparece al empezar a escribir: se ve decenas de veces al día, así que solo se funde (--mov-rapido). */
.ce-barra { position: fixed; z-index: 40; display: flex; align-items: center; gap: 1px; padding: 4px; border-radius: 0.75rem; background: #1c1b19; color: #f6efe6;
  box-shadow: 0 12px 30px -8px rgb(0 0 0 / 0.4); transition: opacity var(--mov-rapido) var(--curva-frena); }
@starting-style { .ce-barra { opacity: 0; } }
html[data-theme="dark"] .ce-barra { border: 1px solid rgb(255 255 255 / 0.12); background: #262a2b; }
.ce-barra-boton { display: grid; place-items: center; min-width: 1.95rem; height: 1.95rem; margin: 0; padding: 0 0.35rem; border: 0; border-radius: 0.45rem;
  background: none; color: inherit; font: 600 0.82rem/1 system-ui, sans-serif; cursor: pointer; }
.ce-barra-boton .menu-icono { width: 1rem; height: 1rem; }
@media (hover: hover) and (pointer: fine) { .ce-barra-boton:hover { background: rgb(255 255 255 / 0.12); } }
.ce-barra-boton[aria-pressed="true"] { background: rgb(255 255 255 / 0.22); color: #fff; }
.ce-barra-separador { width: 1px; height: 1.1rem; margin: 0 3px; background: rgb(255 255 255 / 0.2); }
.ce-globo { position: fixed; z-index: 41; width: min(20rem, calc(100vw - 1rem)); padding: 0.85rem; border: 1px solid var(--borde); border-radius: 0.85rem;
  background: var(--superficie); color: var(--texto); box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.35); }
.ce-globo-titulo { margin: 0 0 0.35rem; color: var(--texto-suave); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ce-globo-link { display: grid; gap: 0.5rem; }
.ce-globo-link input { margin: 0; }
.ce-globo-acciones { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.4rem; margin-top: 0.5rem; }
.ce-globo-color .ce-muestras + .ce-globo-titulo { margin-top: 0.6rem; }
.ce-muestras, .ce-colores { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.ce-muestra { flex: none; width: 1.6rem; height: 1.6rem; margin: 0; padding: 0; border: 2px solid var(--superficie); border-radius: 50%; box-shadow: 0 0 0 1px var(--borde); cursor: pointer;
  transition: box-shadow var(--mov-rapido) ease, scale var(--mov-instante) var(--curva-frena); }
.ce-muestra:active { scale: calc(1 - 0.08 * var(--mov-intensidad)); }
.ce-muestra[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--foco); }
.ce-muestra.es-ninguno { background: linear-gradient(135deg, #fff 45%, oklch(0.6 0.2 25) 45% 55%, #fff 55%); }
.ce-colores-separador { width: 1px; height: 1.2rem; margin: 0 0.15rem; background: var(--borde); }
/* En el panel, los colores en una sola fila. */
.ce-colores { gap: 0.3rem; }
.ce-colores .ce-muestra, .ce-colores .ce-color-propio::before, .ce-colores .ce-color-propio input { width: 1.4rem; height: 1.4rem; }
.ce-color-propio { position: relative; display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.82rem; cursor: pointer; }
.ce-color-propio::before { content: ''; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444); box-shadow: 0 0 0 1px var(--borde); }
.ce-color-propio input { position: absolute; inset: 0; width: 1.6rem; height: 1.6rem; margin: 0; padding: 0; opacity: 0; cursor: pointer; }

/* ---------- Los menús («＋», «/», «{») ---------- */

/* Crecen desde lo que los abrió (orientación, --mov-rapido, frenan al llegar); salen en el 75 % del tiempo. */
.ce-menu { position: fixed; z-index: 45; display: flex; flex-direction: column; width: 17.5rem; max-height: min(26rem, 70vh); padding: 0.4rem; border: 1px solid var(--borde);
  border-radius: 0.9rem; background: var(--superficie); color: var(--texto); box-shadow: 0 20px 44px -14px rgb(0 0 0 / 0.38);
  opacity: 0; scale: calc(1 - 0.05 * var(--mov-intensidad));
  transition: opacity calc(var(--mov-rapido) * 0.75) var(--curva-frena), scale calc(var(--mov-rapido) * 0.75) var(--curva-frena); }
.ce-menu.is-open { opacity: 1; scale: 1; transition-duration: var(--mov-rapido); }
.ce-menu-buscar { flex: none; margin: 0 0 0.3rem; padding: 0.45rem 0.6rem; border: 1px solid var(--borde); border-radius: 0.55rem; background: var(--superficie-baja); color: var(--texto); font-size: 0.88rem; }
.ce-menu-lista { display: grid; align-content: start; gap: 1px; overflow-y: auto; }
.ce-menu-grupo { margin: 0.5rem 0.55rem 0.15rem; color: var(--texto-suave); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ce-menu-opcion { display: flex; align-items: center; gap: 0.6rem; margin: 0; padding: 0.45rem 0.55rem; border: 0; border-radius: 0.5rem; background: none; color: inherit;
  font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; }
.ce-menu-opcion .menu-icono { color: var(--foco); }
.ce-menu-opcion[aria-selected="true"] { background: var(--encima); }
@media (hover: hover) and (pointer: fine) { .ce-menu-opcion:hover { background: var(--encima); } }
.ce-menu-pista { margin-left: auto; color: var(--texto-suave); font-size: 0.76rem; }
.ce-menu-vacio { margin: 0.5rem; color: var(--texto-suave); font-size: 0.85rem; }
.ce-menu-pie { display: grid; gap: 0.3rem; margin: 0.3rem 0 0; padding: 0.55rem 0.4rem 0.2rem; border-top: 1px solid var(--borde); color: var(--texto-suave); font-size: 0.8rem; }
.ce-menu-pie label { display: grid; gap: 0.3rem; margin: 0; }
.ce-menu-pie input { margin: 0; padding: 0.4rem 0.55rem; border: 1px solid var(--borde); border-radius: 0.5rem; background: var(--superficie); color: var(--texto); }
.ce-menu-acciones { display: flex; justify-content: flex-end; gap: 0.4rem; }
.ce-menu-chip { width: 15rem; }

/* ---------- El panel de lo elegido ---------- */

.ce-panel { z-index: 2; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-left: 1px solid var(--borde); background: var(--superficie); }
.ce-panel-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.9rem 1rem 0.6rem; }
.ce-panel-titulo { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1rem; }
.ce-panel-titulo .menu-icono { width: 1.1rem; height: 1.1rem; color: var(--foco); }
.ce-panel-cerrar { display: none; }
.ce-pestanas { display: flex; gap: 2px; margin: 0 1rem 0.6rem; padding: 3px; border-radius: 0.7rem; background: var(--encima); }
.ce-pestanas [role="tab"] { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; margin: 0; padding: 0.35rem 0.5rem; border: 0; border-radius: 0.55rem;
  background: none; color: var(--texto-suave); font: inherit; font-size: 0.85rem; cursor: pointer; transition: background-color var(--mov-rapido) ease, color var(--mov-rapido) ease; }
.ce-pestanas [role="tab"][aria-selected="true"] { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.ce-panel-cuerpo { flex: 1; display: grid; align-content: start; gap: 1rem; padding: 0.25rem 1rem 1.25rem; }
.ce-panel-pie { display: grid; gap: 0.6rem; padding: 0.8rem 1rem 1rem; border-top: 1px solid var(--borde); }
.ce-panel-pie:empty { display: none; }
.ce-panel-acciones { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ce-panel-acciones .ce-boton-suave { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.ce-campo { display: grid; gap: 0.4rem; margin: 0; }
.ce-campo-nombre { color: var(--texto-suave); font-size: 0.78rem; font-weight: 500; }
:is(.ce-panel, .ce-globo, .ce-dialogo) :is(input:not([type="range"]):not([type="color"]):not([type="checkbox"]):not([type="file"]), select, textarea) {
  margin: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--borde); border-radius: 0.55rem; background: var(--superficie); color: var(--texto); font-size: 0.9rem; }
:is(.ce-panel, .ce-globo, .ce-dialogo) :is(input, select, textarea):focus-visible { outline: 2px solid var(--foco); outline-offset: 0; border-color: transparent; }
.ce-rango { display: flex; align-items: center; gap: 0.6rem; }
.ce-rango input { flex: 1; margin: 0; padding: 0; accent-color: var(--foco); }
.ce-rango-valor { min-width: 3.2rem; color: var(--texto); font-size: 0.82rem; font-variant-numeric: tabular-nums; text-align: right; }
.ce-segmentado { display: inline-flex; width: fit-content; padding: 3px; border-radius: 0.6rem; background: var(--encima); }
.ce-segmentado button { display: inline-grid; place-items: center; min-width: 2.2rem; margin: 0; padding: 0.3rem 0.6rem; border: 0; border-radius: 0.45rem; background: none;
  color: var(--texto-suave); font: inherit; font-size: 0.82rem; cursor: pointer; }
.ce-segmentado button[aria-checked="true"] { background: var(--superficie); color: var(--texto); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.ce-segmentado .menu-icono { width: 1rem; height: 1rem; }
/* Interruptor: la perilla se desliza (cambio de estado, --mov-rapido). */
.ce-interruptor { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0; font-size: 0.88rem; }
.ce-interruptor input { appearance: none; position: relative; flex: none; width: 2.2rem; height: 1.3rem; margin: 0; border-radius: 999px; background: var(--borde); cursor: pointer;
  transition: background-color var(--mov-rapido) ease; }
.ce-interruptor input::before { content: ''; position: absolute; top: 0.15rem; left: 0.15rem; width: 1rem; height: 1rem; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: translate var(--mov-rapido) var(--curva-frena); }
.ce-interruptor input:checked { background: oklch(0.6 0.14 150); }
.ce-interruptor input:checked::before { translate: 0.9rem 0; }
.ce-galeria { display: grid; gap: 0.4rem; }
.ce-galeria-grilla { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3rem; }
.ce-galeria-imagen { aspect-ratio: 1; margin: 0; padding: 2px; border: 2px solid transparent; border-radius: 0.45rem; background: var(--superficie-baja); cursor: pointer; }
.ce-galeria-imagen[aria-pressed="true"] { border-color: var(--foco); }
.ce-galeria-imagen img { width: 100%; height: 100%; object-fit: contain; }
.ce-subir { justify-self: start; cursor: pointer; }
.ce-lista-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--borde); }
.ce-lista-item > :not(button) { grid-column: 1; }
.ce-lista-item > button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.ce-codigo { min-height: 12rem; font-family: ui-monospace, monospace !important; font-size: 0.8rem !important; }

/* ---------- Vista previa y Probar ---------- */

.ce-vista { width: min(72rem, calc(100vw - 2rem)); }
.ce-vista .ce-dialogo-cabeza { flex-wrap: wrap; }
.ce-vista-marco { display: flex; justify-content: center; padding: 1rem; border-radius: 0.8rem; background: var(--lienzo-fondo); }
.ce-vista-marco iframe { width: 100%; height: 66vh; border: 0; border-radius: 0.35rem; background: #fff; transition: width var(--mov-medio) var(--curva-suave); }
.ce-vista-marco[data-size="mobile"] iframe { width: 375px; max-width: 100%; border-radius: 1.6rem; box-shadow: 0 0 0 10px #1c1b19; }
.ce-probar { width: min(72rem, calc(100vw - 2rem)); }
.ce-probar-pestanas { flex-wrap: wrap; margin: 0 0 1rem; width: fit-content; max-width: 100%; }
.ce-probar-pestanas [role="tab"] { flex: 0 1 auto; }
.ce-probar-cuerpo { display: grid; gap: 0.6rem; }
.ce-probar-cuerpo > .ce-boton-suave { justify-self: start; }
.ce-cuenta { min-width: 1.3em; padding: 0 0.35em; border-radius: 999px; background: oklch(0.58 0.2 25); color: #fff; font-size: 0.72em; line-height: 1.5; text-align: center; }
.ce-probar-destino { display: flex; gap: 0.5rem; }
.ce-probar-destino input { flex: 1; }
.ce-muestras-valores { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--borde); }
.ce-muestras-valores summary { font-weight: 600; cursor: pointer; }
.ce-muestras-valores .ce-campo { max-width: 32rem; margin: 0.6rem 0; }
.ce-aviso { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0; padding: 0.55rem 0.8rem; border-left: 4px solid var(--borde);
  border-radius: 0.55rem; background: var(--encima); }
.ce-aviso.es-bien { border-left-color: oklch(0.6 0.14 150); }
.ce-aviso.es-ojo { border-left-color: oklch(0.75 0.15 70); }
.ce-aviso.es-mal { border-left-color: oklch(0.6 0.2 25); }
.ce-puntos { font-weight: 700; white-space: nowrap; }
.ce-bandeja-fila { display: flex; align-items: baseline; gap: 1rem; padding: 0.6rem 0.8rem; overflow: hidden; border: 1px solid #e4e4e7; border-radius: 0.55rem;
  background: #fff; color: #202124; color-scheme: light; }
.ce-bandeja-fila strong { flex: 0 0 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-bandeja-linea { flex: 1; min-width: 0; overflow: hidden; color: #5f6368; text-overflow: ellipsis; white-space: nowrap; }
.ce-bandeja-linea b { color: #202124; }
.ce-clientes { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.ce-cliente { margin: 0; text-align: center; }
.ce-cliente iframe { width: 100%; height: 26rem; border: 1px solid var(--borde); border-radius: 0.55rem; background: #fff; }
.ce-cliente.is-mobile iframe { max-width: 20rem; }
.ce-cliente figcaption { margin-top: 0.25rem; color: var(--texto-suave); font-size: 0.85em; }
.ce-texto-plano { max-height: 20rem; overflow: auto; font-size: 0.85em; white-space: pre-wrap; }
.ce-links { width: 100%; }
.ce-link-url { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-pildora { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--encima); font-size: 0.8em; }
.ce-pildora.es-ok { background: color-mix(in srgb, oklch(0.6 0.14 150) 20%, transparent); }
.ce-pildora.es-warn { background: color-mix(in srgb, oklch(0.75 0.15 70) 25%, transparent); }
.ce-pildora.es-bad { background: color-mix(in srgb, oklch(0.6 0.2 25) 22%, transparent); }
.ce-spam { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 0.8rem; border-radius: 0.6rem; background: var(--encima); }
.ce-spam strong { font-size: 1.5em; }
.ce-spam meter { flex: 1; min-width: 8rem; height: 1rem; }

/* ---------- La barra de abajo (solo en el celular) ---------- */

.ce-abajo { display: none; }

/* ---------- Pantallas angostas ---------- */

/* En escritorio, el tirador del menú del espacio queda sobre el borde izquierdo del editor: el riel le deja su lugar. */
@media (min-width: 56.01rem) {
  .ce-cuerpo { grid-template-columns: 5.9rem minmax(0, 1fr) minmax(17rem, 20rem); }
  .ce-riel { padding-left: 1.65rem; }
  .ce-cajon { left: 5.9rem; }
}
@media (min-width: 56.01rem) and (max-width: 1100px) {
  .ce-cuerpo { grid-template-columns: 5.9rem minmax(0, 1fr) 17rem; }
  .ce-escenario { padding-inline: 2.5rem; }
}

/* En el celular el editor funciona sin arrastrar: «＋ Agregar» abajo, subir y bajar en las herramientas, y el riel y el
   panel como hojas que suben desde abajo (cajón: --mov-lento al entrar, --mov-medio al salir). */
@media (max-width: 760px) {
  .ce-ancho-solo { display: none; }
  .ce-arriba { gap: 0.25rem; min-height: 3.25rem; padding: 0.4rem 0.5rem; }
  .ce-nombre { min-width: 4rem; max-width: 40vw; font-size: 0.95rem; }
  .ce-estado { font-size: 0; gap: 0; }
  .ce-avisos-boton { padding: 0.25rem 0.45rem; }
  .ce-estado::before { width: 0.55rem; height: 0.55rem; }
  .ce-arriba .ce-boton-suave, .ce-arriba .ce-boton-principal { padding: 0.45rem 0.6rem; }
  .ce-conmutador { display: none; }
  .ce-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .ce-riel { display: none; }
  .ce-escenario { padding: 1rem 0.75rem 2rem; }
  .ce-sobre-fila { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 0.1rem; padding-left: 0.7rem; }
  .ce-sobre-nombre { grid-column: 1 / -1; font-size: 0.72rem; }
  .ce-mas-seg { left: 0.35rem; }
  .ce-panel, .ce-cajon {
    --dur: var(--mov-medio);
    position: fixed; top: auto; right: 0; bottom: 0; left: 0; z-index: 30; width: auto; max-height: 72dvh; border: 0; border-top: 1px solid var(--borde);
    border-radius: 1.1rem 1.1rem 0 0; box-shadow: 0 -18px 44px -12px rgb(0 0 0 / 0.38);
    translate: 0 calc(100% * var(--mov-intensidad)); visibility: hidden;
    transition: translate var(--dur) var(--curva-cajon), opacity var(--dur) ease, visibility 0s linear var(--dur);
  }
  #email-editor.panel-abierto .ce-panel, .ce-cajon.is-open { --dur: var(--mov-lento); translate: 0 0; visibility: visible; transition-delay: 0s; }
  .ce-panel-cerrar { display: inline-grid; }
  .ce-abajo { display: flex; padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); background: var(--superficie); }
  .ce-abajo button { flex: 1; display: grid; justify-items: center; gap: 0.15rem; margin: 0; padding: 0.35rem 0.1rem; border: 0; border-radius: 0.6rem; background: none;
    color: var(--texto-suave); font: inherit; font-size: 0.68rem; cursor: pointer; }
  .ce-abajo .menu-icono { width: 1.25rem; height: 1.25rem; }
  .ce-barra { left: 0 !important; right: 0; top: auto !important; justify-content: flex-start; overflow-x: auto; border-radius: 0; scrollbar-width: none; }
  .ce-dialogo { padding: 0.9rem; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .ce-panel, .ce-cajon { opacity: 0; }
  #email-editor.panel-abierto .ce-panel, .ce-cajon.is-open { opacity: 1; }
}
/* Con el dedo no hay arrastre ni hover: las herramientas de lo elegido son más grandes y la manilla no está. */
@media (pointer: coarse) {
  .ce-herramientas .ce-herramienta { width: 2.2rem; height: 2.1rem; }
  .ce-manija { display: none; }
  .ce-mas, .ce-mas-seg { width: 2rem; height: 2rem; }
}
