/* Property Creator Studio — tema oscuro.
   Colores de marca tomados del icono (public/assets/propis-creator studio.webp): magenta → ámbar → verde → cian.
   Se usan con moderación (acciones primarias, foco, indicadores); las superficies son neutras para no competir con el logo.
   Contrastes (WCAG): texto 17:1, secundario 7.4:1, tenue 4.7:1, texto oscuro sobre el degradado primario ≥ 6:1. */

[hidden] {
  display: none !important;
}
:root {
  color-scheme: dark;
  --bg: #07080d;
  --surface: #0f111a;
  --surface-2: #161925;
  --surface-3: #1d2131;
  --elevated: #12141f;
  --border: #23283a;
  --border-strong: #343b55;
  --text: #eceef5;
  --muted: #9ba3b8;
  --subtle: #7d849a;
  --magenta: #ff3cac;
  --magenta-soft: #ff6ccb;
  --amber: #ffb547;
  --green: #3ee0a1;
  --cyan: #22d3ee;
  --cyan-bright: #2ee6ff;
  --brand-gradient: linear-gradient(110deg, #ff3cac 0%, #22d3ee 100%);
  --brand-glow: radial-gradient(
      60% 60% at 15% 0%,
      rgba(255, 60, 172, 0.1),
      transparent 70%
    ),
    radial-gradient(
      50% 50% at 100% 20%,
      rgba(34, 211, 238, 0.08),
      transparent 70%
    );
  --primary-ink: #0b0612;
  --danger: #ff7a85;
  --danger-solid: #e5484d;
  --ok: #3ee0a1;
  --warn: #ffc65c;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--cyan-bright);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 272px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--magenta-soft);
  text-underline-offset: 3px;
}
a:hover {
  color: #ff8fd8;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 6px;
}
h1 {
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
  font-weight: 700;
}
h2 {
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  margin: 0 0 0.75rem;
  font-weight: 650;
}
h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 650;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.big {
  font-size: 2.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0.25rem 0;
}
.error-text {
  color: var(--danger);
}
.form-error {
  color: var(--danger);
  margin: 0 0 10px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ───────── Shell: sidebar + contenido ───────── */
.shell {
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, #0c0e16 0%, #090a11 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--brand-glow) no-repeat;
}
.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 72px;
}
#outlet:focus {
  outline: none;
  box-shadow: none;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  border-radius: 10px;
}
.brand:hover {
  color: var(--text);
}
.brand-icon {
  display: block;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(255, 60, 172, 0.18));
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-size: 0.95rem;
}
.brand-text span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}
.brand-text strong {
  font-weight: 750;
  letter-spacing: -0.01em;
  font-size: 1.05rem;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-lg {
  flex-direction: column;
  text-align: center;
  gap: 12px;
  margin: 0 auto 1.25rem;
  display: flex;
  width: max-content;
}
.brand-lg .brand-text {
  align-items: center;
  font-size: 1.1rem;
}
.brand-lg .brand-text strong {
  font-size: 1.35rem;
}
.brand-compact .brand-text {
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
}
.brand-compact .brand-text span {
  font-size: 0.85rem;
}
.brand-compact .brand-text strong {
  font-size: 0.95rem;
}

.side-new {
  margin: 2px 0 0;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav a,
.recent-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.side-nav a:hover,
.recent-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.side-nav a.active {
  background: var(--surface-3);
  color: var(--text);
}
.side-nav a.active::before,
.recent-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-gradient);
}
.side-nav a.active svg {
  color: var(--magenta-soft);
}
.side-nav .badge {
  margin-left: auto;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.side-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px 2px;
}
.side-section-head h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--subtle);
  margin: 0;
  font-weight: 650;
}
.side-more {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
.side-more:hover {
  color: var(--text);
  text-decoration: underline;
}
.recent {
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.recent-item {
  font-weight: 500;
  font-size: 0.9rem;
  padding: 7px 10px;
}
.recent-item.active {
  background: var(--surface-2);
  color: var(--text);
}
.recent-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.recent-empty {
  padding: 6px 10px;
}
.recent-skeleton {
  height: 30px;
  margin: 2px 0;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    var(--surface) 0%,
    var(--surface-2) 50%,
    var(--surface) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--subtle);
  box-shadow: 0 0 0 3px rgba(125, 132, 154, 0.12);
}
.dot-ready {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(62, 224, 161, 0.14);
}
.dot-processing {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.16);
  animation: pulse 1.6s ease-in-out infinite;
}
.dot-error {
  background: var(--danger-solid);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.18);
}
.dot-empty {
  background: transparent;
  border: 1.5px solid var(--subtle);
  box-shadow: none;
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}
.side-credits {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(110deg, rgba(255, 60, 172, 0.45), rgba(34, 211, 238, 0.45))
      border-box;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s var(--ease);
}
.side-credits:hover {
  color: var(--text);
  transform: translateY(-1px);
}
.side-credits-label {
  font-size: 0.78rem;
  color: var(--muted);
}
.side-credits-value {
  grid-row: span 2;
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.side-credits-plan {
  font-size: 0.78rem;
  color: var(--subtle);
}
.side-credits.is-low .side-credits-value {
  color: var(--warn);
}
.side-dev {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-dev-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
}
.side-dev-label svg {
  width: 14px;
  height: 14px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 2px;
  border-top: 1px solid var(--border);
}
.side-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}
.side-user-text strong,
.side-user-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}
.side-user-text span {
  font-size: 0.75rem;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary-ink);
  background: var(--brand-gradient);
  flex: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-close {
  display: none;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(3, 4, 8, 0.6);
  backdrop-filter: blur(2px);
  animation: fade-in 0.2s var(--ease);
}
.mobile-bar {
  display: none;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.26s var(--ease), visibility 0s linear 0.26s;
    width: min(86vw, 320px);
  }
  .shell.nav-open .sidebar {
    transform: none;
    visibility: visible;
    box-shadow: var(--shadow-lg);
    transition: transform 0.26s var(--ease);
  }
  .sidebar-close {
    display: inline-grid;
  }
  .main {
    margin-left: 0;
  }
  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(7, 8, 13, 0.85);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .mobile-bar .badge-link {
    margin-left: auto;
  }
  .content {
    padding: 20px 16px 64px;
  }
}
@media (max-width: 380px) {
  .brand-compact .brand-text span {
    display: none;
  }
}

/* ───────── Banners, tarjetas y cabeceras ───────── */
.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  padding: 10px 32px;
  background: rgba(255, 181, 71, 0.08);
  color: #ffd99a;
  border-bottom: 1px solid rgba(255, 181, 71, 0.22);
  font-size: 0.9rem;
}
.banner .link {
  color: #ffd99a;
}
.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: var(--muted);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.card-head h2 {
  margin: 0;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.project-card {
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  transition: border-color 0.15s, transform 0.15s var(--ease),
    background-color 0.15s;
}
.project-card:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--elevated);
  transform: translateY(-2px);
}
.project-card h3 {
  overflow-wrap: anywhere;
}
.project-card p {
  margin: 0;
}
.project-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 6px;
}

/* ───────── Botones y formularios ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 15px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.1s var(--ease), box-shadow 0.15s, filter 0.15s;
}
.btn:hover {
  background: var(--surface-3);
  border-color: #444c6b;
  color: var(--text);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn-primary {
  border: none;
  background: var(--brand-gradient);
  border-color: transparent;
  color: var(--primary-ink);
  box-shadow: 0 6px 20px -8px rgba(255, 60, 172, 0.55);
}
.btn-primary:hover {
  background: var(--brand-gradient);
  color: var(--primary-ink);
  filter: brightness(1.08);
  border-color: transparent;
}
.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  color: #ffa3ab;
  border-color: rgba(255, 122, 133, 0.5);
}
.btn-danger-solid {
  background: var(--danger-solid);
  border-color: var(--danger-solid);
  color: #fff;
}
.btn-danger-solid:hover {
  background: #f25c61;
  color: #fff;
}
.btn-ghost {
  background: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-small {
  padding: 5px 11px;
  font-size: 0.84rem;
  min-height: 32px;
  border-radius: 8px;
}
.btn-block {
  width: 100%;
}
.btn.is-loading {
  position: relative;
  color: transparent !important;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 1em;
  height: 1em;
  border: 2px solid var(--text);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-primary.is-loading::after {
  border-color: var(--primary-ink);
  border-right-color: transparent;
}
.btn.is-loading svg {
  opacity: 0;
}
.link {
  background: none;
  border: none;
  color: var(--magenta-soft);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.badge {
  display: inline-block;
  background: rgba(255, 181, 71, 0.14);
  color: var(--amber);
  border: 1px solid rgba(255, 181, 71, 0.3);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.badge-link {
  text-decoration: none;
}
.badge-link:hover {
  color: var(--amber);
  background: rgba(255, 181, 71, 0.22);
}

label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 550;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  background: #0b0d15;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input::placeholder,
textarea::placeholder {
  color: #6a7187;
}
input:hover,
select:hover,
textarea:hover {
  border-color: #454d6c;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.22);
}
input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 122, 133, 0.15);
}
.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 6px;
  font-weight: 500;
}
input.is-filled {
  animation: filled 1.2s var(--ease);
}
@keyframes filled {
  0% {
    background-color: rgba(34, 211, 238, 0.16);
    border-color: var(--cyan);
  }
  100% {
    background-color: #0b0d15;
  }
}
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-form input {
  margin: 0;
  min-width: 260px;
  flex: 1;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.span-2 {
  grid-column: span 2;
}
.form-section-title {
  grid-column: 1 / -1;
  margin: 6px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--subtle);
  font-weight: 650;
}
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.form-note {
  color: var(--subtle);
  font-size: 0.8rem;
  margin: 0 0 12px;
  transition: color 0.2s;
}
.form-note.is-short {
  color: var(--warn);
}

/* ───────── Autenticación ───────── */
.auth-body {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(
      50% 40% at 50% 0%,
      rgba(255, 60, 172, 0.14),
      transparent 70%
    ),
    radial-gradient(
      40% 40% at 90% 100%,
      rgba(34, 211, 238, 0.1),
      transparent 70%
    ),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 17, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}
.auth-card h1 {
  font-size: 1.35rem;
  text-align: center;
}
.auth-card .btn-primary {
  width: 100%;
  margin-top: 4px;
}
.auth-card > p.muted,
.auth-card > p {
  text-align: center;
}
.auth-foot {
  margin: 0;
  text-align: center;
}
/* Enlaces legales en entrar / crear cuenta (ciclo 12) */
.auth-terms {
  font-size: 0.8rem;
  margin: 0 0 4px;
}
.auth-legal {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
}
.auth-legal a {
  color: inherit;
}

/* ───────── Editor ───────── */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
.step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 750;
  margin-right: 8px;
  color: var(--primary-ink);
  background: var(--brand-gradient);
  vertical-align: 1px;
}
.dropzone {
  display: block;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.01);
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
  margin: 0;
}
.dropzone:hover {
  border-color: #4a5375;
  color: var(--text);
}
.dropzone.over {
  border-color: var(--cyan);
  color: var(--text);
  background: rgba(34, 211, 238, 0.06);
}
.dropzone u {
  color: var(--magenta-soft);
}
.upload-queue {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.upload-queue li {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.85rem;
  padding: 4px 0;
  color: var(--muted);
}
.upload-queue li.error {
  color: var(--danger);
}
.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.upload-item.done {
  opacity: 0.6;
}
progress {
  accent-color: var(--magenta);
  height: 6px;
}
.scenes {
  list-style: none;
  padding: 0;
  margin: 0;
}
.scene {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.scene img,
.scene .thumb {
  width: 104px;
  height: 74px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-3);
}
.scene-title {
  font-size: 0.9rem;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.scene-fields {
  display: flex;
  gap: 10px;
}
.scene-fields label {
  margin: 0;
  font-size: 0.78rem;
}
.scene-fields input[type="number"] {
  width: 92px;
}
.scene-fields .grow {
  flex: 1;
}
.scene-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 650;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 8px;
  background: var(--surface-3);
  vertical-align: 1px;
}
.tag-ffmpeg {
  background: rgba(255, 60, 172, 0.12);
  color: var(--magenta-soft);
}
.tag-video {
  background: rgba(62, 224, 161, 0.12);
  color: var(--ok);
}
.estimate {
  margin: 10px 0 12px;
  font-size: 0.9rem;
  min-height: 3.2em;
  display: grid;
  gap: 4px;
}
.estimate-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.estimate-row strong {
  font-variant-numeric: tabular-nums;
}
.estimate .is-short {
  color: var(--warn);
}
.renders {
  list-style: none;
  padding: 0;
  margin: 0;
}
.render {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.render:first-child {
  border-top: 0;
  padding-top: 0;
}
.render progress {
  width: 100%;
}
.render-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Progreso del render activo junto al botón «Renderizar» (visible en escritorio aunque «Renders» quede bajo el pliegue). */
.render-status {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  scroll-margin-bottom: 120px; /* los avisos (abajo a la derecha) no lo tapan al desplazarlo a la vista */
}
.render-status[hidden] {
  display: none;
}
.render-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.render-status-pct {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.render-status progress {
  width: 100%;
}
.render-status p {
  margin: 0;
}
.status {
  font-size: 0.78rem;
  font-weight: 700;
}
.status-succeeded {
  color: var(--ok);
}
.status-failed {
  color: var(--danger);
}
.status-running,
.status-queued,
.status-retry_wait {
  color: var(--warn);
}
.status-cancelled,
.status-cancel_requested {
  color: var(--subtle);
}

/* ───────── Planes y tablas ───────── */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.plan {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--elevated);
}
.plan.current {
  background: linear-gradient(var(--elevated), var(--elevated)) padding-box,
    var(--brand-gradient) border-box;
  border: 1px solid transparent;
}
.plan .price {
  font-size: 1.35rem;
  font-weight: 750;
  margin: 0.25rem 0 0.5rem;
}
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th {
  text-align: left;
  color: var(--subtle);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px;
}
.table td {
  text-align: left;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.neg {
  color: var(--danger);
}

/* ───────── Estados ───────── */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
}
.boot-loader img {
  animation: pulse 1.6s ease-in-out infinite;
}
.view-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 40px 16px;
  justify-content: center;
  grid-column: 1 / -1;
}
.empty-state {
  padding: 36px 20px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  grid-column: 1 / -1;
  color: var(--muted);
}
.empty-state strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.state-error {
  padding: 16px;
  border: 1px solid rgba(255, 122, 133, 0.45);
  background: rgba(229, 72, 77, 0.06);
  border-radius: var(--radius);
  color: var(--danger);
  grid-column: 1 / -1;
}
.noscript {
  padding: 24px;
  text-align: center;
}

/* ───────── Diálogos ───────── */
.dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: var(--surface);
  color: var(--text);
  width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}
.dialog[open] {
  animation: dialog-in 0.2s var(--ease);
}
.dialog::backdrop {
  background: rgba(3, 4, 8, 0.65);
  backdrop-filter: blur(3px);
}
.dialog-title {
  font-size: 1.1rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.dialog-actions-wrap {
  flex-wrap: wrap;
}
.dialog-video {
  background: #000;
  width: auto;
  max-width: 92vw;
  padding: 12px;
}
.dialog-video video {
  max-height: 78vh;
  max-width: 88vw;
  display: block;
  border-radius: 8px;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ───────── Avisos (toasts) ───────── */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #151826;
  color: var(--text);
  padding: 12px 10px 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--cyan);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.28s var(--ease) both;
}
.toast[data-kind="success"] {
  border-left-color: var(--ok);
}
.toast[data-kind="warning"] {
  border-left-color: var(--warn);
}
.toast[data-kind="error"] {
  border-left-color: var(--danger-solid);
}
.toast.is-leaving {
  animation: toast-out 0.22s var(--ease) forwards;
}
.toast.is-bumped {
  animation: toast-bump 0.35s var(--ease);
}
.toast-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}
.toast-title {
  font-weight: 600;
}
.toast-detail {
  color: var(--muted);
  font-size: 0.85rem;
}
.toast-action {
  align-self: flex-start;
  font-weight: 650;
  font-size: 0.85rem;
  margin-top: 2px;
}
.toast-close {
  border: 0;
  background: transparent;
  color: var(--subtle);
  font-size: 1.25rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  flex: none;
}
.toast-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes toast-bump {
  40% {
    transform: scale(1.02);
  }
}

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .editor {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: auto;
  }
  .scene {
    grid-template-columns: 76px 1fr;
  }
  .scene img,
  .scene .thumb {
    width: 76px;
    height: 56px;
  }
  .scene-actions {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    grid-column: span 2;
  }
  .scene-fields {
    flex-wrap: wrap;
  }
  .inline-form input {
    min-width: 0;
  }
  .banner {
    padding: 10px 16px;
  }
  .card {
    padding: 16px;
  }
  .toasts {
    right: 16px;
    bottom: 16px;
  }
  h1 {
    font-size: 1.4rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ───────── Ciclo 4: autoguardado, tipo de render y foto de perfil ───────── */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}
.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.save-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}
.save-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.save-status[data-state="saved"] .save-icon {
  color: var(--ok);
}
.save-status[data-state="offline"] {
  color: var(--warn);
}
.save-status[data-state="error"] {
  color: var(--danger);
}
.save-detail {
  flex-basis: 100%;
  font-size: 0.75rem;
  max-width: 34ch;
}
.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  animation: save-pulse 1s ease-in-out infinite alternate;
}
@keyframes save-pulse {
  from {
    opacity: 0.35;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.engine-picker {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
}
.engine-picker legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 0;
}
.engine-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  margin: 0;
}
.engine-option:hover {
  border-color: var(--border-strong);
}
.engine-option:has(input:checked) {
  border-color: var(--magenta);
  background: rgba(255, 60, 172, 0.06);
}
.engine-option:has(input:focus-visible) {
  box-shadow: var(--focus);
}
/* Los inputs globales son de ancho completo: los radios del selector y del recorte recuperan su tamaño natural. */
.engine-option input[type="radio"],
.crop-options input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--magenta);
  flex: none;
}
.engine-option .engine-body {
  flex: 1;
}
.engine-option.is-disabled {
  cursor: not-allowed;
  background: transparent;
}
.engine-option.is-disabled .engine-title strong,
.engine-option.is-disabled .engine-body > .muted {
  color: var(--subtle);
}
.engine-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.engine-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.engine-cost {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.engine-note {
  color: var(--warn);
}
.tag-ai {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan-bright);
}
.tag-classic {
  background: var(--surface-3);
  color: var(--muted);
}
.project-state .tag {
  margin-left: 6px;
}

.avatar-img {
  object-fit: cover;
  background: var(--surface-3);
}
.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 2rem;
}
.side-avatar {
  display: inline-flex;
  border-radius: 50%;
  text-decoration: none;
  flex: none;
}
.avatar-editor {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.avatar-controls {
  flex: 1 1 220px;
  min-width: 0;
}
.avatar-controls .muted {
  margin: 8px 0;
}
.dropzone-compact {
  padding: 16px 12px;
}
.crop-stage {
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}
.crop-canvas {
  width: min(256px, 70vw);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}
.crop-options {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
  display: grid;
  gap: 6px;
}
.crop-options .check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
/* Siempre visible mientras se edita (abajo a la izquierda; los avisos van abajo a la derecha). */
.save-dock {
  position: fixed;
  left: calc(var(--sidebar-w) + 24px);
  bottom: 20px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(460px, calc(100vw - var(--sidebar-w) - 48px));
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 17, 26, 0.94);
  box-shadow: var(--shadow);
}
.save-dock:has(.save-status:not([data-state="saved"])) {
  border-color: var(--border-strong);
  border-radius: var(--radius);
}
.editor {
  padding-bottom: 64px;
}
@media (max-width: 1023px) {
  .save-dock {
    left: 16px;
    bottom: 16px;
    max-width: calc(100vw - 32px);
  }
}

/* ───────── Ciclo 5: el tipo de render dicta el paso 2 ───────── */
[data-mode]:not([hidden]) {
  animation: mode-in 0.18s var(--ease);
}
@keyframes mode-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.upload-hint {
  margin: 10px 0 0;
  color: var(--cyan-bright);
}
.ai-flow > p:first-child {
  margin-top: 0;
}
.ai-templates {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ai-templates legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 0;
}
.ai-template {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.ai-template:hover {
  border-color: var(--border-strong);
}
.ai-template:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
}
.ai-template:has(input:focus-visible) {
  box-shadow: var(--focus);
}
.ai-template input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--cyan);
  flex: none;
}
.ai-template-body {
  display: flex;
  gap: 2px;
  min-width: 0;
}
.ai-template-body strong {
  color: var(--text);
}
.ai-prompt textarea {
  resize: vertical;
  min-height: 8em;
  line-height: 1.5;
}
.ai-prompt-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.ai-prompt-count {
  flex: none;
  font-variant-numeric: tabular-nums;
}
textarea.is-filled {
  animation: filled 1.2s var(--ease);
}
.ai-preview-note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 198, 92, 0.35);
  border-radius: var(--radius-sm);
  color: var(--warn);
  background: rgba(255, 198, 92, 0.06);
}
.ai-duration {
  align-items: center;
  margin-top: 4px;
}
.ai-duration label {
  margin: 0;
  font-weight: 400;
  font-size: 0.9rem;
}
.ai-duration-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
.ai-duration-field input {
  width: 5.5em;
  margin: 0;
  padding: 6px 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ai-duration-help {
  margin: 4px 0 0;
}
@media (max-width: 640px) {
  .ai-templates {
    grid-template-columns: 1fr;
  }
}

/* ───────── Interruptor de textos, título destacado y ficha técnica (2026-10-19) ───────── */
.title-field {
  font-size: 0.82rem;
  margin-bottom: 18px;
}
.title-input {
  font-size: 1.25rem;
  font-weight: 650;
  padding: 12px 14px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
  position: relative;
}
.switch input[type="checkbox"] {
  position: absolute;
  z-index: 1; /* encima del track: es el input quien recibe el clic */
  opacity: 0;
  width: 44px;
  height: 24px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}
.switch-track {
  flex: none;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background-color 0.18s, border-color 0.18s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s var(--ease), background-color 0.18s;
}
.switch input:checked + .switch-track {
  background: rgba(255, 60, 172, 0.25);
  border-color: var(--magenta);
}
.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  background: var(--magenta-soft);
}
.switch input:focus-visible + .switch-track {
  box-shadow: var(--focus);
}
.texts-note {
  margin: 0 0 12px;
}
.scene-fields .is-off {
  opacity: 0.45;
  filter: grayscale(0.6);
}
.ficha-help {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ───────── Editor con acordeones (2026-10-19) ───────── */
.title-heading {
  flex: 1 1 320px;
  margin: 0;
  min-width: 0;
}
.title-heading .title-input {
  margin: 0;
  width: 100%;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  padding: 6px 10px;
  border-color: transparent;
  background: transparent;
}
.title-heading .title-input:hover {
  border-color: var(--border);
}
.title-heading .title-input:focus {
  border-color: var(--border-strong);
  background: #0b0d15;
}
.accordion {
  padding: 0;
}
.accordion-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius-lg);
}
.accordion-head::-webkit-details-marker {
  display: none;
}
.accordion-head:hover {
  background: rgba(255, 255, 255, 0.02);
}
.accordion-head:focus-visible {
  box-shadow: var(--focus);
}
.accordion-title {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.accordion-title strong {
  font-size: 1.05rem;
}
.accordion-summary {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accordion-summary.is-empty {
  color: var(--subtle);
  font-style: italic;
}
.accordion-chevron {
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin: 0 6px 4px 0;
  transition: transform 0.18s var(--ease);
}
.accordion[open] .accordion-chevron {
  transform: rotate(-135deg);
  margin-bottom: -4px;
}
.accordion-body {
  padding: 0 20px 20px;
}
.accordion-actions {
  margin-bottom: 14px;
}
/* Panel IA: «Modo Libre» (prompt propio) frente a plantillas; prompt interno solo para el usuario de desarrollo. */
.ai-panel {
  display: grid;
  gap: 18px;
}
.ai-free {
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.ai-free .switch-label {
  font-size: 0.95rem;
}
.ai-free p {
  margin: 6px 0 0;
}
.ai-block[hidden] {
  display: none;
}
.ai-prompt #ai-prompt-help {
  margin: 0;
}
.ai-next {
  margin: 0;
}
.ai-dev {
  border: 1px dashed rgba(255, 198, 92, 0.5);
  border-radius: var(--radius-sm);
  background: rgba(255, 198, 92, 0.04);
}
.ai-dev > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warn);
}
.ai-dev-body {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}
.ai-dev-prompt {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-dev-prompt[aria-busy="true"] {
  opacity: 0.6;
}
.ai-dev-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  margin: 0 0 10px;
}
.substep {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--cyan);
  color: var(--cyan-bright);
}
@media (max-width: 640px) {
  .accordion-head {
    padding: 16px;
  }
  .accordion-body {
    padding: 0 16px 16px;
  }
  .title-heading .title-input {
    font-size: 1.3rem;
  }
}

/* ───────── Flujos desacoplados: referencias IA y archivos fuera del tour (2026-10-19) ───────── */
.ai-references {
  margin-bottom: 18px;
}
.refs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.refs-head .ai-step-title {
  margin: 0;
}
.refs {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.ref {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ref:first-child {
  border-color: var(--cyan);
}
.ref.is-dragging {
  opacity: 0.6;
  border-style: dashed;
  border-color: var(--magenta);
  box-shadow: var(--shadow);
}
.ref img,
.ref .thumb,
.ref-available img,
.scenes-available img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
  background: var(--surface-3);
}
.ref-handle {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(7, 8, 13, 0.85);
  color: var(--text);
  cursor: grab;
  touch-action: none;
  font-size: 1rem;
  line-height: 1;
}
.ref-handle:active {
  cursor: grabbing;
}
.ref-index {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-ink);
  background: var(--cyan-bright);
}
.ref-name {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.ref-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.refs-empty {
  color: var(--warn);
  font-size: 0.85rem;
}
.refs-available ul,
.scenes-available {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.ref-available,
.scenes-available li {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  opacity: 0.9;
}
.scenes-available-box:not(:empty) {
  margin-top: 14px;
}

/* El indicador de guardado es fijo abajo: al desplazarse por foco (teclado) o scrollIntoView, el elemento queda por encima
   de él y no tapado (WCAG 2.4.11, foco no oculto). */
html {
  scroll-padding-bottom: 96px;
}

/* ───────── Marca de agua: switch + tooltip del plan (2026-10-19) ───────── */
.watermark-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 10px;
}
.watermark-row.is-locked .switch {
  cursor: not-allowed;
}
.watermark-row.is-locked .switch-track {
  opacity: 0.75;
}
.info-btn {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
  font: italic 700 0.8rem/1 Georgia, serif;
  cursor: pointer;
}
.info-btn[aria-expanded="true"] {
  border-color: var(--cyan);
  color: var(--cyan-bright);
}
.plan-tip {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--elevated);
  box-shadow: var(--shadow-lg);
  font-size: 0.82rem;
  color: var(--text);
}
.plan-tip p {
  margin: 0 0 6px;
}

/* ───────── Datos del inmueble: atributos dinámicos (2026-10-20) ───────── */
.attrs {
  display: grid;
  gap: 12px;
}
.attrs-search label {
  margin-bottom: 0;
}
.chips-title {
  margin: 6px 0 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  padding: 5px 11px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.chip:hover {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}
.attr-results {
  margin-top: 6px;
}
.chip.is-added {
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.1);
  color: var(--muted);
}
.chip-cat {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.attr-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.attr-tab {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 8px 12px;
  margin-bottom: -1px;
  cursor: pointer;
}
.attr-tab:hover {
  color: var(--text);
}
.attr-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--cyan);
  font-weight: 600;
}
.attr-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.attr-tab-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}
.attr-more {
  justify-self: start;
  margin-top: 6px;
}
.attr-panel {
  display: grid;
}
.attrs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.attr-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 8px;
}
.attr-row label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
}
.attr-row input {
  margin: 0;
}
.attrs-empty {
  padding: 8px 0;
}
@media (max-width: 640px) {
  .attr-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .attr-row label {
    grid-column: 1 / -1;
  }
}

/* ───────── Editor en 6 bloques (2026-10-20): pasos 1–5 a la izquierda, paso 6 (resumen + render) a la derecha ───────── */
.step-sub {
  width: auto;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
}
.engine-picker-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.video-config {
  display: grid;
  gap: 10px;
}
.video-config label {
  margin: 0;
}
.video-config > .estimate-row,
.video-config > p {
  margin: 0;
}
/* Paso 4: el editor dinámico se distingue del resto y cambia de acento según el método (Clásico azul-gris / IA magenta-cian). */
.flow-card {
  --flow-accent: #6b8bd6;
  --flow-tint: rgba(107, 139, 214, 0.07);
  position: relative;
  border-color: color-mix(in srgb, var(--flow-accent) 45%, var(--border));
  background: linear-gradient(var(--flow-tint), var(--flow-tint)),
    var(--surface);
  box-shadow: inset 4px 0 0 var(--flow-accent);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.flow-card[data-flow="ai"] {
  --flow-accent: var(--magenta);
  --flow-tint: rgba(255, 60, 172, 0.07);
  box-shadow: inset 4px 0 0 var(--magenta),
    inset 0 2px 0 rgba(34, 211, 238, 0.6);
}
.flow-badge {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--flow-accent);
  border: 1px solid color-mix(in srgb, var(--flow-accent) 55%, transparent);
}
.flow-card h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
/* Paso 6: resumen */
.summary {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  font-size: 0.88rem;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.summary-row dt {
  color: var(--muted);
}
.summary-row dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.summary-title {
  margin: 12px 0 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.render-card .estimate {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
/* Barra fija de renderizar: solo en una columna (en escritorio el botón está en el panel lateral). */
.render-bar {
  display: none;
}
@media (max-width: 1100px) {
  :root {
    --render-bar-h: 64px;
  }
  .render-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: var(--render-bar-h);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-strong);
    background: rgba(15, 17, 26, 0.96);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  }
  .render-bar-info {
    color: var(--muted);
    min-width: 0;
  }
  .render-bar .btn {
    flex: none;
  }
  /* Nada queda debajo de la barra: contenido, dock de guardado y avisos suben. */
  .editor {
    padding-bottom: calc(var(--render-bar-h) + 72px);
  }
  .save-dock {
    bottom: calc(var(--render-bar-h) + 12px);
  }
  body:has(.render-bar) .toasts {
    bottom: calc(var(--render-bar-h) + 12px);
  }
  .render-status {
    scroll-margin-bottom: calc(var(--render-bar-h) + 120px);
  }
}
@media (max-width: 640px) {
  .engine-picker-row {
    grid-template-columns: 1fr;
  }
}

/* ───────── Paso 5 «Elementos adicionales» (tarjeta, sin acordeón): 3 switches a todo el ancho ───────── */
.extras {
  display: grid;
  gap: 10px;
  width: 100%;
}
.extra-option {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
/* A. Marca de agua: toggle principal del panel */
.extra-main {
  border-color: var(--border-strong);
  background: linear-gradient(
      rgba(34, 211, 238, 0.05),
      rgba(34, 211, 238, 0.05)
    ),
    var(--surface-2);
}
.extra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
}
.extra-head .switch {
  margin: 0;
  flex: 1;
}
.extra-head .switch-label {
  font-weight: 600;
}
.extra-help {
  margin: 0;
}
.extra-fields {
  margin-top: 6px;
}
.extra-fields[hidden] {
  display: none;
}
.extra-option.is-off .switch-label {
  color: var(--muted);
}
.extras .texts-note {
  margin: 2px 0 0;
}

/* ───────── Paso 6: «Detalles del inmueble» (validación global: ⚠ < 15 atributos, ✓ desde 15) ───────── */
.quality {
  --q: var(--warn);
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--q) 40%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--q) 6%, transparent);
}
.quality[data-level="high"] {
  --q: var(--ok);
}
.quality-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.quality-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--primary-ink);
  background: var(--q);
}
.quality-label {
  margin-left: auto;
  color: var(--q);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Estilo explícito: la pista nativa es oscura y no se distinguía sobre el fondo de la tarjeta. */
.quality progress {
  appearance: none;
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.quality progress::-webkit-progress-bar {
  background: var(--surface-3);
  border-radius: 999px;
}
.quality progress::-webkit-progress-value {
  background: var(--q);
  border-radius: 999px;
}
.quality progress::-moz-progress-bar {
  background: var(--q);
  border-radius: 999px;
}
.quality-msg {
  margin: 0;
  color: var(--text);
}
.link-btn {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--cyan-bright);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Música de fondo (paso 5) y presentador (panel IA): switch + selector compacto con play (recursos incluidos) ── */
.music-compact,
.voice-compact {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 34rem;
}
.music-compact select,
.voice-compact select {
  flex: 1;
  min-width: 0;
}
.voice-compact label {
  flex: none;
  margin: 0;
  color: var(--muted);
}
.music-play,
.ai-voice-play {
  flex: none;
  min-width: 2.75rem;
}
.music-play[aria-pressed="true"],
.ai-voice-play[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--cyan);
}
.presenter-fields {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.ai-presenters {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
}
.ai-presenter {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  min-width: 0;
}
.ai-presenter:hover {
  border-color: var(--border-strong);
}
.ai-presenter:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.06);
}
.ai-presenter:has(input:focus-visible) {
  box-shadow: var(--focus);
}
.ai-presenter input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--cyan);
  flex: none;
}
.ai-presenter-body {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ai-presenter-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-presenter-thumb {
  width: 44px;
  height: 56px;
  flex: none;
  overflow: hidden;
  border-radius: calc(var(--radius) / 2);
  background: #fff;
}
/* La imagen es una hoja de personaje (4 vistas): la miniatura muestra cara y torso de la vista frontal (izquierda). */
.ai-presenter-thumb img {
  display: block;
  width: 250px;
  max-width: none;
  height: auto;
  margin: -6px 0 0 -13px;
}

/* ── Ambientes (panel IA): chips de ambiente y de género del presentador; detalle con atuendo y música ── */
.gender-choice {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gender-choice {
  margin-top: 8px;
}
.chip-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.chip-radio > span {
  display: grid;
  gap: 1px;
}
.chip-radio:hover {
  border-color: var(--border-strong);
}
.chip-radio:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}
.chip-radio:has(input:focus-visible) {
  box-shadow: var(--focus);
}
.chip-radio input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--cyan);
}
.music-override {
  margin: 6px 0 0;
}

/* ── Tooltip «?» (infoTip.js): explicación larga fuera del texto visible; hover/foco en escritorio, toque en móvil ── */
.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
}
.info-tip-btn {
  width: 20px;
  height: 20px;
  font: 700 0.72rem/1 inherit;
  font-style: normal;
  color: var(--muted);
}
.info-tip-btn:hover,
.info-tip.is-open .info-tip-btn {
  border-color: var(--cyan);
  color: var(--cyan-bright);
}
.info-tip-btn:focus-visible {
  box-shadow: var(--focus);
  outline: none;
}
.info-tip-bubble {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: -8px;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--elevated);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-weight: 400;
  white-space: normal;
  text-align: left;
  line-height: 1.45;
}
.info-tip.tip-right .info-tip-bubble {
  left: auto;
  right: -8px;
}
/* Móvil: la burbuja ocupa el ancho de la ventana (la posición vertical la fija infoTip.js) */
.info-tip.tip-fixed .info-tip-bubble {
  position: fixed;
  left: 16px;
  right: 16px;
  width: auto;
  max-width: none;
}
.ai-block-head {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-block-head .ai-step-title {
  margin: 0;
}
.ai-free-line {
  margin: 4px 0 0;
}

/* ── Carrusel de ambientes (ambientePicker.js) ── */
.carousel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: 8px 0 10px;
}
.carousel-nav {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.carousel-nav:disabled {
  opacity: 0.35;
  cursor: default;
}
.carousel-nav:not(:disabled):hover {
  border-color: var(--cyan);
}
.carousel-track {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 2px 2px 6px;
  border: 0;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  cursor: grab;
}
.carousel-track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
  user-select: none;
}
.amb-card {
  position: relative;
  flex: 0 0 96px;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 6px 4px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  scroll-snap-align: start;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.amb-card:hover {
  border-color: var(--border-strong);
}
.amb-card.is-selected,
.amb-card:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}
.amb-card:has(input:focus-visible) {
  box-shadow: var(--focus);
}
/* radio accesible (teclado y lector de pantalla) pero invisible: la tarjeta es el control */
.amb-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
/* Miniatura: vista frontal (izquierda) de cuerpo entero de la hoja de 4 vistas del atuendo (1376×768) */
.amb-thumb {
  width: 60px;
  height: 104px;
  overflow: hidden;
  border-radius: calc(var(--radius) / 2);
  background: #fff;
}
.amb-thumb img {
  display: block;
  width: 191px;
  max-width: none;
  height: auto;
  margin: -2px 0 0 -2px;
  pointer-events: none;
}
.amb-name {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

/* ── Tarjeta de resumen del ambiente: presentador (atuendo) | música ▶ ── */
.amb-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.85rem;
}
.amb-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.amb-summary-sep {
  color: var(--border-strong);
}
.amb-summary-thumb {
  width: 22px;
  height: 38px;
  flex: none;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
}
.amb-summary-thumb img {
  display: block;
  width: 70px;
  max-width: none;
  height: auto;
}
.render-summary {
  margin-top: 2px;
}
@media (max-width: 640px) {
  .amb-summary-sep {
    display: none;
  }
  .amb-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}
