/* =======================================================================
   IMALYN — sistema de diseño "vector-art retro-futurista"
   -----------------------------------------------------------------------
   Estética: instrumento CAD / mesa de trazado. Fondo de tinta oscura con
   rejilla blueprint, nodos de ancla y curvas bézier como motivo, marcas de
   registro tipo imprenta y un acento lima ácido contra cian y magenta.
   Tipografía: Chakra Petch (display técnico) + Space Mono (lecturas).
   Este archivo es autónomo (NO depende de assets/style.css, que sigue
   sirviendo a editor.php / admin.php sin tocarlos).
   ======================================================================= */

:root {
    /* --- Tinta y superficies --- */
    --ink:        #07090f;
    --ink-2:      #0a0d18;
    --panel:      rgba(16, 20, 34, 0.72);
    --panel-2:    rgba(20, 25, 42, 0.55);
    --hair:       rgba(122, 162, 255, 0.14);   /* línea hairline tenue */
    --hair-2:     rgba(122, 162, 255, 0.26);
    --grid:       rgba(110, 150, 255, 0.06);

    /* --- Acentos --- */
    --lime:       #c8ff2e;   /* acción principal: "vectorizar" */
    --lime-2:     #d8ff63;
    --on-lime:    #0a0e06;
    --cyan:       #38e8ff;   /* estructura / etiquetas / nodos */
    --magenta:    #ff3d7f;   /* recorte / alertas (continúa el divisor del editor) */

    /* --- Texto --- */
    --text:       #e9edff;
    --muted:      #939cc4;
    --subtle:     #5b6489;

    /* --- Forma --- */
    --radius:     14px;
    --radius-sm:  8px;
    --notch:      12px;       /* tamaño del bisel HUD en esquinas */

    --shadow:     0 30px 80px -30px rgba(0, 0, 0, 0.9);
    --glow-lime:  0 0 0 1px rgba(200, 255, 46, 0.35), 0 10px 40px -10px rgba(200, 255, 46, 0.45);
    --glow-cyan:  0 0 24px -6px rgba(56, 232, 255, 0.55);

    /* Alias para markup heredado que referencia estos nombres en estilos
       inline (p. ej. el spinner de "Generando con IA" usa var(--primary)). */
    --primary:       #c8ff2e;
    --text-on-dark:  #e9edff;

    --header-h:   64px;
    --font-disp:  "Chakra Petch", "Segoe UI", system-ui, sans-serif;
    --font-mono:  "Space Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-disp);
    color: var(--text);
    background-color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    /* Sin zoom de doble-toque en móvil (la web es tipo app; el único zoom
       permitido es el de los lienzos del vectorizador). Ver no-zoom.js. */
    touch-action: manipulation;
    /* Resplandores de ambiente: lima arriba-derecha, magenta abajo-izq. */
    background-image:
        radial-gradient(1100px 620px at 78% -8%, rgba(60, 92, 200, 0.20), transparent 60%),
        radial-gradient(900px 600px at 0% 105%, rgba(255, 61, 127, 0.07), transparent 55%),
        radial-gradient(700px 500px at 100% 100%, rgba(56, 232, 255, 0.06), transparent 60%);
    background-attachment: fixed;
}

/* Rejilla blueprint, fija detrás de todo y difuminada en los bordes. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask: radial-gradient(ellipse 110% 90% at 50% 25%, #000 35%, transparent 100%);
            mask: radial-gradient(ellipse 110% 90% at 50% 25%, #000 35%, transparent 100%);
}

/* Grano sutil opcional encima de todo (textura analógica). */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--lime); color: var(--on-lime); }

/* =======================================================================
   Tipografía base
   ======================================================================= */

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }

/* Etiqueta de sección estilo plano técnico: "01 — ENTRADA" con nodo. */
.im-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cyan);
    margin: 0 0 18px;
}
.im-eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
    /* Cuadrado = nodo de ancla del editor vectorial. */
}

.im-mono { font-family: var(--font-mono); }

/* =======================================================================
   Botones (sistema compartido con la app y la cabecera de auth)
   ======================================================================= */

.btn {
    --b-bg: transparent;
    --b-fg: var(--text);
    --b-bd: var(--hair-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 20px;
    font-family: var(--font-disp);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--b-fg);
    background: var(--b-bg);
    border: 1px solid var(--b-bd);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: transform .08s ease, background .16s ease, border-color .16s ease,
                color .16s ease, box-shadow .2s ease, opacity .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: 0.55; pointer-events: none; }

/* Primario lima — el CTA "vectorizar / empezar". */
.btn--primary {
    --b-bg: var(--lime);
    --b-fg: var(--on-lime);
    --b-bd: var(--lime);
    font-weight: 700;
    box-shadow: var(--glow-lime);
    position: relative;
    overflow: hidden;
}
.btn--primary::after {   /* destello que barre al pasar el ratón */
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
    transform: skewX(-18deg);
    transition: left .55s ease;
}
.btn--primary:hover { --b-bg: var(--lime-2); --b-bd: var(--lime-2); transform: translateY(-1px); }
.btn--primary:hover::after { left: 130%; }

/* Cian translúcido — acción secundaria. */
.btn--cyan {
    --b-bg: rgba(56, 232, 255, 0.08);
    --b-fg: var(--cyan);
    --b-bd: rgba(56, 232, 255, 0.42);
}
.btn--cyan:hover { --b-bg: rgba(56, 232, 255, 0.16); box-shadow: var(--glow-cyan); }

/* Fantasma — bordes hairline sobre la tinta. */
.btn--ghost { --b-bg: transparent; --b-fg: var(--text); --b-bd: var(--hair-2); }
.btn--ghost:hover { --b-bd: var(--cyan); --b-fg: var(--cyan); }

.btn--neutral { --b-bg: var(--panel); --b-fg: var(--text); --b-bd: var(--hair-2); }
.btn--neutral:hover { --b-bd: var(--cyan); }

.btn--block { width: 100%; padding: 16px 22px; text-transform: uppercase; letter-spacing: 0.08em; }
.btn--sm  { padding: 7px 12px; font-size: 12.5px; }
.btn--lg  { padding: 16px 30px; font-size: 16px; }

/* Botón "Continuar con Google": blanco, según las pautas de marca de Google. */
.btn--google { --b-bg: #ffffff; --b-fg: #1f2330; --b-bd: #dadce0; text-transform: none; letter-spacing: 0; gap: 11px; }
.btn--google:hover { --b-bg: #f6f8fb; --b-bd: #c6cad1; }
.btn--google svg { width: 18px; height: 18px; flex: none; }

/* Separador "o" entre el formulario y el botón social. */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0;
    color: var(--muted); font-size: 12px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--hair); }

.btn .spinner { width: 15px; height: 15px; border-width: 2px; }

/* =======================================================================
   Cabecera / navegación
   ======================================================================= */

.im-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 clamp(16px, 4vw, 48px);
    background: rgba(7, 9, 15, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hair);
}
.im-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.02em;
}
.im-brand__mark { width: 26px; height: 26px; display: block; flex-shrink: 0; }
.im-brand b { font-weight: 700; }
.im-brand span { color: var(--lime); }
.im-nav__spacer { flex: 1; }
.im-nav__links { display: flex; gap: 26px; align-items: center; }
.im-nav__links a {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
    transition: color .15s ease;
}
.im-nav__links a:hover { color: var(--text); }
.im-nav__cta { display: flex; gap: 10px; align-items: center; }

/* Selector de idioma (ES · EN · FR) — i18n.php imalyn_lang_switcher() */
.im-lang {
    display: inline-flex; align-items: center; gap: 1px;
    border: 1px solid var(--hair-2); border-radius: 999px; overflow: hidden;
    background: rgba(122,162,255,0.05);
}
.im-lang__opt {
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
    color: var(--subtle); text-decoration: none; padding: 5px 9px; line-height: 1;
    transition: color .15s ease, background .15s ease;
}
.im-lang__opt:hover { color: var(--text); background: rgba(122,162,255,0.10); }
.im-lang__opt.is-active { color: var(--on-lime); background: var(--lime); font-weight: 700; }

/* Chip de usuario (auth_header_menu) */
.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--cyan);
    padding: 6px 12px;
    border: 1px solid rgba(56, 232, 255, 0.3);
    border-radius: 999px;
    background: rgba(56, 232, 255, 0.06);
}

/* Menú de cabecera de la app (auth_header_menu): en línea en escritorio; en
   móvil se pliega tras una hamburguesa ☰ que abre un desplegable (.is-open por
   JS inline). El selector de idioma queda SIEMPRE visible fuera del .hmenu. */
.hmenu { display: inline-flex; align-items: center; }
.hmenu__panel { display: flex; align-items: center; gap: 8px; }
.hmenu__btn {
    display: none;            /* oculto en escritorio; visible en móvil */
    align-items: center; justify-content: center;
    width: 42px; height: 36px; padding: 0; cursor: pointer;
    border: 1px solid var(--hair-2); border-radius: 10px;
    background: var(--panel-2); color: var(--text);
}
.hmenu__bars { position: relative; }
.hmenu__bars, .hmenu__bars::before, .hmenu__bars::after {
    display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor;
}
.hmenu__bars::before, .hmenu__bars::after { content: ""; position: absolute; left: 0; }
.hmenu__bars::before { top: -6px; }
.hmenu__bars::after  { top: 6px; }
/* En la landing el .hmenu envuelve los enlaces de sección (estilo enlace, no
   botón); en escritorio conservan su separación amplia. */
.im-nav__hmenu .hmenu__panel { gap: 26px; }

@media (max-width: 760px) {
    .im-nav__links { display: none; }
    /* El chip "👤 usuario" ensancha la barra y la hacía desbordar >100% en
       móvil. El nombre sigue visible en Cuenta; aquí lo ocultamos en TODAS
       las cabeceras (pública .im-nav y de la app .app__header). */
    .auth-chip { display: none; }
    /* La barra pública pasa a poder envolver en pantallas estrechas en vez
       de desbordar horizontalmente. */
    .im-nav {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-h);
        row-gap: 8px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .im-nav__cta { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

    /* Cabecera de la app: los enlaces (Cuenta/Contacto/Admin/Salir) se pliegan
       tras la hamburguesa para no apilar varias filas de botones en móvil. */
    .hmenu { position: relative; }
    .hmenu__btn { display: inline-flex; }
    .hmenu__panel { display: none; }
    .hmenu.is-open .hmenu__btn { border-color: var(--lime); color: var(--lime); }
    .hmenu.is-open .hmenu__panel {
        display: flex; flex-direction: column; align-items: stretch; gap: 6px;
        position: absolute; top: calc(100% + 10px); right: 0; z-index: 90;
        min-width: 190px; padding: 10px;
        background: var(--panel); border: 1px solid var(--hair-2); border-radius: 12px;
        box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.7);
    }
    .hmenu.is-open .hmenu__panel .btn { width: 100%; justify-content: flex-start; }
    /* El chip de usuario, oculto en la barra en móvil, sí se muestra dentro del
       desplegable (ahí no hace desbordar nada y da contexto de la sesión). */
    .hmenu.is-open .hmenu__panel .auth-chip { display: inline-flex; width: 100%; }
    /* Enlaces de sección de la landing dentro del desplegable: tamaño táctil. */
    .im-nav__hmenu .hmenu__panel a { width: 100%; padding: 9px 6px; }

    /* La hamburguesa del menú de la app SIEMPRE en la esquina superior derecha,
       aunque las acciones (Restaurar/Guardar/descargas…) envuelvan en varias
       filas: estaba al FINAL del flujo de .app__actions y quedaba abajo-derecha
       tras los demás botones. La sacamos del flujo y la anclamos arriba-derecha;
       reservamos hueco a la derecha de las acciones para que no se solapen.
       (Sólo .app__header — la nav pública .im-nav no se toca.) */
    /* z-index alto: .app es position:relative + z-index:1 (contexto de
       apilamiento), y la cabecera lleva backdrop-filter (otro contexto), así
       que el desplegable de la hamburguesa quedaba atrapado y el canvas lo
       tapaba. Subir la cabecera la saca por encima del cuerpo. */
    .app__header { position: relative; z-index: 200; }
    .app__header .hmenu {
        position: absolute; top: 9px; right: clamp(16px, 3vw, 28px); z-index: 91;
    }
    .app__header .app__actions { padding-right: 50px; }
}

/* =======================================================================
   Contenedor / layout de página pública
   ======================================================================= */

.im-page { position: relative; z-index: 1; }
.im-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* Solo padding vertical en longhand: el shorthand "… 0" reseteaba el padding
   horizontal que aporta .im-wrap (las secciones llevan ambas clases), dejando
   el texto pegado al borde en móvil. */
.im-section { padding-top: clamp(64px, 9vw, 130px); padding-bottom: clamp(64px, 9vw, 130px); position: relative; z-index: 1; }

/* =======================================================================
   Hero
   ======================================================================= */

.im-hero {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
    padding-top: clamp(56px, 8vw, 104px);
    padding-bottom: clamp(40px, 6vw, 80px);
}
.im-hero__title {
    font-size: clamp(40px, 6.4vw, 82px);
    line-height: 0.98;
    letter-spacing: -0.035em;
}
.im-hero__title em {
    font-style: normal;
    color: var(--lime);
    text-shadow: 0 0 40px rgba(200, 255, 46, 0.35);
}
.im-hero__lead {
    margin: 26px 0 34px;
    font-size: clamp(16px, 1.7vw, 19px);
    color: var(--muted);
    max-width: 30em;
    line-height: 1.6;
}
.im-hero__cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.im-hero__note {
    margin-top: 18px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--subtle);
    letter-spacing: 0.02em;
}
.im-hero__note b { color: var(--lime); font-weight: 700; }

/* Visual del hero: marco "viewport" con la transformación raster→vector. */
.im-viewport {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--hair-2);
    border-radius: var(--radius);
    background:
        linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 28px,
        var(--ink-2);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: im-rise .8s cubic-bezier(.2,.7,.2,1) both;
}
.im-viewport svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Marcas de registro en las 4 esquinas del viewport (motivo imprenta). */
.im-cropmarks span {
    position: absolute;
    width: 22px; height: 22px;
    z-index: 3;
    pointer-events: none;
}
.im-cropmarks span::before,
.im-cropmarks span::after {
    content: ""; position: absolute; background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}
.im-cropmarks span::before { width: 22px; height: 1.5px; top: 0; }
.im-cropmarks span::after  { width: 1.5px; height: 22px; left: 0; }
.im-cropmarks .tl { top: 12px; left: 12px; }
.im-cropmarks .tr { top: 12px; right: 12px; transform: scaleX(-1); }
.im-cropmarks .bl { bottom: 12px; left: 12px; transform: scaleY(-1); }
.im-cropmarks .br { bottom: 12px; right: 12px; transform: scale(-1); }

/* --- Demo antes/después dentro del viewport del hero -------------------
   Izquierda = PNG pixelado ("raster"); derecha = SVG nítido ("vector"),
   recortado con clip-path desde el JS. Demuestra el producto en 1 vistazo. */
.im-demo { position: absolute; inset: 0; overflow: hidden; cursor: ew-resize; z-index: 2; touch-action: pan-y;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.im-demo img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.im-demo__layer { position: absolute; inset: 0; }
.im-demo__layer img, .im-demo__layer svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.im-demo__before img { image-rendering: pixelated; }
.im-demo__after { z-index: 2; clip-path: inset(0 0 0 50%); will-change: clip-path; }
.im-demo__bar {
    position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; z-index: 3;
    background: var(--lime); box-shadow: 0 0 12px rgba(200,255,46,.6); transform: translateX(-1px);
}
.im-demo__handle {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border-radius: 50%; background: var(--lime); color: var(--on-lime);
    display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
    cursor: ew-resize; box-shadow: 0 6px 20px rgba(0,0,0,.55); touch-action: none;
    animation: im-demo-pulse 2.4s ease-in-out 1.2s 2;
}
@keyframes im-demo-pulse {
    0%,100% { box-shadow: 0 6px 20px rgba(0,0,0,.55), 0 0 0 0 rgba(200,255,46,.5); }
    50%     { box-shadow: 0 6px 20px rgba(0,0,0,.55), 0 0 0 10px rgba(200,255,46,0); }
}
.im-demo__tag {
    position: absolute; bottom: 12px; z-index: 4; font-family: var(--font-mono); font-size: 11px;
    letter-spacing: .08em; padding: 4px 9px; border-radius: 999px; background: rgba(7,9,15,.72);
    border: 1px solid var(--hair-2); color: var(--text); pointer-events: none; backdrop-filter: blur(4px);
}
.im-demo__tag--l { left: 12px; }
.im-demo__tag--r { right: 12px; color: var(--lime); border-color: rgba(200,255,46,.4); }

/* --- Selector de ejemplos del hero (demo simulada, sin coste) ----------
   El wrapper agrupa el viewport + el selector; el rise lo lleva el wrapper,
   así que el viewport no debe re-animarse por su cuenta. */
.im-hero__demo { display: flex; flex-direction: column; }
.im-hero__demo .im-viewport { animation: none; }
.im-demo-picker { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.im-demo-picker__label {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .07em;
    color: var(--subtle); text-transform: uppercase;
}
.im-demo-picker__items { display: flex; gap: 10px; }
.im-demo-pick {
    width: 58px; height: 58px; padding: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
    border: 1px solid var(--hair); background: var(--ink-2);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.im-demo-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.im-demo-pick:hover { border-color: var(--hair-2); transform: translateY(-2px); }
.im-demo-pick.is-active { border-color: var(--lime); box-shadow: var(--glow-lime); }

/* --- Galería "Hecho con Imalyn" --------------------------------------- */
.im-gallery {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px; margin-top: 44px;
}
.im-gallery__item {
    aspect-ratio: 1 / 1; border: 1px solid var(--hair); border-radius: var(--radius);
    background: var(--ink-2); display: flex; align-items: center; justify-content: center;
    padding: 16%; position: relative; overflow: hidden;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.im-gallery__item:hover { border-color: var(--hair-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.im-gallery__item svg { width: 100%; height: 100%; }
.im-gallery__item span {
    position: absolute; left: 10px; bottom: 8px; font-family: var(--font-mono);
    font-size: 10.5px; letter-spacing: .06em; color: var(--subtle); text-transform: uppercase;
}
/* Variante a sangre: las ilustraciones ricas llenan la celda (más color). */
.im-gallery__item--img { padding: 0; }
.im-gallery__item--img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.im-gallery__item--img span {
    color: #fff; background: rgba(7,9,15,.62); padding: 3px 9px; border-radius: 999px;
    backdrop-filter: blur(4px); left: 8px; bottom: 8px;
}

/* --- FAQ (acordeón) --------------------------------------------------- */
.im-faq { max-width: 760px; margin: 44px auto 0; display: flex; flex-direction: column; gap: 10px; }
.im-faq__item { border: 1px solid var(--hair); border-radius: var(--radius-sm); background: var(--panel-2); overflow: hidden; }
.im-faq__item summary {
    cursor: pointer; padding: 16px 18px; font-weight: 600; color: var(--text);
    list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.im-faq__item summary::-webkit-details-marker { display: none; }
.im-faq__item summary::after { content: "+"; color: var(--lime); font-family: var(--font-mono); font-size: 20px; line-height: 1; flex: none; }
.im-faq__item[open] summary::after { content: "\2212"; }
.im-faq__item p { margin: 0; padding: 0 18px 16px; color: var(--muted); line-height: 1.65; font-size: 14.5px; }
.im-faq__item a { color: var(--cyan); }

@media (max-width: 880px) {
    .im-hero { grid-template-columns: 1fr; }
    .im-viewport { max-width: 460px; }
}

/* =======================================================================
   Tira de "cómo funciona"
   ======================================================================= */

.im-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 44px;
}
.im-step {
    position: relative;
    padding: 28px 24px;
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    background: var(--panel);
    /* Bisel HUD en la esquina superior derecha. */
    clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% 100%, 0 100%);
}
.im-step__n {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--lime);
    letter-spacing: 0.1em;
}
.im-step h3 { font-size: 20px; margin: 14px 0 8px; }
.im-step p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

@media (max-width: 760px) { .im-steps { grid-template-columns: 1fr; } }

.im-section__head { max-width: 640px; margin-bottom: 8px; }
.im-section__title { font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.03em; }
.im-section__sub { margin: 16px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

/* =======================================================================
   Precios
   ======================================================================= */

.im-pricing {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-top: 52px;
    align-items: stretch;
}
.im-plan {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 32px 28px;
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color .2s ease, transform .2s ease, box-shadow .25s ease;
}
.im-plan:hover { transform: translateY(-4px); border-color: var(--hair-2); }
.im-plan--featured {
    border-color: rgba(200, 255, 46, 0.5);
    box-shadow: var(--glow-lime);
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(200,255,46,0.08), transparent 60%),
        var(--panel);
}
.im-plan__tag {
    position: absolute;
    top: -12px; left: 28px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--on-lime);
    background: var(--lime);
    padding: 4px 12px;
    border-radius: 999px;
    box-shadow: var(--glow-lime);
}
.im-plan__name {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cyan);
}
.im-plan__price { display: flex; align-items: baseline; gap: 6px; margin: 18px 0 4px; }
.im-plan__price b { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; }
.im-plan__price span { color: var(--muted); font-size: 15px; }
.im-plan__price--free b { color: var(--text); }
.im-plan__sub { color: var(--subtle); font-size: 13px; margin: 0 0 22px; font-family: var(--font-mono); }
.im-plan__features { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.im-plan__features li {
    display: flex; gap: 11px; align-items: flex-start;
    font-size: 14.5px; color: var(--text);
}
.im-plan__features li::before {
    content: "";
    flex-shrink: 0;
    width: 16px; height: 16px;
    margin-top: 2px;
    background: var(--lime);
    /* Checkmark recortado con clip-path (forma vectorial, sin fuente). */
    clip-path: polygon(42% 70%, 82% 22%, 92% 32%, 42% 92%, 10% 56%, 20% 46%);
}
.im-plan--free .im-plan__features li::before { background: var(--cyan); }
.im-plan__features li small { color: var(--muted); }

@media (max-width: 880px) { .im-pricing { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; } }

.im-fairuse {
    margin-top: 34px;
    padding: 20px 22px;
    border: 1px dashed var(--hair-2);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.65;
    background: var(--panel-2);
}
.im-fairuse a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }

/* =======================================================================
   CTA final
   ======================================================================= */

.im-cta-band {
    text-align: center;
    border: 1px solid var(--hair-2);
    border-radius: var(--radius);
    padding: clamp(40px, 6vw, 72px);
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(200,255,46,0.07), transparent 55%),
        var(--panel);
    position: relative;
    overflow: hidden;
}
.im-cta-band h2 { font-size: clamp(28px, 4.5vw, 48px); letter-spacing: -0.03em; }
.im-cta-band p { color: var(--muted); margin: 16px auto 30px; max-width: 44ch; }

/* =======================================================================
   Pie
   ======================================================================= */

.im-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--hair);
    padding: 44px 0 56px;
    margin-top: 40px;
}
.im-footer__row { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.im-footer__links { display: flex; gap: 22px; flex-wrap: wrap; }
.im-footer__links a { color: var(--muted); font-size: 13.5px; }
.im-footer__links a:hover { color: var(--cyan); }
.im-footer__legal { margin-top: 22px; font-family: var(--font-mono); font-size: 12px; color: var(--subtle); line-height: 1.7; }
.im-footer__legal b { color: var(--muted); }
.im-footer__social { display: flex; gap: 12px; align-items: center; }
.im-footer__social a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--hair); border-radius: 10px;
    color: var(--muted); transition: color .15s, border-color .15s, background .15s;
}
.im-footer__social a:hover { color: var(--lime); border-color: var(--lime); }
.im-footer__social svg { width: 19px; height: 19px; }

/* =======================================================================
   Texto legal (términos)
   ======================================================================= */

.im-legal { max-width: 760px; margin: 0 auto; padding: clamp(48px, 7vw, 96px) 0; }
.im-legal h1 { font-size: clamp(30px, 5vw, 48px); margin-bottom: 10px; }
.im-legal .im-eyebrow { margin-bottom: 26px; }
.im-legal h2 { font-size: 22px; margin: 38px 0 12px; color: var(--text); }
.im-legal p { color: var(--muted); line-height: 1.75; margin: 0 0 16px; }
.im-legal__clause {
    border-left: 2px solid var(--lime);
    padding: 18px 22px;
    background: var(--panel-2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    line-height: 1.75;
    font-size: 15px;
}

/* =======================================================================
   Spinner (compartido)
   ======================================================================= */

.spinner {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(122, 162, 255, 0.18);
    border-top-color: var(--lime);
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.spinner--xl { width: 76px; height: 76px; border-width: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =======================================================================
   Autenticación / formularios (registro, login, y campos de la app)
   ======================================================================= */

.im-authwrap {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - var(--header-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 18px;
}
.im-authcard {
    width: 100%;
    max-width: 440px;
    background: var(--panel);
    border: 1px solid var(--hair-2);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: var(--shadow);
    /* Bisel HUD arriba-derecha, como los pasos. */
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
    animation: im-rise .6s cubic-bezier(.2,.7,.2,1) both;
}
.im-authcard__head { margin-bottom: 26px; }
.im-authcard__head h1 { font-size: 28px; letter-spacing: -0.02em; }
.im-authcard__head p { color: var(--muted); margin: 10px 0 0; font-size: 14.5px; }

.im-field { margin-bottom: 18px; }
.im-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}
.im-input {
    width: 100%;
    padding: 13px 15px;
    font-family: var(--font-disp);
    font-size: 15px;
    color: var(--text);
    background: var(--ink-2);
    border: 1px solid var(--hair-2);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.im-input::placeholder { color: var(--subtle); }
.im-input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(56, 232, 255, 0.14);
    background: #0b1020;
}
.im-input--textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.im-checkrow {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: var(--muted);
    margin: 4px 0 22px;
    cursor: pointer;
}
.im-checkrow input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--lime); flex-shrink: 0; cursor: pointer; }
.im-checkrow a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }

.im-alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 20px;
}
.im-alert--err  { background: rgba(255, 61, 127, 0.10); border: 1px solid rgba(255, 61, 127, 0.4); color: #ffd3e2; }
.im-alert--info { background: rgba(56, 232, 255, 0.08); border: 1px solid rgba(56, 232, 255, 0.35); color: #cdf4ff; }
.im-alert--ok   { background: rgba(200, 255, 46, 0.08); border: 1px solid rgba(200, 255, 46, 0.4); color: #eaffba; }

.im-authcard__alt {
    margin-top: 22px;
    text-align: center;
    font-size: 13.5px;
    color: var(--muted);
}
.im-authcard__alt a { color: var(--cyan); font-weight: 600; }

.im-plan-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--on-lime);
    background: var(--lime);
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 18px;
}

/* Campo de contraseña con botón "ojo" para mostrar/ocultar. */
.im-passrow { position: relative; }
.im-passrow .im-input { padding-right: 46px; }
.toggle-pass {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    padding: 6px 8px;
    line-height: 1;
}
.toggle-pass:hover { color: var(--cyan); }

/* =======================================================================
   VECTORIZADOR (app) — shell, consolas, lienzo, recorte, procesado
   -----------------------------------------------------------------------
   Estas clases reproducen la estructura de app.php (split de 3 columnas)
   con el tema oscuro Imalyn. Conservan los MISMOS nombres que usa el JS
   (tabs__item, tab-panel, preset-chip, input-file, is-active, is-drag-over,
   is-loading, is-error, is-visible, #crop-overlay, #crop-rect…).
   ======================================================================= */

.app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
}
.app__header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 clamp(16px, 3vw, 28px);
    background: rgba(7, 9, 15, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hair);
}
.app__brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
    color: var(--text);
    white-space: nowrap;
}
.app__brand-accent { color: var(--lime); font-weight: 700; }
.app__title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.04em;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app__title strong { color: var(--text); font-weight: 700; }
.app__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.app__body { flex: 1; display: flex; min-height: 0; overflow: hidden; }

/* --- Indicador de cuota / plan en la cabecera --- */
.quota-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--muted);
    padding: 6px 12px;
    border: 1px solid var(--hair-2);
    border-radius: 999px;
    background: var(--panel-2);
    white-space: nowrap;
}
.quota-chip b { color: var(--lime); font-weight: 700; }
.quota-chip--pro b { color: var(--cyan); }

/* --- Split de 3 columnas --- */
.split { display: flex; width: 100%; min-height: 0; flex: 1; }

.split__aside {
    width: 420px;
    flex-shrink: 0;
    padding: 30px 28px;
    background: var(--panel);
    border-right: 1px solid var(--hair);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.split__main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
    min-width: 0; min-height: 0;
    position: relative;
    overflow: hidden;
}
.split__edit {
    width: 320px;
    flex-shrink: 0;
    padding: 30px 24px;
    background: var(--panel);
    border-left: 1px solid var(--hair);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.split__edit-empty {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
    padding: 24px 8px;
    border: 1px dashed var(--hair);
    border-radius: var(--radius-sm);
}

.aside-heading { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.aside-subheading { font-size: 14px; color: var(--muted); margin: 0 0 22px; line-height: 1.6; }

/* --- Tabs (Subir / Generar con IA) --- */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--ink-2);
    border: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
}
.tabs__item {
    flex: 1;
    padding: 9px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-family: var(--font-disp);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.tabs__item:hover { color: var(--text); }
.tabs__item.is-active {
    background: var(--lime);
    color: var(--on-lime);
    box-shadow: var(--glow-lime);
}
.tab-panel[hidden] { display: none; }

/* --- Campos de formulario --- */
.field { margin-bottom: 16px; }
.field__label {
    display: block;
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}
.input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font-disp);
    font-size: 14.5px;
    color: var(--text);
    background: var(--ink-2);
    border: 1px solid var(--hair-2);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder { color: var(--subtle); }
.input:focus {
    outline: none;
    border-color: var(--cyan);
    background: #0b1020;
    box-shadow: 0 0 0 3px rgba(56, 232, 255, 0.14);
}
.input--textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* --- Dropzone de subida --- */
.input-file {
    display: block;
    padding: 30px 20px;
    text-align: center;
    background: var(--ink-2);
    border: 1.5px dashed var(--hair-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.input-file:hover,
.input-file.is-drag-over {
    border-color: var(--lime);
    color: var(--lime);
    background: rgba(200, 255, 46, 0.05);
}
.input-file.is-drag-over { border-style: solid; }
.input-file input { display: none; }
.input-file__name {
    display: block;
    margin-top: 7px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
}

/* --- Presets de estilo IA --- */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 7px;
}
.preset-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 6px;
    background: var(--ink-2);
    border: 1.5px solid var(--hair-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-disp);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .06s ease;
}
.preset-chip:hover { border-color: var(--hair-2); background: #0d1426; }
.preset-chip:active { transform: translateY(1px); }
.preset-chip.is-active {
    border-color: var(--lime);
    background: rgba(200, 255, 46, 0.07);
    color: var(--lime);
    box-shadow: 0 0 0 3px rgba(200, 255, 46, 0.10);
}
.preset-chip__icon { font-size: 19px; line-height: 1; }

/* --- Hints / avisos pequeños --- */
.hint {
    background: var(--panel-2);
    border: 1px solid var(--hair);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-size: 12.5px;
    color: var(--muted);
    margin: 0 0 16px;
    line-height: 1.55;
}
.hint strong { color: var(--text); font-weight: 600; }

.status-text { font-size: 12.5px; min-height: 18px; color: var(--muted); }
.status-text.is-ok  { color: var(--lime); }
.status-text.is-err { color: var(--magenta); }

/* --- Acciones de error en la página de "procesando" --- */
.stage__error { display: flex; gap: 12px; margin-top: 26px; justify-content: center; flex-wrap: wrap; }

/* --- Aviso de cuota (Free con pocos vectores) --- */
.quota-nudge {
    margin: 0 0 18px; padding: 12px 14px; border-radius: var(--radius-sm);
    border: 1px solid rgba(200,255,46,.3); background: rgba(200,255,46,.06);
    display: flex; flex-direction: column; gap: 3px; font-size: 13px;
}
.quota-nudge b { color: var(--lime); font-weight: 700; }
.quota-nudge span { color: var(--muted); line-height: 1.5; }
.quota-nudge .btn { align-self: flex-start; margin-top: 8px; }
.quota-nudge--out { border-color: rgba(255,61,127,.35); background: rgba(255,61,127,.07); }
.quota-nudge--out b { color: var(--magenta); }

/* --- Muestras clicables del estado vacío --- */
.sample-row { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sample-row__label { font-family: var(--font-mono); font-size: 12px; color: var(--subtle); letter-spacing: .03em; }
.sample-row__items { display: flex; gap: 10px; }
.sample-chip {
    width: 62px; height: 62px; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
    border: 1px solid var(--hair-2); background: var(--ink-2);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.sample-chip:hover { border-color: var(--cyan); transform: translateY(-2px); box-shadow: var(--glow-cyan); }
.sample-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Estado vacío del lienzo --- */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--muted);
    text-align: center;
    max-width: 420px;
}
.preview-empty__icon { width: 76px; height: 76px; opacity: 0.85; color: var(--cyan); }
.preview-empty__title { margin: 0; font-size: 17px; font-weight: 600; color: var(--text); }
.preview-empty__subtitle { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }

/* --- Lienzo / preview grande --- */
.preview-big {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 100%;
    max-height: 100%;
}
.preview-big__label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.preview-big__frame {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--hair-2);
    /* Damero oscuro para mostrar la transparencia. */
    background:
        linear-gradient(45deg, #0e1424 25%, transparent 25%),
        linear-gradient(-45deg, #0e1424 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #0e1424 75%),
        linear-gradient(-45deg, transparent 75%, #0e1424 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, 9px 0;
    background-color: #0a0f1c;
    box-shadow: var(--shadow);
    max-width: 100%;
    max-height: calc(100vh - var(--header-h) - 150px);
    min-width: 320px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-big__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - var(--header-h) - 150px);
    object-fit: contain;
}
/* Marcas de registro en las esquinas del visor (motivo imprenta). */
.preview-big__frame::before,
.preview-big__frame::after {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    border: 0 solid var(--cyan);
    z-index: 2;
    pointer-events: none;
    opacity: 0.7;
}
.preview-big__frame::before { top: 10px;  left: 10px;  border-top-width: 1.5px;  border-left-width: 1.5px; }
.preview-big__frame::after  { bottom: 10px; right: 10px; border-bottom-width: 1.5px; border-right-width: 1.5px; }

/* --- Spinners adicionales --- */
.spinner--large { width: 48px; height: 48px; border-width: 4px; }
.spinner--dark { border-color: rgba(122, 162, 255, 0.18); border-top-color: var(--cyan); }

/* --- Loader local (cubre el frame) --- */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 9, 15, 0.86);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    font-size: 13px;
    color: var(--text);
    z-index: 4;
    border-radius: inherit;
    text-align: center;
    padding: 16px;
}
.loader-overlay span {
    font-family: var(--font-mono);
    background: var(--panel);
    border: 1px solid var(--hair);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Loader a pantalla completa --- */
.fullscreen-loader {
    position: fixed;
    inset: 0;
    background: rgba(7, 9, 15, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    z-index: 1000;
    color: var(--text);
}
.fullscreen-loader.is-visible { display: flex; }
.fullscreen-loader__title { font-size: 19px; font-weight: 700; margin: 0; }
.fullscreen-loader__subtitle {
    font-size: 13.5px; color: var(--muted); max-width: 60ch;
    text-align: center; line-height: 1.6; margin: 0; padding: 0 24px;
}

/* --- Overlay y rectángulo de recorte (magenta = herramienta de recorte) --- */
#crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: auto;
    cursor: crosshair;
    /* Sin esto, en móvil el arrastre para dibujar el recorte lo interpreta el
       navegador como scroll/zoom y el recorte no responde. El overlay solo
       existe en modo recorte, así que apropiarse del gesto aquí es correcto. */
    touch-action: none;
}

/* En móvil, los controles de recorte (Aplicar/Cancelar) viven en la columna
   inferior, lejos del lienzo. Durante el recorte los fijamos abajo para poder
   dibujar arriba y confirmar sin hacer scroll. Solo se muestran en modo
   recorte (display:block desde el JS). */
@media (max-width: 920px) {
    #crop-edit-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        margin: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--panel); border-top: 1px solid var(--hair-2);
        box-shadow: 0 -12px 32px -12px rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        text-align: center;
    }
    /* Compacto para tapar lo mínimo: ocultamos el título y la instrucción
       larga (arrastrar sobre la imagen es intuitivo) y ponemos Aplicar/Cancelar
       en una sola fila. Así la imagen queda visible para recortar. */
    #crop-edit-panel .field__label,
    #crop-edit-panel .hint:not(#crop-info) { display: none; }
    #crop-edit-panel #crop-info { margin: 0 0 8px; font-size: 12.5px; opacity: .85; }
    #crop-edit-panel #btn-crop-apply,
    #crop-edit-panel #btn-crop-cancel { display: inline-block; width: auto; margin: 0 5px; padding: 11px 20px; }
}
#crop-rect {
    position: absolute;
    border: 1.5px dashed var(--magenta);
    outline: 1px solid rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 9999px rgba(7, 9, 15, 0.62);
    box-sizing: border-box;
    pointer-events: none;
}
.crop-rect__handle {
    position: absolute;
    width: 10px; height: 10px;
    background: var(--cyan);
    border: 1px solid rgba(0, 0, 0, 0.55);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--cyan);
}
.crop-rect__handle--tl { top: -6px; left: -6px; }
.crop-rect__handle--tr { top: -6px; right: -6px; }
.crop-rect__handle--bl { bottom: -6px; left: -6px; }
.crop-rect__handle--br { bottom: -6px; right: -6px; }

/* --- Página de procesado --- */
.stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    overflow: auto;
    min-height: 0;
    gap: 22px;
    text-align: center;
}
.stage__title { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.stage__subtitle { font-size: 14px; color: var(--muted); margin: 0; max-width: 60ch; line-height: 1.6; }

.single-stage { display: flex; justify-content: center; margin: 18px auto; padding: 0 24px; max-width: 540px; width: 100%; }
.pipeline-card {
    background: var(--panel);
    border: 1px solid var(--hair-2);
    border-radius: var(--radius);
    padding: 40px 30px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    /* Bisel HUD. */
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}
.pipeline-card__line {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    min-height: 1.3em;
    letter-spacing: 0.02em;
}
.pipeline-card.is-error .spinner,
.pipeline-card.is-error .im-trace { display: none; }
.pipeline-card.is-error .pipeline-card__line { color: var(--magenta); }

/* Animación de "trazado" para la página de procesado: una curva bézier que
   se dibuja en bucle (literalmente trazando un vector). */
.im-trace { width: 120px; height: 120px; }
.im-trace path {
    fill: none;
    stroke: var(--lime);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    animation: im-draw 2.4s ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(200, 255, 46, 0.5));
}
.im-trace circle { fill: var(--cyan); }
.im-trace rect { fill: var(--ink); stroke: var(--lime); stroke-width: 2.5; }
@keyframes im-draw {
    0%   { stroke-dashoffset: 320; }
    55%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; opacity: 0.25; }
}

/* --- Responsive de la app --- */
@media (max-width: 920px) {
    .app { height: auto; min-height: 100vh; }
    .app__body { overflow: visible; }
    /* La cabecera de la app llevaba altura fija (64px) sin envolver: los
       botones (Cuenta/Admin/Salir + acciones del editor + chip de cuota)
       desbordaban >100% de ancho. Ahora crece en alto y envuelve. */
    .app__header {
        height: auto;
        min-height: var(--header-h);
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 9px;
        padding-bottom: 9px;
    }
    .app__actions { gap: 6px; }
    /* La previsualización amplía por pellizco (su JS); permitimos scroll
       vertical de la página con un dedo cuando NO está ampliada. */
    #preview-canvas { touch-action: pan-y; }
    .split { flex-direction: column; }
    .split__aside { width: 100%; border-right: none; border-bottom: 1px solid var(--hair); }
    .split__main { padding: 24px 18px; min-height: 340px; }
    .split__edit { width: 100%; border-left: none; border-top: 1px solid var(--hair); }
    .preview-big__frame, .preview-big__img { max-height: 52vh; }
    .app__title { display: none; }
}

/* =======================================================================
   Animaciones de entrada (revelado escalonado)
   ======================================================================= */

@keyframes im-rise {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}
.im-rise { animation: im-rise .7s cubic-bezier(.2,.7,.2,1) both; }
.im-rise-1 { animation-delay: .05s; }
.im-rise-2 { animation-delay: .15s; }
.im-rise-3 { animation-delay: .25s; }
.im-rise-4 { animation-delay: .35s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; scroll-behavior: auto; }
}

/* =======================================================================
   Opciones de edición de la imagen (app.php, aside derecho): tarjetas claras
   con icono + título + descripción, y un pulso de atención al cargar/generar.
   ======================================================================= */
.edit-options__head { font-weight: 700; font-size: 14px; margin: 0 0 4px; color: var(--text); }
.edit-option {
    display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: left;
    padding: 11px 12px; margin-top: 8px; cursor: pointer; font-family: inherit;
    border: 1px solid var(--hair-2); border-radius: 12px; background: var(--panel-2); color: var(--text);
    transition: border-color .15s ease, background .15s ease, transform .08s ease;
}
.edit-option:hover  { border-color: var(--lime); background: rgba(200, 255, 46, .07); }
.edit-option:active { transform: translateY(1px); }
.edit-option__icon  { font-size: 20px; line-height: 1.1; flex-shrink: 0; }
.edit-option__text  { display: flex; flex-direction: column; gap: 2px; }
.edit-option__text strong { font-size: 13.5px; font-weight: 700; }
.edit-option__text small  { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* Pulso de atención: avisa de que hay opciones de edición cuando aparece la imagen. */
@keyframes edit-attention {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 255, 46, 0); }
    35%      { box-shadow: 0 0 0 3px rgba(200, 255, 46, .38); }
}
.editpanel-attention { border-radius: 14px; animation: edit-attention 1.15s ease-out 2; }

/* =======================================================================
   Cajón de edición móvil de app.php — recortar / borrar (varita)
   -----------------------------------------------------------------------
   El panel de opciones (#crop-idle-panel) pasa a cajón deslizante que se
   abre con el FAB; los modos activos (#crop-edit-panel / #wand-edit-panel)
   son barras FIJAS abajo (interacción con el lienzo). #crop-idle-panel se
   desliza con transform y NO tiene hijos position:fixed, así que no atrapa
   las barras. El FAB y el #app-edit-backdrop van DENTRO de .app en el HTML
   por el contexto de apilamiento (.app es position:relative; z-index:1).
   Ver memoria imalyn-stacking-context.
   ======================================================================= */
/* En escritorio el panel sigue siendo la columna fija; estos controles solo
   existen en móvil. */
#app-edit-fab, #app-edit-backdrop, .edit-drawer__close { display: none; }

@media (max-width: 920px) {
    /* La columna de edición no ocupa sitio en móvil: sus paneles son cajón
       (idle) o barras fijas (recortar/varita), y el placeholder vacío sobra. */
    .split__edit { padding: 0; border: none; gap: 0; }
    #edit-panel-empty { display: none; }

    /* Cajón de opciones (recortar / borrar): pestaña deslizante por la derecha. */
    #crop-idle-panel {
        position: fixed; top: 0; right: 0; bottom: 0; z-index: 1200;
        width: min(86vw, 330px);
        margin: 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px));
        background: #0f1322; border-left: 1px solid var(--hair);
        box-shadow: -6px 0 36px -10px rgba(0, 0, 0, 0.75);
        overflow-y: auto; overscroll-behavior: contain;
        transform: translateX(100%);
        transition: transform .26s cubic-bezier(.2, .7, .2, 1);
    }
    #crop-idle-panel.is-open { transform: translateX(0); }
    /* Botón × dentro del cajón. */
    .edit-drawer__close {
        position: absolute; top: 12px; right: 12px;
        display: inline-flex; align-items: center; justify-content: center;
        width: 34px; height: 34px;
        background: var(--panel-2); border: 1px solid var(--hair-2);
        border-radius: 9px; color: var(--muted);
        font-size: 22px; line-height: 1; cursor: pointer;
    }
    .edit-drawer__close:hover { color: var(--text); }

    /* Barra fija inferior del modo Varita (igual que la de Recortar). */
    #wand-edit-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        margin: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--panel); border-top: 1px solid var(--hair-2);
        box-shadow: 0 -12px 32px -12px rgba(0, 0, 0, 0.75);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        text-align: center;
    }
    #wand-edit-panel .field__label { display: none; }
    #wand-edit-panel .hint { margin: 0 0 8px; font-size: 12px; }
    #wand-edit-panel #btn-wand-delete,
    #wand-edit-panel #btn-wand-undo,
    #wand-edit-panel #btn-wand-done {
        display: inline-block; width: auto; margin: 4px 5px 0; padding: 10px 16px;
    }

    /* Fondo oscuro del cajón (toca para cerrar). Solo oscurece, sin blur. */
    #app-edit-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1190;
        background: rgba(7, 9, 15, 0.62);
        opacity: 0; pointer-events: none; transition: opacity .26s ease;
    }
    #app-edit-backdrop.is-show { opacity: 1; pointer-events: auto; }

    /* FAB que abre el cajón (pestaña en el borde derecho, centrada vertical).
       Solo se ve con imagen cargada y en idle (el JS añade .is-shown). */
    #app-edit-fab.is-shown {
        display: inline-flex; align-items: center; gap: 7px; z-index: 150;
        position: fixed; right: 0; top: 50%; transform: translateY(-50%);
        padding: 11px 11px 11px 13px;
        background: #0f1322; color: var(--lime);
        border: 1px solid var(--hair); border-right: none;
        border-radius: 14px 0 0 14px;
        box-shadow: -2px 2px 16px rgba(0, 0, 0, 0.55);
        font-family: var(--font-mono); font-size: 12px; letter-spacing: .03em;
        cursor: pointer;
    }
    #app-edit-fab .app-fab__icon { font-size: 16px; line-height: 1; }
}
