/* ==========================================================================
   Remaster de la interfaz (2-dic-2026): barra superior en escritorio y un solo sistema visual en todo el estudio.
   - Escritorio ≥ 1024 px: la barra lateral pasa a ser una barra superior de dos filas (arriba la marca, la cuenta y el
     saldo; debajo todas las secciones). 901–1023 px: barra lateral de siempre. Teléfono (≤ 900 px): menú inferior + «Más».
   - Un solo acento violeta (los tokens base de styles.css ya son violetas: --accent, --grad, --soft, --ring), superficies
     en capas, una escala tipográfica y el mismo patrón de cabecera, tarjeta, botón, campo, chip y diálogo en todas las
     pantallas.
   - Se carga la última (media="print" data-later, como las demás hojas del estudio): solo pisa estilos; no cambia ids,
     data-* ni comportamiento. La portada no la necesita para pintarse (sus colores salen de styles.css).
   ========================================================================== */

:root {
  /* Superficies: negro azulado de sala de cine, en capas */
  --rm-bg: #0a0a11;
  --rm-bar: rgba(12, 12, 20, .9);
  --rm-surface: #12121b;
  --rm-surface-2: #181823;
  --rm-surface-3: #20202d;
  --rm-inset: #0d0d15;
  --rm-line: rgba(255, 255, 255, .075);
  --rm-line-2: rgba(255, 255, 255, .12);
  --rm-line-3: rgba(255, 255, 255, .2);
  /* Texto (todos ≥ 4,5:1 sobre --rm-surface-3, la superficie más clara) */
  --rm-text: #f4f3f9;
  --rm-text-2: #c9c6d8;
  --rm-muted: #a09db4;
  /* Un solo acento: violeta */
  --rm-accent: #7457f2;
  --rm-accent-2: #5b3fe0;
  --rm-accent-text: #bcb0ff;
  --rm-accent-soft: rgba(124, 99, 255, .14);
  --rm-accent-line: rgba(160, 140, 255, .45);
  --rm-grad: linear-gradient(135deg, #7457f2 0%, #5b3fe0 100%);
  --rm-ring: 0 0 0 3px rgba(140, 118, 255, .35);
  /* Forma y profundidad */
  --rm-r-sm: 10px;
  --rm-r: 14px;
  --rm-r-lg: 20px;
  --rm-shadow-1: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 1px 2px rgba(0, 0, 0, .35);
  --rm-shadow-2: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 40px -24px rgba(0, 0, 0, .9);
  --rm-shadow-3: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 40px 90px -30px rgba(0, 0, 0, .95);
  /* Escala tipográfica (1,2) */
  --rm-fs-xs: .75rem;
  --rm-fs-sm: .8125rem;
  --rm-fs-base: .9375rem;
  --rm-fs-md: 1.0625rem;
  --rm-fs-lg: 1.3125rem;
  --rm-fs-xl: 1.875rem;
  --rm-fs-2xl: 2.625rem;
  /* Alto de la barra superior (0 donde no la hay): lo usan los elementos que se pegan arriba al desplazar */
  --rm-topbar-h: 0px;
}

/* ---------------------------------------------------------------------------
   1) Barra superior de escritorio
   --------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* Fila 1 (56 px) + fila 2 (48 px) + borde (1 px) */
  :root { --rm-topbar-h: 105px; }
  html { scroll-padding-top: calc(var(--rm-topbar-h) + 12px); }

  #app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    background: var(--rm-bg);
    --side: 0px;
    /* Mismo margen que el contenido (.main: máx. 1320 px y relleno clamp): la barra queda alineada con la página */
    --rm-gutter: max(clamp(20px, 4vw, 56px), calc((100% - 1320px) / 2 + clamp(20px, 4vw, 56px)));
  }
  #app::before { background: radial-gradient(ellipse 1000px 460px at 50% -160px, rgba(116, 87, 242, .16), transparent 72%); }

  /* (styles.css, auditoría UX n.º 36) La barra lateral se compacta en pantallas bajas (max-height: 900px) con su propio
     relleno, overflow: hidden y un degradado que borra el final del menú: en la barra superior no aplica nada de eso. */
  #app .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    overflow: visible;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 56px 48px;
    grid-template-areas: "brand account bottom" "main main main";
    align-items: center;
    column-gap: 16px;
    row-gap: 0;
    padding: 0 var(--rm-gutter);
    background: var(--rm-bar);
    -webkit-backdrop-filter: saturate(150%) blur(18px);
    backdrop-filter: saturate(150%) blur(18px);
    border-right: 0;
    border-bottom: 1px solid var(--rm-line);
    box-shadow: 0 12px 30px -22px rgba(0, 0, 0, .9);
  }
  #app .sidebar > .menu {
    flex: none;
    min-height: 0;
    padding-bottom: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
  /* Línea fina entre las dos filas, de borde a borde */
  #app .sidebar::after { content: ""; position: absolute; left: 0; right: 0; top: 56px; height: 1px; background: var(--rm-line); pointer-events: none; }

  /* Fila 1: marca · cuenta · créditos */
  #app .sidebar > .brand { grid-area: brand; height: 56px; padding: 0; gap: 10px; font-size: 1.06rem; }
  #app .sidebar > .brand .logo { width: 30px; height: 30px; }

  #app .sidebar .menu { flex-direction: row; align-items: center; min-width: 0; }
  #app .sidebar .menu .menu-text { white-space: nowrap; }
  #app .sidebar .menu button.active::before { display: none; }

  /* La fila de cuenta mide lo que le deja la marca y el saldo: si no caben los nombres (pantallas de 1024–1400 px, con
     Admin o «Instalar la app» visibles, o en otro idioma) pasa a solo iconos, nunca se monta sobre la marca ni se corta. */
  #app .sidebar .menu-account { grid-area: account; justify-self: stretch; justify-content: flex-end; gap: 2px; container: rm-cuenta / inline-size; overflow: visible; }
  #app .sidebar .menu-account .menu-label { display: none; }
  #app .sidebar .menu-account button {
    flex: none;
    min-height: 36px;
    gap: 7px;
    padding: 0 10px;
    border-radius: var(--rm-r-sm);
    color: var(--rm-text-2);
    font-size: var(--rm-fs-sm);
    font-weight: 550;
  }
  #app .sidebar .menu-account button .ic { width: 17px; height: 17px; color: inherit; }
  #app .sidebar .menu-account button:hover { background: rgba(255, 255, 255, .055); color: var(--rm-text); }
  #app .sidebar .menu-account button.active { background: var(--rm-accent-soft); color: var(--rm-text); box-shadow: inset 0 0 0 1px var(--rm-accent-line); }
  #app .sidebar .menu-account button.active .ic { color: var(--rm-accent-text); }
  #app .sidebar .menu-account .aff-chip { margin: 0; padding: 1px 6px; font-size: .66rem; }
  #app .sidebar .menu-account .menu-help.has-dot::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--rm-accent-text); }

  #app .sidebar .side-bottom { grid-area: bottom; margin: 0; flex-direction: row; align-items: center; gap: 8px; flex: none; }
  #app .sidebar .credit-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 3px 3px 3px 12px;
    border: 1px solid var(--rm-line-2);
    border-radius: 999px;
    background: var(--rm-surface-2);
  }
  #app .sidebar .cc-top { display: flex; }
  #app .sidebar .cc-top .muted { display: none; }
  #app .sidebar .credit-card .cc-top .ic { display: block; width: 15px; height: 15px; color: var(--rm-accent-text); }
  #app .sidebar .credit-card strong { margin: 0; font-size: 1rem; line-height: 1; color: var(--rm-text); }
  #app .sidebar .credit-card .btn { width: auto; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--rm-grad); color: #fff; font-size: var(--rm-fs-xs); font-weight: 650; }
  #app .sidebar .credit-card .btn:hover { filter: brightness(1.1); }
  #app .sidebar .lang-pick { width: auto; min-height: 36px; margin: 0; padding: 0 10px; border-color: var(--rm-line-2); border-radius: var(--rm-r-sm); background: transparent; font-size: var(--rm-fs-sm); }
  #app .sidebar .user-row { display: flex; padding: 0; gap: 2px; }
  #app .sidebar .user-row #userEmail { display: none; }
  #app .sidebar .user-row .icon-link { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--rm-r-sm); color: var(--rm-text-2); }
  #app .sidebar .user-row .icon-link:hover { background: rgba(255, 255, 255, .055); color: var(--rm-text); }
  #app .workspace-creditbar { display: none; }

  /* Fila 2: todas las secciones, agrupadas */
  #app .sidebar .menu-main {
    grid-area: main;
    align-items: stretch;
    gap: 2px;
    height: 48px;
    margin: 0 -9px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    container: rm-secciones / inline-size;
  }
  #app .sidebar .menu-main::-webkit-scrollbar { display: none; }
  #app .sidebar .menu-main button {
    flex: none;
    min-height: 0;
    gap: 6px;
    padding: 0 9px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--rm-text-2);
    font-size: var(--rm-fs-sm);
    font-weight: 550;
    letter-spacing: .005em;
    white-space: nowrap;
  }
  /* Solo texto: con trece secciones (Estudio de series y Admin incluidos) los iconos no caben ni a 1440 px */
  #app .sidebar .menu-main button .ic { display: none; }
  #app .sidebar .menu-main button::after {
    content: "";
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: transparent;
    transition: background .18s;
  }
  #app .sidebar .menu-main button:hover { background: none; color: var(--rm-text); }
  #app .sidebar .menu-main button:hover::after { background: var(--rm-line-3); }
  #app .sidebar .menu-main button.active { background: none; box-shadow: none; color: var(--rm-text); }
  #app .sidebar .menu-main button.active::after { background: var(--rm-accent-text); }
  #app .sidebar .menu-main button:focus-visible { outline: 2px solid var(--rm-accent-text); outline-offset: -6px; border-radius: var(--rm-r-sm); }
  #app .sidebar .menu-main .qbadge { margin-left: 2px; background: var(--rm-accent); }
  /* «Nuevo» (Personajes y lugares, Voz y doblaje): la misma insignia violeta, en línea con el texto */
  #app .sidebar .menu-main button :is(.nav-new) {
    position: static;
    margin: 0;
    padding: 1px 6px;
    border: 1px solid var(--rm-accent-line);
    border-radius: 999px;
    background: var(--rm-accent-soft);
    box-shadow: none;
    color: #ddd6ff;
    font-size: .6rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .05em;
  }
  #app .sidebar .menu-main button:is(.menu-elenco, .menu-voz) { gap: 6px; overflow: visible; }
  #app .sidebar .menu-main button:is(.menu-elenco, .menu-voz).active { background: none; box-shadow: none; }
  #app .sidebar .menu-main button:is(.menu-elenco, .menu-voz).active::after { background: var(--rm-accent-text); }

  /* Separador de grupo (el nombre queda para lectores de pantalla) */
  #app .sidebar .menu-main .menu-label {
    flex: none;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 20px;
    margin: 0 4px 0 10px;
    padding: 0;
    border-left: 1px solid var(--rm-line-2);
    color: transparent;
    font-size: 0;
    letter-spacing: .12em;
  }

  #app .sidebar :focus-visible { outline: 2px solid var(--rm-accent-text); outline-offset: 2px; box-shadow: none; }

  /* Lo que se pegaba arriba al desplazar queda ahora debajo de la barra */
  #app #createForm > .creator-review:not(.no-stick) { top: calc(var(--rm-topbar-h) + 16px); }
  #app .create-grid > .card:nth-child(2) { top: calc(var(--rm-topbar-h) + 16px); }
  #app .admin-nav { top: calc(var(--rm-topbar-h) + 6px); }
  #app .el-cat-top { top: var(--rm-topbar-h); }
  #app .ad-text-panel { top: calc(var(--rm-topbar-h) + 12px); max-height: calc(100vh - var(--rm-topbar-h) - 24px); }
  /* Las anclas ya descuentan la barra (scroll-padding de html): su margen propio vuelve a ser pequeño */
  #creatorReviewHeading { scroll-margin-top: 12px; }
  #app :is(.genre-gallery, #tomas-de-prueba) { scroll-margin-top: 12px; }
  #app #homeDirectorDock { scroll-margin-block-start: 12px; }

  /* La ayuda ya está en la barra: fuera el botón flotante que tapaba tarjetas */
  body:has(#app:not([hidden])) .help-fab { display: none; }

  #app .main { padding-top: 32px; max-width: 1320px; }

  /* Botón flotante de Crear («Revisar ajustes y precio»): ya no hay barra lateral a la izquierda */
  body[data-tab="create"].gen-away #app .mgen { background: linear-gradient(transparent, rgba(10, 10, 17, .92) 55%); }
}

/* Fila de cuenta sin sitio para los nombres: solo iconos (el nombre sigue ahí para lectores de pantalla y en el title).
   Con consulta de contenedor (mide el sitio real que deja la marca y el saldo). Cuánto necesita depende de qué botones
   se ven: en español ~575 px, +85 con Admin, +130 con «Instalar la app»; los umbrales dejan margen para otros idiomas.
   Los navegadores sin consultas de contenedor usan el ancho de la ventana. */
@container rm-cuenta (max-width: 640px) {
  #app .sidebar .menu-account button { width: 36px; padding: 0; justify-content: center; position: relative; }
  #app .sidebar .menu-account button .menu-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  #app .sidebar .menu-account .aff-chip { position: absolute; top: -4px; right: -8px; padding: 0 4px; font-size: .58rem; line-height: 1.5; }
}
@container rm-cuenta (max-width: 760px) {
  #app .sidebar .menu-account:has(> :is(#adminTab, .install-entry):not([hidden])) button { width: 36px; padding: 0; justify-content: center; position: relative; }
  #app .sidebar .menu-account:has(> :is(#adminTab, .install-entry):not([hidden])) button .menu-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  #app .sidebar .menu-account:has(> :is(#adminTab, .install-entry):not([hidden])) .aff-chip { position: absolute; top: -4px; right: -8px; padding: 0 4px; font-size: .58rem; line-height: 1.5; }
}
@container rm-cuenta (max-width: 840px) {
  #app .sidebar .menu-account:has(> #adminTab:not([hidden])):has(> .install-entry:not([hidden])) button { width: 36px; padding: 0; justify-content: center; position: relative; }
  #app .sidebar .menu-account:has(> #adminTab:not([hidden])):has(> .install-entry:not([hidden])) button .menu-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  #app .sidebar .menu-account:has(> #adminTab:not([hidden])):has(> .install-entry:not([hidden])) .aff-chip { position: absolute; top: -4px; right: -8px; padding: 0 4px; font-size: .58rem; line-height: 1.5; }
}
@supports not (container-type: inline-size) {
  @media (min-width: 1024px) and (max-width: 1399.98px) {
    #app .sidebar .menu-account button { width: 36px; padding: 0; justify-content: center; position: relative; }
    #app .sidebar .menu-account button .menu-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
    #app .sidebar .menu-account .aff-chip { position: absolute; top: -4px; right: -8px; padding: 0 4px; font-size: .58rem; line-height: 1.5; }
  }
}
/* Fila de secciones estrecha (1024–1240 px): menos aire y «Nuevo» pasa a ser un punto, para que quepan todas sin
   desplazarse. Si aun así no cabe (otro idioma), la fila se desplaza de lado. */
@container rm-secciones (max-width: 1150px) {
  #app .sidebar .menu-main button { padding: 0 7px; }
  #app .sidebar .menu-main button::after { left: 7px; right: 7px; }
  #app .sidebar .menu-main .menu-label { margin: 0 2px 0 6px; }
  #app .sidebar .menu-main button :is(.nav-new) { width: 7px; height: 7px; padding: 0; border: 0; background: var(--rm-accent-text); font-size: 0; align-self: flex-start; margin: 14px 0 0 -2px; }
}
@container rm-secciones (max-width: 1010px) {
  #app .sidebar .menu-main button { padding: 0 6px; font-size: .75rem; letter-spacing: 0; }
  #app .sidebar .menu-main button::after { left: 6px; right: 6px; }
}
/* (Los nombres de grupo —Producción, Herramientas…— no se escriben: no caben ni a 1440 px. Quedan como separadores y
   los lectores de pantalla siguen leyendo el nombre.) */
@media (min-width: 1600px) {
  #app .sidebar .user-row #userEmail { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px 0 8px; color: var(--rm-muted); font-size: var(--rm-fs-xs); }
}
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
  #app .sidebar .menu-main button::after { transition: none; }
}

/* ---------------------------------------------------------------------------
   2) Tokens del estudio: todas las pantallas, el menú del teléfono, los diálogos y los avisos (todas las anchuras)
   --------------------------------------------------------------------------- */
#app,
.modal,
dialog,
#toast,
#moreSheet {
  --surface: var(--rm-surface);
  --surface-2: var(--rm-surface-2);
  --surface-3: var(--rm-surface-3);
  --line: var(--rm-line);
  --line-2: var(--rm-line-2);
  --line-3: var(--rm-line-3);
  --text: var(--rm-text);
  --text-2: var(--rm-text-2);
  --muted: var(--rm-muted);
  --accent: var(--rm-accent-text);
  --accent-2: var(--rm-accent-text);
  --grad: var(--rm-grad);
  --grad-soft: linear-gradient(135deg, rgba(124, 95, 245, .16), rgba(91, 63, 224, .1));
  --soft: var(--rm-accent-soft);
  --ring: 0 0 0 1px var(--rm-accent-line), var(--rm-ring);
  --workspace-surface: var(--rm-surface);
  --workspace-input: var(--rm-inset);
  --workspace-line: var(--rm-line-2);
  --workspace-accent: var(--rm-accent-text);
  --workspace-highlight: var(--rm-accent-soft);
  --work-border: var(--rm-line-2);
  --work-panel: var(--rm-surface);
  --work-highlight: var(--rm-accent-text);
  color: var(--rm-text);
  font-size: var(--rm-fs-base);
}

/* ---------------------------------------------------------------------------
   3) Inicio, Crear y Mis proyectos
   --------------------------------------------------------------------------- */
/* Tipografía de cabeceras */
#app :is([data-panel="home"] .home-head h2, [data-panel="create"] > .panel-head h2, [data-panel="drafts"] .dr-head h2) {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, var(--rm-fs-xl));
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--rm-text);
  background: none;
}
#app :is([data-panel="create"] > .panel-head, [data-panel="drafts"] .dr-head) p {
  margin-top: 8px;
  max-width: 62ch;
  color: var(--rm-muted);
  font-size: var(--rm-fs-base);
  line-height: 1.55;
}
#app [data-panel="home"] .home-head { margin-bottom: 20px; }

/* Tarjetas */
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .card {
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-r-lg);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-2);
}

/* Botones */
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .btn {
  border-radius: var(--rm-r-sm);
  font-weight: 650;
  letter-spacing: .005em;
}
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .btn.primary {
  background: var(--rm-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -10px rgba(116, 87, 242, .8);
}
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .btn.primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .btn.ghost {
  background: rgba(255, 255, 255, .035);
  border-color: var(--rm-line-2);
  color: var(--rm-text);
}
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .07); border-color: var(--rm-line-3); }
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) .link { color: var(--rm-accent-text); }

/* Campos */
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) :is(textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) {
  border-color: var(--rm-line-2);
  border-radius: var(--rm-r-sm);
  background-color: var(--rm-inset);
  color: var(--rm-text);
}
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) :is(textarea, input, select):focus {
  border-color: var(--rm-accent-line);
  background-color: var(--rm-inset);
  box-shadow: var(--rm-ring);
}
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) :is(textarea, input)::placeholder { color: #8a879d; }
#app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) :focus-visible { outline-color: var(--rm-accent-text); }

/* Chips */
#app :is([data-panel="home"], [data-panel="create"]) .chip {
  border-color: var(--rm-line-2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--rm-text-2);
  font-weight: 600;
}
#app :is([data-panel="home"], [data-panel="create"]) .chip:hover { border-color: var(--rm-accent-line); color: var(--rm-text); background: var(--rm-accent-soft); }
#app :is([data-panel="home"], [data-panel="create"]) .chip.on { border-color: var(--rm-accent-line); background: var(--rm-accent-soft); color: var(--rm-text); }

/* ----- Inicio ----- */
#app [data-panel="home"] .home-launch { gap: 20px; }
#app [data-panel="home"] .home-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rm-line-2);
  border-radius: 24px;
  background:
    radial-gradient(ellipse 70% 60% at 0% 0%, rgba(124, 95, 245, .16), transparent 70%),
    linear-gradient(160deg, #181824 0%, #12121b 60%, #0f0f17 100%);
  box-shadow: var(--rm-shadow-2);
}
#app [data-panel="home"] .home-director-name {
  padding: 5px 11px 5px 8px;
  border: 1px solid var(--rm-accent-line);
  border-radius: 999px;
  background: var(--rm-accent-soft);
  color: #d9d2ff;
  font-size: var(--rm-fs-xs);
  font-weight: 650;
  letter-spacing: .02em;
}
#app [data-panel="home"] .home-director-name .ic { width: 15px; height: 15px; color: var(--rm-accent-text); }
#app [data-panel="home"] .hh-title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, var(--rm-fs-2xl));
  font-weight: 750;
  letter-spacing: -.04em;
  line-height: 1.05;
  color: var(--rm-text);
}
#app [data-panel="home"] .hh-sub { max-width: 52ch; text-wrap: pretty; margin-top: 12px; color: var(--rm-text-2); font-size: var(--rm-fs-base); line-height: 1.6; }
#app [data-panel="home"] .hh-form { margin-top: 26px; }
#app [data-panel="home"] .hh-input {
  border: 1px solid var(--rm-line-2);
  border-radius: 16px;
  background: var(--rm-inset);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 30px -22px #000;
  transition: border-color .15s, box-shadow .15s;
}
#app [data-panel="home"] .hh-input:focus-within { border-color: var(--rm-accent-line); box-shadow: var(--rm-ring); }
#app [data-panel="home"] .hh-input textarea { border: 0; background: transparent; box-shadow: none; }
#app [data-panel="home"] .hh-input textarea:focus { box-shadow: none; }
#app [data-panel="home"] .home-idea-label { color: var(--rm-muted); font-size: var(--rm-fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
#app [data-panel="home"] #homeDirectorIntent { min-height: 40px; border-color: var(--rm-line-2); background-color: var(--rm-surface-2); color: var(--rm-text-2); border-radius: var(--rm-r-sm); }
#app [data-panel="home"] .hh-input .home-continue {
  min-height: 40px;
  padding-inline: 16px;
  background: var(--rm-grad);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -10px rgba(116, 87, 242, .8);
}
#app [data-panel="home"] .hh-input .home-continue:hover { background: var(--rm-grad); filter: brightness(1.08); }
#app [data-panel="home"] .home-composer-tools summary { color: var(--rm-text-2); }
#app [data-panel="home"] .home-composer-tools summary:hover { color: var(--rm-text); }
#app [data-panel="home"] .home-manual-create { color: var(--rm-accent-text); font-weight: 600; }
#app [data-panel="home"] .hh-formats button { border-color: var(--rm-line-2); background: var(--rm-inset); }
#app [data-panel="home"] .hh-formats button.on { border-color: var(--rm-accent-line); background: var(--rm-accent-soft); color: var(--rm-text); }
#app [data-panel="home"] .hh-gift {
  border: 1px solid rgba(124, 95, 245, .3);
  border-radius: var(--rm-r);
  background: linear-gradient(90deg, rgba(124, 95, 245, .14), rgba(124, 95, 245, .04));
  color: var(--rm-text-2);
}
#app [data-panel="home"] .hh-gift b { color: var(--rm-text); }
#app [data-panel="home"] .hh-gift .ic { color: var(--rm-accent-text); }

#app [data-panel="home"] .home-feature { border: 1px solid var(--rm-line-2); border-radius: 24px; box-shadow: var(--rm-shadow-2); }
#app [data-panel="home"] .home-feature::after { background: linear-gradient(180deg, rgba(10, 10, 17, 0) 40%, rgba(10, 10, 17, .6) 66%, rgba(10, 10, 17, .96) 100%); }
#app [data-panel="home"] .home-feature figcaption { gap: 12px; padding: 24px; }
#app [data-panel="home"] .home-feature h3 { font-size: var(--rm-fs-lg); font-weight: 750; letter-spacing: -.02em; }
#app [data-panel="home"] .home-feature-actions { gap: 8px; }
#app [data-panel="home"] .home-feature-actions .primary { background: var(--rm-grad); border-color: transparent; color: #fff; }
#app [data-panel="home"] .home-feature-actions .primary:hover { background: var(--rm-grad); filter: brightness(1.08); }
#app [data-panel="home"] .home-feature-actions .ghost { background: rgba(10, 10, 17, .7); border-color: rgba(255, 255, 255, .28); color: var(--rm-text); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

#app [data-panel="home"] .home-actions { gap: 14px; margin-top: 20px; }
#app [data-panel="home"] .home-action {
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-r);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-1);
  transition: border-color .15s, background .15s, transform .15s;
}
#app [data-panel="home"] .home-action:hover { border-color: var(--rm-accent-line); background: var(--rm-surface-2); transform: translateY(-1px); }
#app [data-panel="home"] .home-action-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--rm-accent-soft); color: var(--rm-accent-text); box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .2); }
#app [data-panel="home"] .home-action b { font-size: var(--rm-fs-base); font-weight: 650; }
#app [data-panel="home"] .home-action small { margin-top: 2px; color: var(--rm-muted); font-size: var(--rm-fs-sm); }
#app [data-panel="home"] .home-action > .ic { color: var(--rm-muted); transition: color .15s, transform .15s; }
#app [data-panel="home"] .home-action:hover > .ic { color: var(--rm-accent-text); transform: translateX(2px); }
#app [data-panel="home"] .hb-head { border-bottom-color: var(--rm-line); }
#app [data-panel="home"] .hb-head h3, #app [data-panel="home"] .genre-gallery-head h3 { font-size: var(--rm-fs-lg); font-weight: 700; letter-spacing: -.02em; }
#app [data-panel="home"] .home-publish { border-color: var(--rm-line); border-radius: var(--rm-r); background: var(--rm-surface); }

/* ----- Crear ----- */
#app [data-panel="create"] > .panel-head { border-bottom: 1px solid var(--rm-line); padding-bottom: 22px; margin-bottom: 24px; }
#app [data-panel="create"] #createForm { gap: 20px; }
#app [data-panel="create"] #createForm > .card { padding: 26px; border-color: var(--rm-line); background: var(--rm-surface); box-shadow: var(--rm-shadow-2); }
#app [data-panel="create"] #createForm > .card > .card-step { gap: 12px; font-size: var(--rm-fs-md); font-weight: 700; letter-spacing: -.01em; }
#app [data-panel="create"] #createForm > .card > .card-step > b {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--rm-accent-soft);
  color: var(--rm-accent-text);
  box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .3);
  font-size: var(--rm-fs-sm);
}
#app [data-panel="create"] .seg { padding: 4px; border-color: var(--rm-line); border-radius: 12px; background: var(--rm-inset); }
#app [data-panel="create"] .seg button { border-radius: 9px; color: var(--rm-muted); }
#app [data-panel="create"] .seg button small { color: #8a879d; }
#app [data-panel="create"] .seg button.on { background: var(--rm-surface-3); color: var(--rm-text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 12px -4px rgba(0, 0, 0, .6); }
#app [data-panel="create"] .seg button.on small { color: var(--rm-text-2); }
#app [data-panel="create"] .label { color: var(--rm-text-2); font-size: var(--rm-fs-sm); font-weight: 650; }
#app [data-panel="create"] #createForm #idea { min-height: 120px; padding: 14px 16px; border-color: var(--rm-line-2); background: var(--rm-inset); line-height: 1.6; }
body[data-tab="create"] #app .mgen .btn.primary { background: var(--rm-grad); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 14px 36px -12px rgba(116, 87, 242, .9); }
/* Un solo acento: el gancho deja el dorado y usa el violeta solo en el icono */
#app [data-panel="create"] .chip-hook { color: var(--rm-text-2) !important; border-color: var(--rm-line-2) !important; background: rgba(255, 255, 255, .03); }  /* styles.css lo marca con !important */
#app [data-panel="create"] .chip :is(.ic) { color: var(--rm-accent-text); }
#app [data-panel="create"] #modeSwitch { padding: 4px; border-color: var(--rm-line); border-radius: 12px; background: var(--rm-inset); }
#app [data-panel="create"] #modeSwitch button { border-radius: 9px; }
#app [data-panel="create"] #modeSwitch button.on { background: var(--rm-surface-3); box-shadow: inset 0 0 0 1px var(--rm-accent-line); }
#app [data-panel="create"] #formatOpts { gap: 10px; }
#app [data-panel="create"] #formatOpts .format-opt { border-color: var(--rm-line); border-radius: var(--rm-r); background: var(--rm-inset); transition: border-color .15s, background .15s; }
#app [data-panel="create"] #formatOpts .format-opt:hover { border-color: var(--rm-line-3); background: var(--rm-surface-2); }
#app [data-panel="create"] #formatOpts .format-opt.on { border-color: var(--rm-accent-line); background: linear-gradient(180deg, rgba(124, 95, 245, .16), rgba(124, 95, 245, .05)); box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .22); }
#app [data-panel="create"] #formatOpts .format-opt > span { border-radius: 10px; background: var(--rm-surface-3); color: var(--rm-text-2); }
#app [data-panel="create"] #formatOpts .format-opt.on > span { background: var(--rm-accent-soft); color: var(--rm-accent-text); }
#app [data-panel="create"] #formatOpts .format-opt small { color: var(--rm-muted); }
#app [data-panel="create"] .creator-production-action { border-color: var(--rm-line); border-radius: var(--rm-r); background: var(--rm-inset); }
#app [data-panel="create"] .creator-production-action:hover { border-color: var(--rm-accent-line); background: var(--rm-surface-2); }
#app [data-panel="create"] #createForm > .generate-card {
  border-color: rgba(160, 140, 255, .28);
  background: radial-gradient(ellipse 90% 50% at 100% 0%, rgba(124, 95, 245, .16), transparent 70%), var(--rm-surface);
}
#app [data-panel="create"] #createForm .create-summary > div { border-color: var(--rm-line); border-radius: 12px; background: var(--rm-inset); }
#app [data-panel="create"] #createForm .create-summary > div :is(b, strong) { color: var(--rm-text); }
#app [data-panel="create"] .tpl-wrap > summary, #app [data-panel="create"] .script-guide > summary { color: var(--rm-text-2); }

/* ----- Mis proyectos ----- */
#app [data-panel="drafts"] .dr-head {
  padding: 0 0 22px;
  margin-bottom: 18px;
  border: 0;
  border-bottom: 1px solid var(--rm-line);
  border-radius: 0;
  background: none;
}
#app [data-panel="drafts"] .dr-head-actions { gap: 10px; }
#app [data-panel="drafts"] .dr-head-actions .btn { min-height: 42px; padding-inline: 16px; }
#app [data-panel="drafts"] #draftsHome .dr-project-help { align-items: center; gap: 4px 18px; margin: 0 0 16px; }
#app [data-panel="drafts"] #draftsHome .dr-project-help .link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: var(--rm-fs-sm); font-weight: 600; text-decoration: none; }
#app [data-panel="drafts"] #draftsHome .dr-project-help .link:hover { text-decoration: underline; text-underline-offset: 3px; }
#app [data-panel="drafts"] .project-catalog {
  gap: 10px 14px;
  padding: 16px 18px;
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-r-lg);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-1);
}
#app [data-panel="drafts"] .project-catalog-field { color: var(--rm-muted); font-size: var(--rm-fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
#app [data-panel="drafts"] .project-catalog-field :is(input, select) { min-height: 42px; font-size: var(--rm-fs-base); letter-spacing: 0; text-transform: none; font-weight: 500; }
#app [data-panel="drafts"] .project-catalog #draftCatalogCount { color: var(--rm-muted); font-size: var(--rm-fs-sm); }
#app [data-panel="drafts"] .dr-grid { gap: 14px; }
#app [data-panel="drafts"] .dr-item {
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 14px;
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-r-lg);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-1);
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
#app [data-panel="drafts"] .dr-item:hover,
#app [data-panel="drafts"] .dr-item:focus-visible { border-color: var(--rm-accent-line); background: var(--rm-surface-2); transform: translateY(-2px); box-shadow: var(--rm-shadow-2); }
#app [data-panel="drafts"] .dr-cover {
  flex-basis: 72px;
  height: 92px;
  border: 1px solid rgba(160, 140, 255, .22);
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, rgba(124, 95, 245, .35), transparent 70%), var(--rm-surface-3);
  color: var(--rm-accent-text);
}
#app [data-panel="drafts"] .dr-item-body { gap: 4px; }
#app [data-panel="drafts"] .dr-item-body .dr-project-type { color: var(--rm-accent-text); font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#app [data-panel="drafts"] .dr-item-body b { font-size: var(--rm-fs-md); font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
#app [data-panel="drafts"] .dr-item-body small { color: var(--rm-text-2); font-size: var(--rm-fs-sm); }
#app [data-panel="drafts"] .dr-item-body small.muted { color: var(--rm-muted); font-size: var(--rm-fs-xs); }
#app [data-panel="drafts"] .dr-go { color: var(--rm-muted); transition: color .15s, transform .15s; }
#app [data-panel="drafts"] .dr-item:hover .dr-go { color: var(--rm-accent-text); transform: translateX(2px); }
#app [data-panel="drafts"] .empty { border-color: var(--rm-line-2); border-radius: var(--rm-r-lg); background: var(--rm-surface); }

@media (prefers-reduced-motion: reduce) {
  #app :is([data-panel="home"], [data-panel="create"], [data-panel="drafts"]) :is(.btn, .home-action, .dr-item, .home-action > .ic, .dr-go) { transition: none; transform: none !important; }
}

/* ---------------------------------------------------------------------------
   4) El mismo patrón en todas las demás pantallas y en los diálogos
   (especificidad baja con :where: los componentes con estilo propio lo conservan; aquí solo se unifica la base)
   --------------------------------------------------------------------------- */
/* Cabecera de pantalla: título macizo (sin el degradado recortado), subtítulo tenue y una línea debajo */
#app [data-panel] > .panel-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, var(--rm-fs-xl));
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--rm-text);
  background: none;
  -webkit-text-fill-color: currentColor;
}
#app [data-panel] > .panel-head h2 .ic { color: var(--rm-accent-text); -webkit-text-fill-color: initial; }
#app [data-panel] > .panel-head p { margin-top: 8px; max-width: 62ch; color: var(--rm-muted); font-size: var(--rm-fs-base); line-height: 1.55; }

:where(#app, .modal, dialog) .card {
  border: 1px solid var(--rm-line);
  border-radius: var(--rm-r-lg);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow-2);
}
:where(#app, .modal, dialog) .btn { border-radius: var(--rm-r-sm); font-weight: 650; letter-spacing: .005em; }
:where(#app, .modal, dialog) .btn.primary {
  background: var(--rm-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -10px rgba(116, 87, 242, .8);
}
:where(#app, .modal, dialog) .btn.ghost { background: rgba(255, 255, 255, .035); border-color: var(--rm-line-2); color: var(--rm-text); }
:where(#app, .modal, dialog) .btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .07); border-color: var(--rm-line-3); }
:where(#app, .modal, dialog) .btn.soft { background: var(--rm-accent-soft); border-color: rgba(160, 140, 255, .3); color: #ddd6ff; }
:where(#app, .modal, dialog) .btn.soft:hover:not(:disabled) { border-color: var(--rm-accent-line); color: #fff; }
:where(#app, .modal, dialog) .link { color: var(--rm-accent-text); }
:where(#app, .modal, dialog) :is(textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select) {
  border-color: var(--rm-line-2);
  border-radius: var(--rm-r-sm);
  background-color: var(--rm-inset);
}
:where(#app, .modal, dialog) :is(textarea, input, select):focus { border-color: var(--rm-accent-line); box-shadow: var(--rm-ring); }
:where(#app, .modal, dialog) :is(textarea, input)::placeholder { color: #8a879d; }
:where(#app, .modal, dialog) .chip { border-color: var(--rm-line-2); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--rm-text-2); }
:where(#app, .modal, dialog) .chip:hover { border-color: var(--rm-accent-line); color: var(--rm-text); }
:where(#app, .modal, dialog) .chip.on { border-color: var(--rm-accent-line); background: var(--rm-accent-soft); color: var(--rm-text); }
:where(#app, .modal, dialog) .seg { border-color: var(--rm-line); background: var(--rm-inset); }
:where(#app, .modal, dialog) .seg button.on { background: var(--rm-surface-3); color: var(--rm-text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 12px -4px rgba(0, 0, 0, .6); }
:where(#app) .qbadge { background: var(--rm-accent); }
:where(#app, .modal, dialog) .switch-row input:checked + .switch { background: var(--rm-accent); }

/* Estado vacío */
:where(#app) .empty { border: 1px dashed var(--rm-line-2); border-radius: var(--rm-r-lg); background: var(--rm-surface); }
:where(#app, .modal) :is(.empty-ico, .buy-done .buy-ico) { background: var(--rm-accent-soft); color: var(--rm-accent-text); box-shadow: inset 0 0 0 1px rgba(160, 140, 255, .25); }

/* Voz y doblaje: el botón principal es el de todo el estudio */
:where(.voz, .vz-example, #app) .vz-primary { background: var(--rm-grad); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -10px rgba(116, 87, 242, .8); }

/* ---------------------------------------------------------------------------
   5) Detalles por pantalla
   --------------------------------------------------------------------------- */
/* Invita y gana: la tarjeta dorada de comisión se queda (es el «premio»); el resto, en el sistema violeta */
#app .invite-program { --invite-line: var(--rm-line-2); }
#app .invite-program :focus-visible { outline-color: var(--rm-accent-text); }
#app .invite-program .invite-overview { border-color: var(--rm-line-2); background: radial-gradient(ellipse at 93% 0%, rgba(124, 95, 245, .16), transparent 58%), var(--rm-surface); box-shadow: var(--rm-shadow-2); }
#app .invite-program :is(.btn.primary, .btn.primary:active) { border-color: transparent; background: var(--rm-grad); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 22px -10px rgba(116, 87, 242, .8); }
#app .invite-program .btn.primary:hover { background: var(--rm-grad); border-color: transparent; filter: brightness(1.08); }
#app .invite-program .affiliate-link-card { border-color: var(--rm-accent-line); background: radial-gradient(ellipse 80% 90% at 0% 0%, rgba(124, 95, 245, .14), transparent 70%), var(--rm-surface); }
#app .invite-program .affiliate-link-card .invite-link input { color: var(--rm-text); background: var(--rm-inset); }
#app .invite-program .affiliate-application textarea { background: var(--rm-inset); }

/* Admin: el resumen de actividad no es un error (reusaba el marco rojo de «fallos») */
#app #adminFunnel { border-color: var(--rm-line); background: var(--rm-surface); }
#app .admin-nav button.on, #app .admin-nav button[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--rm-accent-line); }

/* Aviso flotante (#toast): en escritorio sale debajo de la barra superior, no encima de las secciones
   (con una ventana abierta sigue arriba del todo, como antes: styles.css). */
@media (min-width: 1024px) {
  body:has(#app:not([hidden])):not(:has(.modal:not([hidden]), .bot-panel:not([hidden]), .tour:not([hidden]), .take-panel:not([hidden]))) .toast { top: calc(var(--rm-topbar-h) + 14px); }
}
.toast { border-radius: var(--rm-r); background: rgba(24, 24, 35, .97); box-shadow: var(--rm-shadow-3); }
.toast .ic { color: var(--rm-accent-text); }
/* Herramienta abierta desde Voz y doblaje: sin pestañas ni subtítulo, la línea de la cabecera sobraba (salían dos) */
#app [data-panel="subs"].from-voz > .panel-head { border-bottom: 0; padding-bottom: 0; }
