/* Writenox Studio stylesheet: minor update committed */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-2: #101011;
  --ink: #f7f7f4;
  --muted: #aaa9a5;
  --soft: #747474;
  --panel: rgba(16, 16, 17, 0.86);
  --panel-2: rgba(24, 24, 25, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.28);
  --cyan: #f2f2ee;
  --coral: #d6d6d3;
  --gold: #ffffff;
  --green: #dededa;
  --violet: #a7a7a3;
  --danger: #d8d8d5;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --radius: 8px;
  --max: 1360px;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3ee;
  --bg-2: #e4e4dc;
  --ink: #080808;
  --muted: #575752;
  --soft: #777770;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-2: rgba(246, 246, 240, 0.94);
  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.28);
  --cyan: #101010;
  --coral: #343431;
  --gold: #050505;
  --green: #30302d;
  --violet: #5f5f58;
  --danger: #1c1c1a;
  --shadow: 0 24px 70px rgba(22, 22, 18, 0.15);
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  /* clip (no hidden): recorta el overflow horizontal sin crear un scroll
     container, que rompería todos los position: sticky de la página. */
  overflow-x: clip;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 170px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent 30%, rgba(255, 255, 255, 0.025) 70%, transparent),
    linear-gradient(180deg, var(--bg), #0d0d0e 52%, #050505);
  overflow-x: clip;
}

body[data-theme="light"] {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.075), transparent 170px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035), transparent 30%, rgba(0, 0, 0, 0.025) 70%, transparent),
    linear-gradient(180deg, var(--bg), #ffffff 54%, #ecece6);
}

body::selection {
  color: #0a0908;
  background: var(--gold);
}

body[data-theme="light"]::selection {
  color: #ffffff;
  background: #111111;
}

body.auth-locked .lead,
body.auth-locked .workflow-nav,
body.auth-locked .command-center,
body.auth-locked .security-strip,
body.auth-locked .step-section,
body.auth-locked .workspace,
body.auth-locked .result-panel,
body.auth-locked .video-studio,
body.auth-locked .footer {
  display: none !important;
}

body.auth-locked .auth-panel {
  display: grid;
  margin-top: 42px;
  min-height: calc(100vh - 160px);
  align-items: center;
}

button, input, textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
.choice,
.template,
.chip,
.mini,
.action-btn,
.stage-card,
.growth-card,
.resource-card,
.result-panel {
  overflow-wrap: anywhere;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: paint;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.scan-field {
  position: absolute;
  inset: -20% -12%;
  opacity: 0.38;
  background:
    repeating-linear-gradient(115deg, transparent 0 72px, rgba(255, 255, 255, 0.05) 72px 74px, transparent 74px 138px),
    repeating-linear-gradient(0deg, transparent 0 118px, rgba(255, 255, 255, 0.04) 118px 120px);
  transform: perspective(900px) rotateX(58deg) translateY(-8%);
  transform-origin: top center;
  /* Animacion mas lenta = menos repaints por segundo */
  animation: field-pan 28s linear infinite;
  will-change: background-position;
}

.mesh {
  position: absolute;
  width: 46vw;
  height: 54vh;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent 42%),
    linear-gradient(45deg, transparent 0 48%, rgba(255, 255, 255, 0.09) 49% 50%, transparent 51% 100%);
  transform: skewY(-8deg);
  opacity: 0.28;
  /* Solo una mesh anima — mesh-b es estatica para ahorrar GPU */
  will-change: transform;
}

.mesh-a {
  top: 8vh;
  right: -14vw;
  animation: mesh-drift 22s ease-in-out infinite alternate;
}

.mesh-b {
  left: -18vw;
  bottom: 4vh;
  transform: skewY(7deg) rotate(180deg);
  /* Sin animacion — ahorra un compositor layer entero */
}

.rail {
  position: absolute;
  width: 80vw;
  height: 1px;
  left: -10vw;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: rotate(-18deg);
  /* Solo rail-a anima, rail-b es estatico */
}

.rail-a {
  top: 20vh;
  animation: rail-drift 16s ease-in-out infinite alternate;
  will-change: transform;
}

.rail-b {
  top: 70vh;
  left: 35vw;
  opacity: 0.5;
}

@keyframes rail-drift {
  from { transform: translate3d(-2%, 0, 0) rotate(-18deg); }
  to { transform: translate3d(4%, 70px, 0) rotate(-14deg); }
}

@keyframes field-pan {
  from { background-position: 0 0, 0 0; }
  to { background-position: 240px 0, 0 180px; }
}

@keyframes mesh-drift {
  from { translate: 0 0; opacity: 0.24; }
  to { translate: -4vw 4vh; opacity: 0.46; }
}

body[data-theme="light"] .grain {
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
}

body[data-theme="light"] .scan-field {
  opacity: 0.34;
  background:
    repeating-linear-gradient(115deg, transparent 0 72px, rgba(0, 0, 0, 0.052) 72px 74px, transparent 74px 138px),
    repeating-linear-gradient(0deg, transparent 0 118px, rgba(0, 0, 0, 0.04) 118px 120px);
}

body[data-theme="light"] .mesh {
  border-color: rgba(0, 0, 0, 0.08);
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.07), transparent 42%),
    linear-gradient(45deg, transparent 0 48%, rgba(0, 0, 0, 0.09) 49% 50%, transparent 51% 100%);
}

body[data-theme="light"] .rail {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.18), transparent);
}

.app-shell {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.topbar-link:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.04);
}

.theme-toggle {
  min-width: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle svg {
  display: block;
  flex-shrink: 0;
}

.theme-icon[hidden] { display: none !important; }

/* ── Account chip ─────────────────────────────────────────── */
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#account-name-display {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  overflow: hidden;
  position: relative;
}

.account-avatar svg { display: block; }

.account-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ── Profile modal ─────────────────────────────────────────── */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-overlay[hidden] { display: none !important; }

.profile-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 400px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.profile-close-btn:hover { color: var(--ink); }

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.profile-avatar-big {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-big img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-change-photo-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.profile-change-photo-btn:hover { color: var(--ink); border-color: var(--ink); }

.profile-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
}

.profile-field span { display: flex; align-items: center; justify-content: space-between; }

.profile-field input,
.profile-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
  resize: vertical;
}

.profile-field input:focus,
.profile-field textarea:focus { outline: none; border-color: var(--accent); }

.profile-field input[readonly] { opacity: 0.5; cursor: default; }

.profile-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.danger-action {
  background: transparent;
  border: 1px solid rgba(220, 60, 60, 0.4);
  color: #e05555;
}
.danger-action:hover { background: rgba(220, 60, 60, 0.08); border-color: #e05555; }

.profile-status {
  font-size: 0.8rem;
  text-align: center;
  min-height: 16px;
  color: var(--muted);
  margin: 0;
}

/* password field with show/hide toggle */
.password-field {
  position: relative;
  width: 100%;
}

.password-field > input {
  width: 100%;
  padding-right: 44px !important;
  box-sizing: border-box;
}

.show-password-btn {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 100%;
  min-height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 0.15s;
  z-index: 1;
}

.show-password-btn:hover {
  color: var(--ink);
}

.show-password-btn .pw-eye-icon {
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

.ghost-btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  filter: invert(1) contrast(1.1);
  border: 1px solid var(--line-strong);
}

body[data-theme="light"] .brand img {
  filter: none;
  background: #ffffff;
}

.topbar-copy {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.topbar-copy strong,
.topbar-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-copy strong {
  color: var(--ink);
}

.lead {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.7fr);
  gap: 28px;
  align-items: end;
  padding: 44px 0 26px;
}

.lead h1 {
  max-width: 890px;
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(48px, 7vw, 104px);
  line-height: 0.88;
  font-weight: 400;
  letter-spacing: 0;
  text-wrap: balance;
}

.lead p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.workflow-nav {
  position: sticky;
  top: 10px;
  z-index: 12;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 20px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 11, 10, 0.88);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
}

.workflow-nav a {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.workflow-nav a span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 248, 237, 0.13);
  border-radius: 50%;
  color: var(--soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.workflow-nav a:hover,
.workflow-nav a:focus-visible,
.workflow-nav a.is-active {
  border-color: rgba(255, 255, 255, 0.42);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.workflow-nav a.is-active span {
  border-color: rgba(255, 255, 255, 0.66);
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.1);
}

.workflow-nav a.is-locked,
.stage-card.is-locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.command-center {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}

.security-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: -8px 0 22px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.075), transparent 56%),
    rgba(8, 8, 7, 0.58);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.security-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
  font-weight: 950;
}

.security-strip span.is-ready,
.security-strip span:first-child {
  border-color: var(--line-strong);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.095);
}

.stage-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  background:
    linear-gradient(145deg, rgba(255, 248, 237, 0.055), transparent 58%),
    rgba(13, 12, 10, 0.76);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.stage-card:hover,
.stage-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.48);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
    rgba(13, 12, 10, 0.88);
}

.stage-card span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.stage-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}

.stage-card small {
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--cyan);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.step-section {
  display: grid;
  gap: 18px;
  margin-top: 32px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 9, 8, 0.86);
  box-shadow: var(--shadow);
  scroll-margin-top: 92px;
  content-visibility: auto;
  contain-intrinsic-size: 760px;
}

body.workflow-focus:not(.auth-locked) .lead {
  display: none;
}

body.workflow-focus:not(.auth-locked) .step-section {
  display: none;
}

body.workflow-focus[data-active-step="library"]:not(.auth-locked) #library-studio,
body.workflow-focus[data-active-step="story"]:not(.auth-locked) #story-studio,
body.workflow-focus[data-active-step="suite"]:not(.auth-locked) #growth-studio,
body.workflow-focus[data-active-step="presets"]:not(.auth-locked) #preset-studio,
body.workflow-focus[data-active-step="resources"]:not(.auth-locked) #resource-studio,
body.workflow-focus[data-active-step="video"]:not(.auth-locked) .video-step {
  display: grid;
  animation: workflow-in 420ms ease both;
}

.story-step-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.step-section + .step-section {
  margin-top: 42px;
}

.section-head {
  display: grid;
  gap: 8px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
}

.story-step {
  border-color: rgba(255, 255, 255, 0.16);
}

.story-quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 62%),
    rgba(255, 248, 237, 0.035);
}

.story-quick-actions button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.34);
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.story-quick-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.1);
}

/* Misma geometria que .workspace para que la tarjeta mida igual que "Arma la historia". */
.random-story-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  margin-top: 14px;
}

@media (max-width: 1120px) {
  .random-story-row {
    grid-template-columns: 1fr;
  }
}

.random-story-card {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 62%),
    rgba(255, 248, 237, 0.035);
}

.random-story-head h3 {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 800;
}

.random-story-controls {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.random-story-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.random-story-divider::before,
.random-story-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

@media (max-width: 760px) {
  .random-story-controls {
    grid-template-columns: 1fr;
  }
}

.resources-step {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 44%),
    rgba(10, 9, 8, 0.86);
}

.video-step {
  border-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 42%),
    rgba(10, 9, 8, 0.86);
}

.composer,
.brief-preview,
.pattern-lab,
.result-panel,
.auth-panel,
.video-studio {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  /* Reducido de 18px a 8px: blur alto es muy costoso en GPU (causa repaint
     completo del area cada frame). 8px es visualmente similar pero mucho mas ligero. */
  backdrop-filter: blur(8px);
}

.composer,
.brief-preview,
.pattern-lab,
.result-panel.is-visible,
.growth-card,
.resource-panel,
.video-studio {
  animation: panel-enter 520ms ease both;
}

.auth-panel {
  display: none;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(0, 0.95fr) minmax(340px, 0.68fr);
  padding: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.07), transparent 36%),
    rgba(18, 17, 15, 0.9);
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 248, 237, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 248, 237, 0.045) 1px, transparent 1px);
  background-size: 52px 52px, 52px 52px;
  opacity: 0.72;
  pointer-events: none;
}

.auth-copy,
.auth-card {
  position: relative;
  z-index: 1;
}

.auth-copy {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 620px;
  padding: clamp(28px, 6vw, 72px);
}

.auth-copy h2 {
  max-width: 760px;
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 0.9;
  font-weight: 400;
}

.auth-copy p {
  max-width: 640px;
  margin: 0;
  font-size: 16px;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 680px;
}

.auth-metrics span,
.integration-list span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.055);
}

.auth-metrics span {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-metrics strong {
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.integration-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integration-list span {
  padding: 9px 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.integration-list span.is-ready {
  border-color: rgba(255, 255, 255, 0.48);
  color: var(--green);
  background: rgba(255, 255, 255, 0.08);
}

.integration-list span.is-waiting {
  border-color: rgba(255, 255, 255, 0.34);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.055);
}

.auth-card {
  display: grid;
  align-self: center;
  gap: 14px;
  margin: 22px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(8, 8, 7, 0.72);
  box-shadow: var(--shadow);
}

.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auth-card h3,
.automation-panel h3,
.voice-panel h3 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.1;
}

.social-actions {
  display: grid;
  gap: 8px;
}

.social-btn {
  justify-content: flex-start;
  min-height: 48px;
}

.social-btn span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 50%;
  color: #090807;
  background: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.social-btn.google span {
  color: #fff;
  background: #4285f4;
}

.social-btn.google .google-mark {
  width: 26px;
  height: 26px;
  padding: 5px;
  color: inherit;
  background: #ffffff;
}

.social-btn.google .google-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-primary-social {
  border-color: rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)),
    rgba(255, 248, 237, 0.06);
}

.auth-primary-social strong {
  font-weight: 950;
}

.auth-provider-note {
  margin: -4px 0 0;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1.45;
}

.auth-remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
}

.auth-remember-row input {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  min-height: 13px;
  padding: 0;
  accent-color: var(--ink);
}

.auth-grid .auth-remember-row,
body.auth-locked .auth-grid .auth-remember-row {
  display: flex;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  text-transform: none;
}

.auth-grid .auth-remember-row input,
body.auth-locked .auth-grid .auth-remember-row input {
  width: 13px;
  height: 13px;
  min-height: 13px;
  padding: 0;
  border-radius: 3px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.auth-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.auth-tabs button.is-active {
  border-color: var(--line-strong);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.11);
}

.auth-forgot {
  justify-self: end;
  margin-top: -2px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.auth-forgot:hover {
  color: var(--ink);
}

.captcha-box {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.captcha-box[hidden],
[data-auth-field][hidden],
.auth-tabs[hidden],
.divider[hidden],
.social-actions[hidden],
#recover-btn[hidden],
#update-password-btn[hidden],
#signup-btn[hidden],
#login-btn[hidden],
#logout-btn[hidden] {
  display: none !important;
}

.captcha-box p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.captcha-box iframe {
  max-width: 100%;
}

.divider {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 24px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line);
}

.divider span {
  position: relative;
  padding: 0 10px;
  background: #090807;
}

.auth-panel.is-visible {
  display: grid;
  animation: fade-up 220ms ease both;
}

.auth-panel h2,
.video-head h2,
.resource-panel h3 {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.1;
}

.auth-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-grid {
  display: grid;
  gap: 10px;
}

.auth-grid label,
.editor-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-grid input,
.editor-controls textarea,
.editor-controls select,
.editor-controls input[type="range"] {
  width: 100%;
}

.auth-grid input,
.editor-controls textarea,
.editor-controls select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
  outline: none;
}

.auth-grid input,
.editor-controls select {
  padding: 0 12px;
}

#comment-card-text {
  min-height: 74px;
  padding: 11px 12px;
  resize: vertical;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.postfully-box {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.045);
}

.automation-panel,
.voice-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), transparent 52%),
    rgba(255, 248, 237, 0.04);
}

.voice-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), transparent 52%),
    rgba(255, 248, 237, 0.04);
}

.custom-template-panel,
.preset-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.28);
}

.custom-template-panel[hidden] {
  display: none !important;
}

.custom-template-panel .auth-status,
.preset-panel .auth-status {
  grid-column: 1 / -1;
}

/* ── Mis presets de video: rediseño 2026 ──────────────────────────────────
   Cards modernas, jerarquía clara y acentos violeta consistentes con el
   design system premium (--wx-*). Todo queda scopeado a .preset-step. */

.preset-step .preset-section-sub {
  max-width: 640px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.preset-panel,
.preset-library {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.07), transparent 46%),
    var(--panel);
  transition: border-color 180ms ease;
}

.preset-panel:hover,
.preset-library:hover {
  border-color: rgba(139, 92, 246, 0.28);
}

.preset-library {
  margin-bottom: 16px;
}

.preset-note,
.preset-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* Plantillas base */

.global-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.global-preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: left;
  background:
    linear-gradient(160deg, rgba(139, 92, 246, 0.08), transparent 55%),
    rgba(7, 7, 8, 0.4);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.global-preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 14px 40px -18px rgba(124, 58, 237, 0.5);
}

.global-preset-card.is-active {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4), 0 14px 40px -18px rgba(124, 58, 237, 0.55);
}

.global-preset-card.is-active::after {
  content: "\2713 Aplicada";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.global-preset-card .gp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.global-preset-card.is-active .gp-head {
  padding-right: 78px;
}

.global-preset-card strong {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.25;
}

.gp-duration {
  flex: none;
  padding: 2px 8px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 999px;
  color: #a78bfa;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.global-preset-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.gp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.gp-tags span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.gp-cta {
  margin-top: 2px;
  color: #a78bfa;
  font-size: 11.5px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 160ms ease;
}

.global-preset-card:hover .gp-cta {
  color: #c4b5fd;
}

/* Layout principal: editor + guardados a la izquierda, aside a la derecha */

.preset-step-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.72fr);
  gap: 16px;
  align-items: start;
}

.preset-main-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.preset-span-2 {
  grid-column: 1 / -1;
}

/* Formulario del editor de preset: misma jerarquia que .editor-controls */

.preset-control-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.preset-control-grid input,
.preset-control-grid select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
  outline: none;
  font: inherit;
  font-weight: 500;
  text-transform: none;
  transition: border-color 160ms ease;
}

.preset-control-grid input:focus,
.preset-control-grid select:focus {
  border-color: rgba(139, 92, 246, 0.6);
}

.preset-flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-editor-actions {
  align-items: center;
}

/* Switch visual reutilizable (favorito, predeterminado, auto-aplicar) */

.wx-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.wx-switch:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.wx-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.wx-switch .wx-switch-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 180ms ease;
}

.wx-switch .wx-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms ease;
}

.wx-switch input:checked ~ .wx-switch-track {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.wx-switch input:checked ~ .wx-switch-track::after {
  transform: translateX(16px);
}

.wx-switch input:focus-visible ~ .wx-switch-track {
  outline: 2px solid rgba(139, 92, 246, 0.7);
  outline-offset: 2px;
}

.wx-switch .wx-switch-text strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
}

.wx-switch .wx-switch-text small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.preset-auto-switch {
  padding: 12px;
}

/* Presets guardados: cards ricas con acciones */

.saved-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.saved-preset-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(139, 92, 246, 0.06), transparent 50%),
    rgba(7, 7, 8, 0.38);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.saved-preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 14px 36px -20px rgba(124, 58, 237, 0.5);
}

.saved-preset-card.is-active {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.saved-preset-card.is-default {
  background:
    linear-gradient(160deg, rgba(124, 58, 237, 0.14), transparent 58%),
    rgba(7, 7, 8, 0.38);
}

.spc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.spc-head strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.spc-badges {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.spc-badge {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.spc-badge.spc-fav {
  border-color: rgba(250, 204, 21, 0.45);
  color: #facc15;
}

.spc-badge.spc-default {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(124, 58, 237, 0.16);
  color: #c4b5fd;
}

.spc-meta {
  margin: 0;
  color: var(--soft);
  font-size: 11.5px;
}

.spc-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.spc-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.spc-modules span {
  padding: 2px 8px;
  border: 1px solid rgba(139, 92, 246, 0.26);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.08);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}

.spc-modules .spc-resource-chip {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.spc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.spc-btn {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.spc-btn:hover {
  border-color: rgba(139, 92, 246, 0.5);
  color: var(--ink);
}

.spc-btn.spc-apply {
  border: none;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}

.spc-btn.spc-apply:hover {
  filter: brightness(1.12);
}

.spc-btn.spc-icon {
  min-width: 30px;
  padding: 4px 7px;
  font-size: 13px;
  line-height: 1;
}

.spc-btn.spc-danger:hover {
  border-color: rgba(248, 113, 113, 0.6);
  color: #f87171;
}

.spc-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Estados vacios */

.preset-empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  grid-column: 1 / -1;
  padding: 26px 18px;
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 14px;
  text-align: center;
}

.preset-empty-state .preset-empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.16);
  color: #a78bfa;
  font-size: 18px;
  font-weight: 700;
}

.preset-empty-state strong {
  color: var(--ink);
  font-size: 13.5px;
}

.preset-empty-state p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.preset-empty-compact {
  padding: 16px 14px;
}

/* Aside: aplicar partes, fondos y vista previa */

.preset-settings-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.preset-aside-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.06), transparent 48%),
    var(--panel);
}

.preset-aside-panel > strong {
  color: var(--ink);
  font-size: 13.5px;
}

.preset-aside-sub {
  margin: -4px 0 0;
  color: var(--soft);
  font-size: 11.5px;
  line-height: 1.5;
}

.preset-scope-chips {
  display: grid;
  gap: 8px;
}

.preset-scope-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.preset-scope-chip:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.preset-scope-chip input {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #8b5cf6;
}

.preset-scope-chip:has(input:checked) {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(124, 58, 237, 0.1);
}

.preset-scope-chip .chip-body strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
}

.preset-scope-chip .chip-body small {
  display: block;
  margin-top: 1px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.45;
}

/* Fondos del preset: miniaturas + orden */

.preset-resource-picker {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.preset-resource-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 160ms ease;
}

.preset-resource-item.is-selected {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(124, 58, 237, 0.08);
}

.preset-resource-item.is-missing {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.06);
}

.preset-resource-item .prv-thumb {
  flex: none;
  width: 44px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: #060607;
}

.prv-thumb-missing {
  display: grid;
  place-items: center;
  color: #f87171;
  font-size: 17px;
  font-weight: 900;
}

.preset-resource-item .prv-body {
  flex: 1;
  min-width: 0;
}

.preset-resource-item .prv-body strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-resource-item .prv-body small {
  display: block;
  margin-top: 1px;
  color: var(--soft);
  font-size: 10.5px;
  line-height: 1.4;
}

.preset-resource-item .prv-actions {
  display: flex;
  flex: none;
  gap: 4px;
}

.preset-resource-item .prv-order {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
}

/* Vista previa de cambios (diff) */

.preset-preview-panel #preset-preview {
  display: grid;
  gap: 10px;
}

.ppv-head {
  display: grid;
  gap: 2px;
}

.ppv-head strong {
  color: var(--ink);
  font-size: 13px;
}

.ppv-head span {
  color: var(--soft);
  font-size: 11.5px;
}

.ppv-diff {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.ppv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11.5px;
}

.ppv-row.is-important {
  background: rgba(124, 58, 237, 0.12);
  outline: 1px solid rgba(139, 92, 246, 0.3);
}

.ppv-label {
  color: var(--muted);
}

.ppv-values {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-align: right;
  white-space: nowrap;
}

.ppv-values s {
  color: var(--soft);
  text-decoration-color: rgba(248, 113, 113, 0.6);
}

.ppv-values i {
  color: var(--soft);
  font-style: normal;
}

.ppv-values b {
  color: #c4b5fd;
  font-weight: 800;
}

.ppv-overflow {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
}

.ppv-applied {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 12px;
  background: rgba(74, 222, 128, 0.08);
  color: #4ade80;
  font-size: 12px;
  font-weight: 700;
}

.preset-warning {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.07);
  color: #facc15;
  font-size: 11.5px;
  line-height: 1.5;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.preset-card {
  min-height: 94px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: left;
  background: rgba(7, 7, 6, 0.36);
  cursor: pointer;
}

.preset-card strong,
.preset-card span {
  display: block;
}

.preset-card strong {
  color: var(--ink);
  font-size: 13px;
}

.preset-card span {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.35;
}

.preset-card.is-active {
  border-color: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
}

.toggle-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.24);
  text-transform: none !important;
}

.toggle-row input {
  width: 18px !important;
  height: 18px;
  accent-color: var(--cyan);
}

.voice-panel audio {
  width: 100%;
  min-height: 38px;
}

.render-preview {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.render-preview[hidden] {
  display: none !important;
}

.render-preview video {
  width: 100%;
  max-height: 260px;
  border-radius: var(--radius);
  background: #050504;
}

.render-preview span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.postfully-box h3 {
  margin: 5px 0 0;
  font-size: 18px;
}

.postfully-box textarea {
  min-height: 116px;
}

.audio-upload-drop {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.36);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.052);
  cursor: pointer;
}

.audio-upload-drop span {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.audio-upload-drop strong {
  font-size: 15px;
}

.audio-upload-drop small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

#subtitle-start-label {
  color: var(--gold);
  font-weight: 900;
}

.composer {
  padding: 18px;
}

.panel-head,
.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2,
.result-top h2,
.pattern-lab h3 {
  margin: 6px 0 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 800;
}

.control-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.control-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 14px;
}

.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.counter {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.segmented,
.template-grid,
.chip-grid,
.duration-grid,
.mini-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice,
.template,
.chip,
.duration-chip,
.mini,
.ghost-btn,
.action-btn,
.generate-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.055);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.choice:hover,
.template:hover,
.chip:hover,
.duration-chip:hover,
.mini:hover,
.ghost-btn:hover,
.action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 248, 237, 0.085);
}

.choice {
  min-height: 76px;
  padding: 13px;
  text-align: left;
}

.choice strong,
.choice span {
  display: block;
}

.choice strong {
  font-size: 15px;
}

.choice span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.is-active {
  border-color: rgba(255, 255, 255, 0.7);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.title-block {
  display: none;
}

.title-block.is-visible {
  display: block;
  animation: fade-up 220ms ease both;
}

textarea,
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
  outline: none;
}

textarea {
  min-height: 94px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

textarea:focus,
.search-box:focus-within {
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 260px;
  max-width: 360px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.36);
}

.search-box span {
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-box input {
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
}

.chip-grid {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.chip-grid.tight {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chip,
.mini {
  min-height: 42px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.template-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.template-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.template {
  min-height: 110px;
  padding: 14px;
  text-align: left;
}

.template strong,
.template span {
  display: block;
}

.template span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.duration-grid {
  grid-template-columns: 1fr;
}

.duration-chip {
  min-height: 54px;
  padding: 10px 12px;
  text-align: left;
}

.duration-chip strong,
.duration-chip span {
  display: block;
}

.duration-chip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.mini-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini {
  min-width: 0;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.director-sticky {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.brief-preview {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.07), transparent 38%),
    var(--panel-2);
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(255, 248, 237, 0.08), transparent);
  transform: translateY(-100%);
  animation: scan 3.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scan {
  0%, 30% { transform: translateY(-100%); opacity: 0; }
  55% { opacity: 0.6; }
  100% { transform: translateY(100%); opacity: 0; }
}

.brief-preview h2 {
  position: relative;
  margin: 10px 0 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 42px;
  line-height: 0.98;
  font-weight: 400;
  letter-spacing: 0;
}

.brief-preview p {
  position: relative;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.storyline {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.storyline i {
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.18), var(--gold));
}

.generate-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  border: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #bebeba);
  color: #050505;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 16px 38px rgba(255, 255, 255, 0.14);
}

.generate-btn::after {
  content: "";
  position: absolute;
  inset: -80% auto -80% -30%;
  width: 32%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.76), transparent);
  transform: skewX(-18deg);
  animation: button-sheen 3.4s ease-in-out infinite;
  pointer-events: none;
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(255, 255, 255, 0.22);
}

.generate-btn:disabled {
  cursor: wait;
  opacity: 0.82;
  transform: none;
}

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(22, 15, 11, 0.35);
  border-top-color: #160f0b;
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

.spinner.is-visible {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-msg {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 95, 119, 0.35);
  border-radius: var(--radius);
  color: #ffd9df;
  background: rgba(255, 95, 119, 0.08);
  font-size: 13px;
  line-height: 1.45;
}

.error-msg.is-visible {
  display: block;
}

.error-msg.is-success {
  border-color: rgba(255, 255, 255, 0.32);
  color: #f1f1ee;
  background: rgba(255, 255, 255, 0.07);
}

.pattern-lab {
  padding: 16px;
}

.pattern-stack {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.pattern-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.045);
}

.pattern-line span {
  color: var(--soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.pattern-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.result-panel {
  display: none;
  margin-top: 18px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 248, 237, 0.06), transparent 230px),
    var(--panel);
}

.result-panel.is-visible {
  display: block;
  animation: fade-up 260ms ease both;
}

.result-top h2 {
  max-width: 880px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(34px, 4.8vw, 72px);
  line-height: 0.96;
  font-weight: 400;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.result-stats span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 248, 237, 0.045);
  font-size: 12px;
  font-weight: 800;
}

.script-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.script-step {
  min-height: 124px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.045);
}

.script-step span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.script-step p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.story-text {
  max-width: 900px;
  margin-top: 24px;
  color: #fff5e6;
  font-size: clamp(17px, 1.6vw, 21px);
  line-height: 1.82;
}

.story-text p {
  margin: 0 0 18px;
}

.story-text p:first-child {
  position: relative;
  padding-left: 18px;
  border-left: 3px solid var(--coral);
  font-size: 1.12em;
  color: var(--ink);
}

.pattern-badges,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.actions {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-btn,
.ghost-btn {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 900;
}

.ghost-btn {
  background: rgba(255, 248, 237, 0.035);
}

.primary-action {
  color: #050505;
  background: linear-gradient(135deg, #ffffff, #c7c7c3);
  border-color: transparent;
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.flow-forward {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.flow-next-btn,
.flow-forward .primary-action {
  min-width: min(100%, 220px);
  position: relative;
}

body.has-story .flow-next-btn:not(:disabled) {
  animation: ready-pulse 2.2s ease-in-out infinite;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.library-stats span {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.library-stats strong,
.library-stats small {
  display: block;
}

.library-stats strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.library-stats small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.growth-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.growth-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 46%),
    rgba(255, 248, 237, 0.045);
}

.performance-card {
  position: relative;
  overflow: hidden;
}

.performance-card::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: 0.7;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.performance-grid span {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  line-height: 1.35;
}

.performance-grid strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.growth-card h3 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1;
}

.growth-card textarea,
.growth-card input,
.growth-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
}

.growth-card textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.growth-card input,
.growth-card select {
  padding: 0 10px;
}

.growth-card label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.growth-card .actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.growth-card .action-btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  line-height: 1.15;
}

.director-card,
.visual-card,
.timeline-suite-card,
.automation-card {
  grid-column: span 2;
}

.smart-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.smart-flow span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.055);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.hook-bank,
.visual-template-grid,
.thumbnail-grid,
.series-grid {
  display: grid;
  gap: 8px;
}

.hook-bank {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.visual-template-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hook-bank button,
.visual-template-grid button {
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.32);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  cursor: pointer;
}

.hook-bank button:hover,
.visual-template-grid button:hover,
.visual-template-grid button.is-active {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 255, 255, 0.11);
}

.retention-score {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(255, 255, 255, 0.075);
  font-size: 18px;
  font-weight: 950;
}

.retention-report {
  min-height: 82px;
  padding: 10px;
  border: 1px solid rgba(255, 248, 237, 0.1);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(7, 7, 6, 0.26);
  font-size: 12px;
  line-height: 1.5;
}

.retention-report strong {
  color: var(--ink);
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.diagnostic-grid span {
  min-width: 0;
  min-height: 38px;
  padding: 9px;
  border: 1px solid rgba(255, 248, 237, 0.12);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(7, 7, 6, 0.25);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.diagnostic-grid span.is-good {
  border-color: rgba(255, 255, 255, 0.36);
  color: var(--green);
  background: rgba(255, 255, 255, 0.075);
}

.diagnostic-grid span.is-warn {
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.055);
}

.diagnostic-grid span.is-bad {
  border-color: rgba(255, 255, 255, 0.22);
  color: #e8e8e4;
  background: rgba(255, 255, 255, 0.04);
}

.tool-output {
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 248, 237, 0.1);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(7, 7, 6, 0.25);
  font-size: 12px;
  line-height: 1.45;
}

.tool-output strong {
  color: var(--ink);
}

.subtitle-timeline-grid {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.subtitle-row {
  display: grid;
  grid-template-columns: 72px 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid rgba(255, 248, 237, 0.1);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.25);
}

.subtitle-row input,
.subtitle-row textarea {
  min-height: 38px;
  font-size: 12px;
}

.subtitle-row textarea {
  resize: vertical;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.idea-card,
.ab-variant {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.28);
  text-align: left;
}

.idea-card {
  cursor: pointer;
}

.idea-card:hover,
.ab-variant:hover {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.09);
}

.idea-card strong,
.ab-variant strong {
  line-height: 1.2;
}

.idea-card span,
.ab-variant span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ab-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.series-grid {
  max-height: 300px;
  overflow: auto;
}

.series-part,
.thumbnail-card,
.metric-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.28);
}

.series-part {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.series-part strong,
.series-part span {
  display: block;
}

.series-part span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.thumbnail-grid {
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
}

.thumbnail-card {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.thumbnail-card img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border: 1px solid rgba(255, 248, 237, 0.12);
  border-radius: var(--radius);
  background: #050504;
}

.thumbnail-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.thumbnail-card button {
  min-height: 34px;
}

.compact-audio {
  margin: 0;
  min-height: 72px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.metric-row strong {
  color: var(--ink);
}

.video-studio {
  margin-top: 18px;
  padding: 18px;
}

.video-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.resource-panel,
.editor-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 248, 237, 0.04);
}

.resource-panel {
  padding: 14px;
}

.resources-step .resource-panel {
  min-height: auto;
}

.upload-drop {
  display: grid;
  gap: 7px;
  min-height: 90px;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.upload-drop strong {
  font-size: 16px;
}

.upload-drop span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.resource-bulk-tools {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.resource-bulk-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.resource-bulk-tools input {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
}

.quick-segment-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.quick-segment-buttons button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 248, 237, 0.055);
  font-weight: 900;
  cursor: pointer;
}

.resource-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.28);
}

.resource-card.is-active {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
}

.resource-card.is-in-sequence {
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.62);
}

.resource-card video {
  width: 68px;
  height: 92px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #050504;
}

.resource-body {
  display: grid;
  gap: 8px;
}

.resource-card strong,
.resource-card .resource-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-card strong {
  font-size: 13px;
}

.resource-title-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.resource-order-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: var(--cyan);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.resource-card .resource-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.resource-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: end;
}

.timeline-toggle,
.segment-field {
  display: grid;
  gap: 4px;
  min-height: 38px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-toggle {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.timeline-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.segment-field input {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(7, 7, 6, 0.42);
}

.resource-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.resource-card button {
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
}

.compact-toggle {
  margin-top: 10px;
}

.timeline-summary {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  font-weight: 900;
}

.editor-panel {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.editor-preview {
  position: sticky;
  top: 82px;
  aspect-ratio: 9 / 16;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent),
    #070706;
}

.editor-preview video {
  display: none;
}

.editor-preview canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-timeline-control {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 248, 237, 0.16);
  border-radius: var(--radius);
  background: rgba(7, 7, 6, 0.88);
  backdrop-filter: blur(4px);
}

.preview-play-toggle {
  min-width: 58px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--bg);
  background: var(--ink);
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
}

.preview-timeline-control span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.preview-timeline-control input {
  width: 100%;
  accent-color: var(--cyan);
}

.editor-controls {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 13px;
  overflow: visible;
}

.quick-render-bar,
.wide-control,
.postfully-box {
  grid-column: 1 / -1;
}

#postfully-panel {
  scroll-margin-top: 92px;
}

.quick-render-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 54%),
    rgba(13, 12, 10, 0.96);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.quick-render-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.render-duration-hint {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.055);
}

.quick-render-bar[hidden],
#custom-duration-label[hidden],
#custom-duration-unit-label[hidden] {
  display: none !important;
}

.editor-controls textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
  text-transform: none;
}

.editor-controls select {
  appearance: none;
}

body[data-theme="light"] .workflow-nav,
body[data-theme="light"] .toast,
body[data-theme="light"] .quick-render-bar {
  background: rgba(255, 255, 255, 0.92);
}

body[data-theme="light"] .performance-grid span,
body[data-theme="light"] .auth-tabs,
body[data-theme="light"] .captcha-box {
  background: rgba(255, 255, 255, 0.72);
}

body[data-theme="light"] .auth-hero {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), transparent 42%),
    linear-gradient(225deg, rgba(0, 0, 0, 0.045), transparent 34%),
    rgba(255, 255, 255, 0.74);
}

body[data-theme="light"] .auth-hero::before {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.028) 1px, transparent 1px);
  opacity: 0.58;
}

body[data-theme="light"] .auth-card {
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(242, 242, 236, 0.82)),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 28px 70px rgba(22, 22, 18, 0.14);
}

body[data-theme="light"] .auth-provider-note,
body[data-theme="light"] .auth-primary-social {
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
}

body[data-theme="light"] .auth-tabs button.is-active {
  border-color: rgba(0, 0, 0, 0.18);
  background: rgba(0, 0, 0, 0.055);
}

body[data-theme="light"] .divider span {
  background: #f7f7f2;
}

body[data-theme="light"] .step-section,
body[data-theme="light"] .stage-card,
body[data-theme="light"] .composer,
body[data-theme="light"] .brief-preview,
body[data-theme="light"] .pattern-lab,
body[data-theme="light"] .result-panel,
body[data-theme="light"] .auth-panel,
body[data-theme="light"] .video-studio,
body[data-theme="light"] .resource-panel,
body[data-theme="light"] .editor-panel,
body[data-theme="light"] .growth-card,
body[data-theme="light"] .postfully-box {
  background: var(--panel);
}

body[data-theme="light"] .account-chip,
body[data-theme="light"] .choice,
body[data-theme="light"] .template,
body[data-theme="light"] .chip,
body[data-theme="light"] .duration-chip,
body[data-theme="light"] .mini,
body[data-theme="light"] .ghost-btn,
body[data-theme="light"] .action-btn,
body[data-theme="light"] .resource-card,
body[data-theme="light"] .preset-card,
body[data-theme="light"] .idea-card,
body[data-theme="light"] .ab-variant,
body[data-theme="light"] .series-part,
body[data-theme="light"] .thumbnail-card,
body[data-theme="light"] .metric-row,
body[data-theme="light"] .pattern-line,
body[data-theme="light"] .script-step,
body[data-theme="light"] .result-stats span,
body[data-theme="light"] .badge,
body[data-theme="light"] .toggle-row,
body[data-theme="light"] .retention-report,
body[data-theme="light"] .tool-output {
  background: rgba(255, 255, 255, 0.68);
}

body[data-theme="light"] textarea,
body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] .search-box,
body[data-theme="light"] .growth-card textarea,
body[data-theme="light"] .growth-card input,
body[data-theme="light"] .growth-card select,
body[data-theme="light"] .resource-bulk-tools input,
body[data-theme="light"] .segment-field input {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

body[data-theme="light"] .generate-btn,
body[data-theme="light"] .primary-action {
  color: #ffffff;
  background: linear-gradient(135deg, #050505, #3d3d39);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

body[data-theme="light"] .spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
}

body[data-theme="light"] .story-text {
  color: #181814;
}

body[data-theme="light"] .preview-timeline-control {
  background: rgba(255, 255, 255, 0.82);
}

body[data-theme="light"] .editor-preview,
body[data-theme="light"] .resource-card video,
body[data-theme="light"] .render-preview video {
  background: #e9e9e2;
}

body[data-theme="light"] .social-btn.google span {
  background: #111111;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(15, 14, 12, 0.94);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Variantes de tono del toast: acento a la izquierda + punto de color */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left-width: 3px;
}
.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--accent);
}
.toast.toast-info { border-left-color: var(--accent); }
.toast.toast-info::before { background: var(--accent); }
.toast.toast-success { border-left-color: #5ad19b; }
.toast.toast-success::before { background: #5ad19b; }
.toast.toast-warn { border-left-color: #f4c560; }
.toast.toast-warn::before { background: #f4c560; }
.toast.toast-error { border-left-color: #ff8f8f; }
.toast.toast-error::before { background: #ff8f8f; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 12px;
}

@keyframes fade-up {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes workflow-in {
  from {
    transform: translateY(16px) scale(0.992);
    opacity: 0;
    filter: blur(6px);
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes panel-enter {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes button-sheen {
  0%, 45% {
    transform: translateX(0) skewX(-18deg);
    opacity: 0;
  }
  62% {
    opacity: 0.8;
  }
  100% {
    transform: translateX(430%) skewX(-18deg);
    opacity: 0;
  }
}

@keyframes ready-pulse {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 0 18px 34px rgba(255, 255, 255, 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1120px) {
  .command-center {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .story-quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .director-sticky {
    position: static;
  }

  .template-grid,
  .template-grid.compact,
  .script-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-layout,
  .editor-panel,
  .story-step-grid,
  .preset-step-grid,
  .growth-grid {
    grid-template-columns: 1fr;
  }

  .global-preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .director-card,
  .visual-card,
  .timeline-suite-card,
  .automation-card {
    grid-column: auto;
  }

  .editor-preview {
    position: sticky;
    top: 72px;
    width: min(100%, 420px);
    justify-self: center;
  }

  .editor-controls {
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  .quick-render-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diagnostic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, var(--max));
    padding-top: 12px;
  }

  /* Header móvil: una fila limpia — marca a la izquierda, acciones compactas a la derecha */
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: auto;
    padding-block: 10px;
  }

  .brand { margin-right: auto; }

  #randomize-btn {
    width: 100%;
  }

  .topbar-copy {
    display: none;
  }

  .topbar-link {
    width: auto;
    min-height: 36px;
    padding: 0 12px;
  }

  .account-chip {
    width: max-content;
  }

  .theme-toggle {
    width: auto;
    min-width: 40px;
  }

  .account-avatar {
    width: 24px;
    height: 24px;
  }

  .lead {
    grid-template-columns: 1fr;
    padding: 30px 0 18px;
  }

  .lead h1 {
    font-size: 48px;
  }

  .workflow-nav {
    overflow-x: auto;
    padding: 6px;
    top: 6px;
    scrollbar-width: none;
  }

  .workflow-nav a {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 11px;
  }

  .workflow-nav a span {
    width: 22px;
    height: 22px;
  }

  .command-center {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .stage-card {
    flex: 0 0 176px;
    min-height: 104px;
    scroll-snap-align: start;
  }

  .story-quick-actions {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-copy {
    min-height: auto;
    padding: 20px;
  }

  .auth-copy h2 {
    font-size: 46px;
  }

  .auth-card {
    margin: 0;
  }

  .auth-hero {
    gap: 0;
  }

  .auth-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-metrics span {
    min-height: 68px;
    padding: 10px;
  }

  .auth-metrics strong {
    font-size: 20px;
  }

  .workspace {
    gap: 12px;
  }

  .step-section {
    padding: 14px;
  }

  .composer,
  .brief-preview,
  .pattern-lab,
  .result-panel,
  .video-studio {
    padding: 14px;
  }

  .control-columns,
  .quick-render-grid,
  .custom-template-panel,
  .preset-control-grid,
  .resource-bulk-tools,
  .segmented,
  .template-grid,
  .template-grid.compact,
  .script-map,
  .auth-panel,
  .auth-metrics,
  .preset-grid,
  .smart-flow,
  .hook-bank,
  .visual-template-grid,
  .thumbnail-grid,
  .metric-grid,
  .subtitle-row,
  .batch-grid,
  .ab-choice-grid,
  .video-layout,
  .editor-panel,
  .editor-controls,
  .preset-scope-panel,
  .preset-settings-panel,
  .saved-preset-grid,
  .global-preset-grid,
  .diagnostic-grid,
  .performance-grid {
    grid-template-columns: 1fr;
  }

  .preset-panel,
  .preset-library,
  .preset-aside-panel {
    padding: 14px;
  }

  .preset-flag-row {
    flex-direction: column;
  }

  .spc-actions .spc-btn {
    flex: 1 1 auto;
  }

  .chip-grid,
  .chip-grid.tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-options {
    grid-template-columns: 1fr;
  }

  .quick-segment-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }

  .resource-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .resource-card video {
    width: 58px;
    height: 82px;
  }

  .resource-controls,
  .resource-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-card button {
    min-height: 36px;
  }

  .editor-preview {
    position: relative;
    top: auto;
    width: min(100%, 340px);
    max-height: none;
  }

  .preview-timeline-control {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 7px 8px;
  }

  .preview-play-toggle {
    grid-column: 1 / -1;
    width: 100%;
  }

  .quick-render-bar {
    position: static;
  }

  .line {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .brief-preview h2 {
    font-size: 36px;
  }

  .storyline {
    grid-template-columns: 1fr;
  }

  .storyline i {
    display: none;
  }

  .result-top {
    flex-direction: column;
  }

  .result-stats {
    justify-content: flex-start;
  }

  .footer {
    flex-direction: column;
    gap: 6px;
  } 
 } 

body:not(.auth-locked) .auth-panel.is-visible {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body:not(.auth-locked) .auth-panel.is-visible::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}

body:not(.auth-locked) .auth-panel.is-visible .auth-copy {
  display: none;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 0;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  color: #f2f2f2;
  background:
    linear-gradient(180deg, rgba(25, 25, 28, 0.98), rgba(9, 9, 11, 0.98)),
    #101114;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.62);
}

body:not(.auth-locked) .auth-panel.is-visible .auth-close-btn {
  justify-self: end;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #d3d4d8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-card-logo {
  width: 42px;
  height: 42px;
  margin: -6px auto 0;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-card-logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-actions .action-btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  border-radius: 12px;
}

body:not(.auth-locked) .auth-panel.is-visible .auth-actions .primary-action {
  border-color: transparent;
  color: #070708;
  background: linear-gradient(135deg, #ffffff, #d7d8dc);
}

body:not(.auth-locked) .auth-panel.is-visible .auth-forgot {
  margin-top: 0;
  color: #b7b9bf;
}

body:not(.auth-locked) .auth-panel.is-visible .divider span {
  background: #111216;
}

body.auth-locked {
  color: #f4f4f1;
  background:
    radial-gradient(circle at 50% 9%, rgba(255, 255, 255, 0.12), transparent 24rem),
    radial-gradient(circle at 38% 34%, rgba(180, 180, 176, 0.08), transparent 22rem),
    linear-gradient(180deg, #050505 0%, #101011 54%, #050505 100%);
}

body.auth-locked .backdrop {
  opacity: 0.78;
}

body.auth-locked .grain {
  opacity: 0.2;
  background-size: 42px 42px;
}

body.auth-locked .scan-field {
  opacity: 0.18;
  background:
    repeating-linear-gradient(115deg, transparent 0 88px, rgba(255, 255, 255, 0.09) 88px 90px, transparent 90px 150px),
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.16), transparent 42%);
}

body.auth-locked .mesh,
body.auth-locked .rail {
  opacity: 0.36;
}

body.auth-locked .topbar {
  display: none;
}

body.auth-locked .app-shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

body.auth-locked .auth-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(56px, 8vw, 112px);
  width: 100%;
  min-height: auto;
  margin: 0;
  padding: clamp(64px, 10vh, 132px) 18px 96px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.auth-locked .auth-hero::before {
  display: none;
}

body.auth-locked .auth-card {
  order: 1;
  justify-self: center;
  width: min(440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 38px 32px 32px;
  gap: 18px;
  border: 1px solid rgba(45, 115, 255, 0.34);
  border-radius: 20px;
  color: #eaf2ff;
  background:
    linear-gradient(180deg, rgba(16, 31, 55, 0.94), rgba(10, 21, 39, 0.96)),
    rgba(10, 21, 39, 0.94);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(54, 114, 255, 0.08),
    0 0 54px rgba(38, 104, 255, 0.09);
  animation: auth-card-enter 680ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

body.auth-locked .auth-card-logo {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0 auto 2px;
  color: #2e72ff;
  font-size: 26px;
  filter: drop-shadow(0 14px 24px rgba(37, 103, 255, 0.35));
}

body.auth-locked .auth-card-head {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

body.auth-locked .auth-card-head .status-pill {
  min-height: 24px;
  padding: 4px 9px;
  border-color: rgba(58, 118, 255, 0.24);
  color: #82a7ee;
  background: rgba(25, 51, 96, 0.38);
  font-size: 10px;
}

body.auth-locked .auth-card .eyebrow {
  display: none;
}

body.auth-locked .auth-card h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
}

body.auth-locked .auth-card-head p {
  margin: 8px 0 0;
  color: #6885b2;
  font-size: 14px;
}

body.auth-locked .auth-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
  border-color: rgba(49, 99, 182, 0.36);
  border-radius: 12px;
  background: rgba(7, 17, 33, 0.78);
}

body.auth-locked .auth-tabs button {
  min-height: 36px;
  border-radius: 9px;
  color: #7290bd;
  font-size: 12px;
}

body.auth-locked .auth-tabs button.is-active {
  border-color: rgba(45, 111, 255, 0.55);
  color: #eff5ff;
  background: rgba(34, 88, 180, 0.32);
}

body.auth-locked .auth-grid {
  gap: 12px;
}

body.auth-locked .auth-grid label {
  gap: 9px;
  color: #8aa8d8;
  font-size: 13px;
  text-transform: none;
}

body.auth-locked .auth-grid input {
  min-height: 44px;
  border-color: rgba(60, 111, 194, 0.46);
  border-radius: 11px;
  color: #eaf2ff;
  background: rgba(7, 18, 36, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

body.auth-locked .auth-grid input::placeholder {
  color: #486694;
}

body.auth-locked .auth-forgot {
  justify-self: end;
  margin-top: -2px;
  border: 0;
  color: #5678b6;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

body.auth-locked .auth-forgot:hover {
  color: #7fa7f2;
}

body.auth-locked .auth-forgot[hidden] {
  display: none !important;
}

body.auth-locked .auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

body.auth-locked .auth-actions .action-btn {
  width: 100%;
  min-height: 48px;
  justify-content: center;
  border-radius: 14px;
}

body.auth-locked .auth-actions .primary-action {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, #2f73ff, #2466ef);
  box-shadow: 0 18px 36px rgba(39, 104, 255, 0.28);
}

body.auth-locked .auth-status {
  margin: 4px 0 0;
  color: #607da9;
  font-size: 12px;
}

body.auth-locked .divider {
  color: #41618f;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

body.auth-locked .divider::before {
  background: rgba(71, 117, 194, 0.24);
}

body.auth-locked .divider span {
  background: #0b172a;
}

body.auth-locked .social-btn {
  justify-content: center;
  min-height: 45px;
  border-color: rgba(56, 103, 181, 0.32);
  border-radius: 11px;
  color: #dfeaff;
  background: rgba(8, 18, 35, 0.86);
}

body.auth-locked .social-btn span {
  margin-right: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #1bbd94, #2d73ff);
}

body.auth-locked .auth-provider-note {
  margin: 0;
  border-color: rgba(59, 105, 183, 0.32);
  color: #6b86b2;
  background: rgba(6, 17, 34, 0.62);
  text-align: center;
}

body.auth-locked .captcha-box {
  border-color: rgba(59, 105, 183, 0.32);
  background: rgba(6, 17, 34, 0.72);
}

body.auth-locked .auth-copy {
  order: 2;
  justify-self: center;
  align-content: start;
  width: min(960px, calc(100vw - 32px));
  min-height: auto;
  padding: 0 0 24px;
  text-align: center;
}

body.auth-locked .auth-brand-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(820px, 100%);
  margin: 0 auto clamp(44px, 7vw, 84px);
  color: #dce8ff;
}

body.auth-locked .auth-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(50, 113, 255, 0.34);
  border-radius: 14px;
  background: #051225;
  box-shadow: 0 0 26px rgba(37, 103, 255, 0.28);
}

body.auth-locked .auth-brand-mark img {
  width: 24px;
  height: 24px;
}

body.auth-locked .auth-brand-row strong {
  font-size: 20px;
  font-weight: 950;
}

body.auth-locked .auth-brand-row a {
  justify-self: end;
  color: #8faadc;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

body.auth-locked .auth-copy .eyebrow {
  color: #29c5b0;
}

body.auth-locked .auth-copy h2 {
  max-width: 860px;
  margin: 0 auto;
  color: #eaf2ff;
  font-family: "Inter", system-ui, sans-serif;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 0.98;
  font-weight: 950;
}

body.auth-locked .auth-copy h2 span {
  display: block;
  color: transparent;
  background: linear-gradient(90deg, #17c7ad, #2f73ff 60%, #6aa0ff);
  -webkit-background-clip: text;
  background-clip: text;
}

body.auth-locked .auth-copy > p:not(.eyebrow) {
  max-width: 690px;
  margin: 28px auto 0;
  color: #9ab4de;
  font-size: 19px;
  line-height: 1.55;
}

body.auth-locked .auth-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin: 36px auto 0;
  padding: 0 34px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #2f73ff, #2466ef);
  box-shadow: 0 24px 60px rgba(39, 104, 255, 0.24);
  font-weight: 950;
  text-decoration: none;
}

body.auth-locked .auth-trust {
  display: block;
  margin-top: 12px;
  color: #607da9;
  font-size: 13px;
}

body.auth-locked .auth-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 820px;
  margin: 44px auto 0;
}

body.auth-locked .auth-metrics span {
  display: grid;
  gap: 11px;
  min-height: 168px;
  padding: 24px;
  border-color: rgba(33, 91, 177, 0.48);
  border-radius: 18px;
  color: #9ab4de;
  background: rgba(13, 26, 48, 0.78);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

body.auth-locked .auth-metrics i {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(48, 113, 255, 0.38);
  border-radius: 15px;
  color: #64a3ff;
  background: rgba(32, 84, 170, 0.24);
  font-style: normal;
  font-weight: 950;
}

body.auth-locked .auth-metrics strong {
  color: #eaf2ff;
  font-size: 17px;
}

body.auth-locked .auth-metrics small {
  color: #9ab4de;
  font-size: 14px;
  line-height: 1.5;
}

body.auth-locked .auth-section-title {
  margin: 52px 0 18px;
  color: #eaf2ff;
  font-size: 22px;
}

body.auth-locked .integration-list {
  justify-content: center;
  max-width: 760px;
  margin: 0 auto;
}

body.auth-locked .integration-list span {
  border-color: rgba(20, 190, 157, 0.28);
  border-radius: 999px;
  color: #15c79f;
  background: rgba(10, 153, 126, 0.08);
}

body.auth-locked .integration-list span.is-waiting {
  border-color: rgba(69, 124, 215, 0.28);
  color: #7194cc;
  background: rgba(19, 52, 105, 0.12);
}

@keyframes auth-card-enter {
  from {
    transform: translateY(20px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

body.auth-locked {
  color: #f2f2f2;
  background:
    radial-gradient(circle at 50% 5%, rgba(255, 255, 255, 0.09), transparent 26rem),
    radial-gradient(circle at 38% 34%, rgba(180, 180, 180, 0.08), transparent 24rem),
    linear-gradient(180deg, #08090b 0%, #0d0e11 52%, #050506 100%);
}

body.auth-locked .scan-field {
  opacity: 0.16;
  background:
    repeating-linear-gradient(115deg, transparent 0 88px, rgba(255, 255, 255, 0.045) 88px 90px, transparent 90px 150px),
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.08), transparent 42%);
}

body.auth-locked .mesh,
body.auth-locked .rail {
  opacity: 0.22;
  filter: grayscale(1);
}

body.auth-locked .auth-panel {
  position: relative;
  min-height: 100vh;
  padding: 22px 18px 84px;
}

body.auth-locked .auth-copy {
  order: 1;
  width: min(980px, calc(100vw - 32px));
  min-height: auto;
  display: grid;
  align-content: start;
  padding: 0;
}

body.auth-locked .auth-brand-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  width: min(960px, 100%);
  margin: 0 auto clamp(28px, 5vw, 58px);
}

body.auth-locked .auth-brand-home {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #f3f3f3;
  text-decoration: none;
}

body.auth-locked .auth-brand-home strong,
body.auth-locked .auth-brand-row strong {
  color: #f3f3f3;
}

body.auth-locked .auth-brand-row > a:not(.auth-brand-home) {
  justify-self: end;
  color: #a5a7ad;
}

body.auth-locked .auth-brand-mark {
  border-color: rgba(255, 255, 255, 0.16);
  background: #0f1014;
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.08);
}

body.auth-locked .auth-nav-login {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #0b0b0d;
  background: #f4f4f4;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(255, 255, 255, 0.08);
}

body.auth-locked .auth-landing-logo {
  display: grid;
  place-items: center;
  width: min(238px, 46vw);
  margin: 0 auto 24px;
  opacity: 0.96;
  filter: drop-shadow(0 18px 48px rgba(255, 255, 255, 0.08));
}

body.auth-locked .auth-landing-logo img {
  width: 100%;
  height: auto;
}

body.auth-locked .auth-copy .eyebrow {
  color: #d8d8d8;
}

body.auth-locked .auth-copy h2 {
  color: #ffffff;
  font-size: clamp(42px, 5.2vw, 66px);
  text-shadow: 0 18px 60px rgba(255, 255, 255, 0.08);
}

body.auth-locked .auth-copy h2 span {
  color: transparent;
  background: linear-gradient(90deg, #ffffff, #b9bbc0 62%, #75777d);
  -webkit-background-clip: text;
  background-clip: text;
}

body.auth-locked .auth-copy > p:not(.eyebrow) {
  color: #c4c6cc;
  margin-top: 20px;
  font-size: 17px;
}

body.auth-locked .auth-cta {
  margin-top: 28px;
  border: 0;
  color: #09090b;
  background: linear-gradient(135deg, #ffffff, #cfd1d6);
  box-shadow: 0 24px 60px rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

body.auth-locked .auth-trust,
body.auth-locked .auth-metrics small,
body.auth-locked .auth-status {
  color: #8e9199;
}

body.auth-locked .auth-metrics {
  margin-top: 36px;
}

body.auth-locked .auth-metrics span {
  border-color: rgba(255, 255, 255, 0.12);
  color: #acafb7;
  background: rgba(17, 18, 23, 0.78);
}

body.auth-locked .auth-metrics i {
  border-color: rgba(255, 255, 255, 0.14);
  color: #eeeeee;
  background: rgba(255, 255, 255, 0.055);
}

body.auth-locked .auth-metrics strong,
body.auth-locked .auth-section-title {
  color: #f3f3f3;
}

body.auth-locked .auth-about {
  display: grid;
  gap: 18px;
  max-width: 920px;
  margin: 64px auto 0;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 42%),
    rgba(12, 13, 16, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

body.auth-locked .auth-about .eyebrow {
  margin: 0;
}

body.auth-locked .auth-about h3 {
  max-width: 760px;
  margin: 0 auto;
  color: #f3f3f3;
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1.05;
}

body.auth-locked .auth-about > p:not(.eyebrow) {
  max-width: 720px;
  margin: 0 auto;
  color: #a7a9b0;
  font-size: 16px;
  line-height: 1.65;
}

body.auth-locked .auth-about-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

body.auth-locked .auth-about-grid article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 186px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

body.auth-locked .auth-about-grid span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  color: #f2f2f2;
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  font-weight: 950;
}

body.auth-locked .auth-about-grid strong {
  color: #f3f3f3;
  font-size: 16px;
}

body.auth-locked .auth-about-grid p {
  margin: 0;
  color: #a3a5ad;
  font-size: 13px;
  line-height: 1.45;
}

body.auth-locked .auth-process {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 4px;
}

body.auth-locked .auth-process span {
  position: relative;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #d7d8dc;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
  font-weight: 900;
}

body.auth-locked .integration-list span,
body.auth-locked .integration-list span.is-ready,
body.auth-locked .integration-list span.is-waiting {
  border-color: rgba(255, 255, 255, 0.14);
  color: #c7c9cf;
  background: rgba(255, 255, 255, 0.045);
}

body.auth-locked .auth-card {
  position: fixed;
  top: 50vh;
  left: 50vw;
  z-index: 16;
  order: 2;
  display: grid;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 34px);
  overflow-y: auto;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(0.98);
  opacity: 0;
  border-color: rgba(255, 255, 255, 0.16);
  color: #f2f2f2;
  background:
    linear-gradient(180deg, rgba(23, 24, 29, 0.98), rgba(11, 12, 15, 0.98)),
    #101114;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: none;
  transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
}

body.auth-locked .auth-card {
  gap: 12px;
  padding: 24px 28px 24px;
}

body.auth-locked .auth-panel.auth-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

body.auth-locked .auth-panel.auth-open .auth-card {
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

body.auth-locked .auth-close-btn {
  justify-self: end;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: #c9cbd0;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

body.auth-locked .auth-card-logo {
  width: 46px;
  height: 46px;
  margin-top: -6px;
  filter: drop-shadow(0 18px 30px rgba(255, 255, 255, 0.1));
}

body.auth-locked .auth-card-logo img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

body.auth-locked .auth-card-head .status-pill,
body.auth-locked .auth-tabs,
body.auth-locked .auth-grid input,
body.auth-locked .auth-provider-note,
body.auth-locked .captcha-box,
body.auth-locked .social-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
}

body.auth-locked .auth-card-head .status-pill,
body.auth-locked .auth-tabs button,
body.auth-locked .auth-forgot {
  color: #aeb1b8;
}

body.auth-locked .auth-card-head p,
body.auth-locked .auth-provider-note,
body.auth-locked .divider,
body.auth-locked .auth-status {
  color: #9ea1a8;
}

body.auth-locked .divider span {
  color: #bfc1c7;
}

body.auth-locked .auth-grid label {
  color: #c6c8ce;
}

body.auth-locked .auth-grid input::placeholder {
  color: #777b84;
}

body.auth-locked .auth-tabs button.is-active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.11);
}

body.auth-locked .auth-actions .primary-action {
  color: #050506;
  background: linear-gradient(135deg, #ffffff, #d1d3d8);
  box-shadow: 0 18px 36px rgba(255, 255, 255, 0.11);
}

body.auth-locked .auth-card .auth-grid,
body.auth-locked .auth-card .social-actions {
  gap: 9px;
}

body.auth-locked .auth-actions {
  margin-top: 6px;
}

body.auth-locked .auth-provider-note {
  padding: 9px 10px;
  font-size: 11px;
  line-height: 1.35;
}

body.auth-locked .auth-actions .action-btn:not(.primary-action),
body.auth-locked .social-btn {
  color: #f2f2f2;
}

body.auth-locked .social-btn span {
  color: #050506;
  background: #f2f2f2;
}

body.auth-locked .social-btn .google-mark {
  width: 26px;
  height: 26px;
  padding: 5px;
  color: inherit;
  background: #ffffff;
}

body.auth-locked .social-btn .google-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

body.auth-locked .auth-status[data-tone="error"] {
  color: #f0b8b8;
}

body.auth-locked .auth-status[data-tone="success"] {
  color: #d7d7d7;
}

body.auth-locked .divider span {
  background: #121318;
}

@media (max-width: 760px) {
  body.auth-locked .auth-panel {
    padding: 18px 10px 72px;
  }

  body.auth-locked .auth-copy {
    min-height: auto;
  }

  body.auth-locked .auth-brand-row {
    grid-template-columns: auto auto;
    justify-content: stretch;
    gap: 10px;
  }

  body.auth-locked .auth-brand-home {
    grid-column: 1;
  }

  body.auth-locked .auth-brand-row > a:not(.auth-brand-home) {
    display: none;
  }

  body.auth-locked .auth-nav-login {
    grid-column: 2;
    justify-self: end;
    padding: 0 12px;
    font-size: 12px;
  }

  body.auth-locked .auth-landing-logo {
    width: min(310px, 88vw);
    margin-top: 26px;
  }

  body.auth-locked .auth-about {
    margin-top: 44px;
    padding: 18px;
    border-radius: 20px;
  }

  body.auth-locked .auth-about-grid {
    grid-template-columns: 1fr;
  }

  body.auth-locked .auth-about-grid article {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  body.auth-locked .auth-panel {
    gap: 48px;
    padding: 34px 10px 72px;
  }

  body.auth-locked .auth-card {
    width: min(100%, 368px);
    padding: 30px 20px 24px;
    border-radius: 18px;
  }

  body.auth-locked .auth-card h3 {
    font-size: 24px;
  }

  body.auth-locked .auth-tabs button {
    font-size: 11px;
  }

  body.auth-locked .auth-copy {
    width: min(100%, 368px);
  }

  body.auth-locked .auth-brand-row {
    grid-template-columns: auto auto;
    justify-content: center;
    margin-bottom: 34px;
  }

  body.auth-locked .auth-brand-row a {
    grid-column: 1 / -1;
    justify-self: center;
  }

  body.auth-locked .auth-copy h2 {
    font-size: 42px;
  }

  body.auth-locked .auth-copy > p:not(.eyebrow) {
    font-size: 16px;
  }

  body.auth-locked .auth-metrics {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.auth-locked .auth-metrics span {
    min-height: 0;
    padding: 18px;
  }
}

@media (max-width: 760px) {
  body.auth-locked .auth-panel {
    gap: 28px;
    padding: 18px 10px 64px;
  }

  body.auth-locked .auth-copy {
    width: min(100%, calc(100vw - 28px));
  }

  body.auth-locked .auth-brand-row {
    margin-bottom: 24px;
  }

  body.auth-locked .auth-landing-logo {
    width: min(194px, 58vw);
    margin: 4px auto 18px;
  }

  body.auth-locked .auth-copy h2 {
    max-width: calc(100vw - 36px);
    font-size: clamp(31px, 9vw, 37px);
    line-height: 1.07;
    text-wrap: balance;
  }

  body.auth-locked .auth-copy > p:not(.eyebrow) {
    max-width: calc(100vw - 44px);
    font-size: 15px;
    line-height: 1.55;
  }

  body.auth-locked .auth-cta {
    width: min(100%, 260px);
  }
}

/* ─────────────────────────────────────────────────────────────
   DESIGN IMPROVEMENTS v2 — Luxury Dark Editorial
   ───────────────────────────────────────────────────────────── */

/* ── Custom scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }

/* ── Global radius upgrade ─────────────────────────────────── */
:root { --radius: 10px; }

.step-section,
.auth-hero,
.composer,
.result-panel,
.video-studio,
.profile-modal {
  border-radius: 16px;
}

.stage-card,
.growth-card,
.workflow-nav,
.brief-preview,
.automation-panel,
.voice-panel,
.postfully-box,
.resource-panel,
.security-strip,
.captcha-box,
.auth-about {
  border-radius: 14px;
}

.action-btn,
.ghost-btn,
.generate-btn,
.choice,
.template {
  border-radius: 10px;
}

.chip, .mini, .duration-chip, .preset-card {
  border-radius: 9px;
}

.status-pill,
.auth-nav-login,
.security-strip span,
.integration-list span {
  border-radius: 999px !important;
}

/* ── Scrollbar for inner panels ────────────────────────────── */
.subtitle-timeline-grid,
.batch-grid,
.series-grid {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.13) transparent;
}

/* ── Typography — section headings in serif ────────────────── */
.section-head h2,
.panel-head h2,
.video-head h2,
.resource-panel h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.eyebrow,
.label {
  letter-spacing: 0.1em;
  font-size: 10px;
}

/* ── Primary action button ─────────────────────────────────── */
.primary-action {
  background: linear-gradient(160deg, #ffffff 0%, #d6d6d2 100%);
  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255,255,255,0.9);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action:hover {
  background: linear-gradient(160deg, #ffffff 0%, #e2e2de 100%);
  box-shadow: 0 8px 28px rgba(255, 255, 255, 0.16), inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateY(-1px);
}

/* ── Generate button upgrade ─────────────────────────────────── */
.generate-btn {
  letter-spacing: 0.03em;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255,255,255,0.8);
}

.generate-btn:hover {
  box-shadow: 0 14px 40px rgba(255, 255, 255, 0.2), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* ── Input & select focus ───────────────────────────────────── */
input:not([type="range"]):not([type="checkbox"]):not([type="file"]):focus,
select:focus {
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05) !important;
  outline: none;
}

/* ── Stage cards ─────────────────────────────────────────────── */
.stage-card {
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.stage-card:hover,
.stage-card.is-active {
  transform: translateY(-3px);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ── Workflow nav active state ──────────────────────────────── */
.workflow-nav a.is-active {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ── Growth cards ─────────────────────────────────────────────── */
.growth-card {
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.growth-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ── Story quick actions ────────────────────────────────────── */
.story-quick-actions {
  border-radius: 12px;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ── Auth hero: inner nav (auth-brand-row) ───────────────────── */
body.auth-locked .auth-brand-row {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: clamp(24px, 4vw, 48px);
}

body.auth-locked .auth-brand-row > a:not(.auth-brand-home) {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 180ms ease;
}

body.auth-locked .auth-brand-row > a:not(.auth-brand-home):hover {
  color: rgba(255, 255, 255, 0.85);
}

/* ── Auth metrics: 4-col, serif numbers, hover lift ─────────── */
body.auth-locked .auth-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 100%;
  gap: 8px;
}

body.auth-locked .auth-metrics span {
  padding: 18px 16px;
  border-radius: 14px;
  border-color: rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.065), transparent 60%),
    rgba(255, 255, 255, 0.025);
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  cursor: default;
}

body.auth-locked .auth-metrics span:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

body.auth-locked .auth-metrics i {
  display: block;
  color: rgba(255, 255, 255, 0.28);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.auth-locked .auth-metrics strong {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 21px;
  font-weight: 400;
  line-height: 1.1;
  color: #f0f0ee;
  margin-top: 6px;
}

body.auth-locked .auth-metrics small {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.38);
}

/* ── Auth about: features grid ──────────────────────────────── */
body.auth-locked .auth-about-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

body.auth-locked .auth-about-grid article {
  padding: 22px 20px;
  border-radius: 14px;
  border-color: rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.05), transparent 55%),
    rgba(255,255,255,0.02);
  transition: border-color 200ms ease, transform 220ms ease, box-shadow 220ms ease;
}

body.auth-locked .auth-about-grid article:hover {
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

body.auth-locked .auth-about-grid span {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 800;
}

body.auth-locked .auth-about-grid strong {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

body.auth-locked .auth-about-grid p {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(200, 202, 210, 0.7);
}

/* ── Auth process: connected pill steps ─────────────────────── */
body.auth-locked .auth-process {
  gap: 0;
  align-items: center;
  padding: 14px 0;
}

body.auth-locked .auth-process span {
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transition: border-color 180ms ease, background 180ms ease;
}

body.auth-locked .auth-process span:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

body.auth-locked .auth-process span:not(:last-child) {
  margin-right: 4px;
}

body.auth-locked .auth-process span + span {
  margin-left: 4px;
}

/* ── Auth card refinement ───────────────────────────────────── */
body.auth-locked .auth-card {
  border-radius: 20px;
  gap: 16px;
}

body.auth-locked .auth-tabs {
  border-radius: 12px;
}

body.auth-locked .auth-tabs button {
  border-radius: 8px;
}

/* ── Section head in studio ────────────────────────────────── */
.section-head h2 {
  color: var(--ink);
}

/* ── Retention score badge ──────────────────────────────────── */
.retention-score {
  border-radius: 10px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}

/* ── Script map steps ───────────────────────────────────────── */
.script-step {
  border-radius: 12px;
}

/* ── Error message ──────────────────────────────────────────── */
.error-msg {
  border-radius: 10px;
}

/* ── Auth about heading ──────────────────────────────────────── */
body.auth-locked .auth-about h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ── Auth section title ──────────────────────────────────────── */
body.auth-locked .auth-section-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.02em;
}

/* ─────────────────────────────────────────────────────────────
   HERO VIDEO BACKGROUND
   ───────────────────────────────────────────────────────────── */

.hero-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

body.auth-locked .app-shell {
  position: relative;
  z-index: 1;
}

body.auth-locked .hero-video {
  opacity: 1;
}

/* Remove ALL decorative overlays — video provides all visual depth */
body.auth-locked .backdrop {
  background: transparent;
  z-index: -1;
}

body.auth-locked .grain,
body.auth-locked .scan-field,
body.auth-locked .mesh,
body.auth-locked .rail {
  display: none;
}

/* ─────────────────────────────────────────────────────────────
   LIQUID GLASS
   ───────────────────────────────────────────────────────────── */

.liquid-glass {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%,
    rgba(255,255,255,0.15) 80%, rgba(255,255,255,0.45) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   FADE-RISE ANIMATIONS
   ───────────────────────────────────────────────────────────── */

@keyframes fade-rise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-rise         { animation: fade-rise 0.8s ease-out both; }
.animate-fade-rise-delay   { animation: fade-rise 0.8s ease-out 0.2s both; }
.animate-fade-rise-delay-2 { animation: fade-rise 0.8s ease-out 0.4s both; }
.animate-fade-rise-delay-3 { animation: fade-rise 0.8s ease-out 0.6s both; }

/* ─────────────────────────────────────────────────────────────
   GLASSMORPHIC TOPBAR (auth-locked state)
   ───────────────────────────────────────────────────────────── */

body.auth-locked .topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 5, 18, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.auth-locked .topbar-link {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.auth-locked .account-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   CINEMATIC AUTH-HERO
   ───────────────────────────────────────────────────────────── */

body.auth-locked .auth-hero {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

body.auth-locked .auth-hero::before {
  opacity: 0;
}

/* heading — bigger, more cinematic */
body.auth-locked .auth-copy h2 {
  font-size: clamp(52px, 8vw, 108px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

body.auth-locked .auth-copy h2 em.muted-word {
  font-style: normal;
  color: rgba(255, 255, 255, 0.42);
}

body.auth-locked .auth-copy > p:not(.eyebrow) {
  font-size: 17px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.58);
  max-width: 540px;
}

body.auth-locked .auth-copy .eyebrow {
  color: rgba(255, 255, 255, 0.52);
  letter-spacing: 0.08em;
}

/* liquid-glass auth card */
body.auth-locked .auth-card {
  background: rgba(6, 6, 18, 0.55);
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* CTA button — liquid glass rounded pill */
body.auth-locked .auth-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.18),
    0 8px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
  position: relative;
  overflow: hidden;
}

body.auth-locked .auth-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0) 40%, rgba(255,255,255,0) 60%,
    rgba(255,255,255,0.15) 80%, rgba(255,255,255,0.45) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

body.auth-locked .auth-cta:hover {
  transform: scale(1.03);
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.22),
    0 12px 40px rgba(0, 0, 0, 0.4);
}

body.auth-locked .auth-cta span[aria-hidden] {
  opacity: 0.7;
  transition: transform 200ms ease;
}

body.auth-locked .auth-cta:hover span[aria-hidden] {
  transform: translateX(4px);
}

/* ─────────────────────────────────────────────────────────────
   PERFORMANCE — paint/layout containment & content-visibility
   ───────────────────────────────────────────────────────────── */

/*
  content-visibility: auto → el browser omite render/layout de
  secciones fuera del viewport hasta que sean necesarias.
  Mejora LCP y TTI en SPAs con mucho contenido oculto.
  contain-intrinsic-size evita layout shift al entrar al viewport.
*/
.step-section {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
}

.video-studio {
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}

.auth-about {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/*
  contain: content → aisla paint + layout del componente.
  Ideal para tarjetas repetidas: el browser no relayoutea el
  resto del DOM cuando cambia el contenido de una tarjeta.
*/
.stage-card,
.growth-card,
.resource-card {
  contain: content;
}

.auth-about-grid article {
  contain: layout style;
}

/*
  Optimizacion de fuentes: forzar subconjunto Latin para
  reducir el tiempo de descarga del fallback del sistema.
*/
body {
  font-synthesis: none;
  text-rendering: optimizeSpeed;
}

h1, h2, h3 {
  text-rendering: optimizeLegibility;
}

/*
  Reducir repaints en el resultado de texto generado:
  pointer-events none hasta que haya contenido evita
  que el browser registre hit-testing innecesario.
*/
.result-body:empty {
  pointer-events: none;
}

/*
  prefers-reduced-motion: para usuarios que piden menos movimiento
  (también sirve para detectar dispositivos con GPU débil o ahorro de batería).
  Desactiva TODAS las animaciones del backdrop — el mayor costo de compositing.
*/
@media (prefers-reduced-motion: reduce) {
  .scan-field,
  .mesh,
  .rail-a {
    animation: none !important;
    will-change: auto !important;
  }

  .scan-field {
    opacity: 0.28;
    transform: perspective(900px) rotateX(58deg) translateY(-8%);
  }

  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/*
  Para pantallas de baja potencia (densidad de píxeles baja suele implicar
  hardware limitado): reducir blur y deshabilitar animaciones del backdrop.
*/
@media (max-resolution: 1.5dppx) and (max-width: 768px) {
  .scan-field,
  .mesh-a,
  .rail-a {
    animation: none !important;
    will-change: auto !important;
  }

  .backdrop .mesh-b,
  .backdrop .rail-b {
    display: none;
  }

  .composer,
  .result-panel,
  .auth-panel,
  .video-studio,
  .workflow-nav {
    backdrop-filter: none !important;
  }
}

/* ─── LIBRARY STUDIO ──────────────────────────────────────────────────────── */

.library-step { display: none; gap: 20px; }

.library-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.library-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.library-filter {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.library-filter:hover { background: rgba(255,255,255,0.06); color: var(--fg); }
.library-filter.is-active { background: rgba(255,255,255,0.1); color: var(--fg); border-color: rgba(255,255,255,0.25); }

.library-search-box {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.library-search-box input[type="search"] {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color 160ms ease;
}
.library-search-box input[type="search"]:focus { border-color: rgba(255,255,255,0.3); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.library-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,0.065), transparent 55%), rgba(255,255,255,0.03);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}
.library-card:hover { transform: translateY(-2px); background: linear-gradient(145deg, rgba(255,255,255,0.09), transparent 55%), rgba(255,255,255,0.05); }

.library-card--story    { border-left-color: #6c8ef5; }
.library-card--autosave { border-left-color: #5cc8a0; }
.library-card--project  { border-left-color: #e07b4f; }

.library-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.library-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-card-detail {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.library-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.library-card-actions button {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  transition: background 140ms ease;
}
.library-card-actions button:hover { background: rgba(255,255,255,0.08); }
.library-card-actions .lib-delete-btn { color: #e07070; border-color: rgba(224,112,112,0.3); }
.library-card-actions .lib-delete-btn:hover { background: rgba(224,112,112,0.12); }

.library-card--confirming .library-card-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(224,112,112,0.1);
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg);
  text-align: center;
}
.library-card--confirming .library-card-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.library-card--confirming .library-card-confirm-actions button {
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
}
.library-card--confirming .lib-confirm-yes { background: rgba(224,112,112,0.2); border-color: rgba(224,112,112,0.5); color: #e07070; }

.library-card-rename-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  padding: 4px 8px;
  outline: none;
}

.library-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.library-empty strong { font-size: 15px; color: var(--fg); }
.library-empty span   { font-size: 13px; color: var(--muted); }

.library-preview {
  margin-top: 4px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  display: grid;
  gap: 14px;
}
/* El atributo hidden debe ganar al display:grid de arriba */
.library-preview[hidden] {
  display: none;
}
.library-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.library-preview-head strong { font-size: 15px; color: var(--fg); }
.library-preview-body {
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.7;
}

/* ─── Estado de carga (botones async) ────────────────────────────────────── */
.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--ink);
  border-top-color: transparent;
  border-radius: 50%;
  animation: wnx-spin 0.6s linear infinite;
  opacity: 0.7;
}
@keyframes wnx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .is-loading::after { animation-duration: 1.4s; }
}

/* ─── Foco accesible: anillo visible al navegar con teclado ──────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}
/* No mostrar el anillo en clic con mouse (solo teclado) */
:focus:not(:focus-visible) { outline: none; }

.legal-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.legal-container h1,
.legal-container h2,
.legal-container h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.legal-container p,
.legal-container li {
    line-height: 1.7;
}

/* ─── HERRAMIENTAS EXTERNAS (Biblioteca) ─────────────────────────────────── */

.external-tools {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.external-tools-sub {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.external-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.ext-tool-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.ext-tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.055);
}

.ext-tool-card.is-connected {
  border-color: rgba(74, 222, 128, 0.34);
}

.ext-tool-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.ext-tool-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex: none;
}

.ext-tool-logo svg {
  width: 24px;
  height: 24px;
}

.ext-logo-tiktok {
  background: #010101;
}
.ext-logo-tiktok svg {
  fill: #ffffff;
  filter: drop-shadow(-1.4px -1px 0 #25f4ee) drop-shadow(1.4px 1px 0 #fe2c55);
}

.ext-logo-capcut {
  background: #ffffff;
}
.ext-logo-capcut svg {
  fill: #0d0d0d;
}

.ext-logo-shorts {
  background: #ffffff;
}
.ext-logo-shorts .ext-shorts-body { fill: #ff0033; }
.ext-logo-shorts .ext-shorts-play { fill: #ffffff; }

.ext-logo-eleven {
  background: #ffffff;
}
.ext-logo-eleven svg {
  fill: #0d0d0d;
}

.ext-tool-id {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ext-tool-id strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.ext-tool-id small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ext-tool-state {
  align-self: start;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ext-tool-card.is-connected .ext-tool-state {
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.ext-tool-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.ext-tool-actions {
  display: flex;
  gap: 8px;
}

.ext-tool-actions .action-btn {
  flex: 1 1 auto;
  min-height: 38px;
  font-size: 12.5px;
}

.ext-tool-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ext-tool-perm {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ext-tool-meta {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.ext-tool-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ext-tool-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ext-tool-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ── Flujo automatizado (pipeline de integraciones) ── */
.ext-pipeline {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.ext-pipeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ext-pipeline-head strong {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.ext-pipeline-head span {
  color: var(--muted);
  font-size: 12px;
}

.ext-pipeline-head span.is-complete {
  color: #4ade80;
}

.ext-pipeline-track {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.ext-pipeline-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 14px;
  flex: none;
}

.ext-pipeline-step {
  display: grid;
  gap: 3px;
  align-content: start;
  min-width: 128px;
  flex: 1 1 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  opacity: 0.72;
  transition: border-color 180ms ease, opacity 180ms ease;
}

.ext-pipeline-step.is-ready {
  border-style: solid;
  opacity: 1;
}

.ext-pipeline-step.is-ready:not(.is-builtin) {
  border-color: rgba(74, 222, 128, 0.34);
}

.ext-pipeline-step strong {
  color: var(--ink);
  font-size: 12.5px;
}

.ext-pipeline-step small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ext-pipeline-state {
  justify-self: start;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ext-pipeline-step.is-ready:not(.is-builtin) .ext-pipeline-state {
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

/* ── Modal de integracion (conectar / configurar) ── */
.ext-tool-modal {
  max-width: 480px;
  max-height: min(86dvh, 720px);
  overflow-y: auto;
  gap: 0;
}

.ext-tool-modal-body {
  display: grid;
  gap: 16px;
}

.ext-modal-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-right: 28px;
}

.ext-tool-state.is-on {
  border-color: rgba(74, 222, 128, 0.4);
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.ext-modal-block {
  display: grid;
  gap: 8px;
}

.ext-modal-block h4 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ext-modal-perms {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.ext-modal-scopes {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.ext-modal-scopes code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10.5px;
}

.ext-modal-hint,
.ext-modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.ext-modal-note {
  font-size: 11px;
  opacity: 0.8;
}

.ext-modal-fields {
  display: grid;
  gap: 10px;
}

.ext-modal-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ext-modal-field input[type='text'],
.ext-modal-field input[type='password'],
.ext-modal-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 13px;
}

.ext-modal-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.ext-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ext-modal-actions .action-btn {
  flex: 1 1 auto;
  min-height: 38px;
  font-size: 12.5px;
}

.ext-modal-status {
  margin: 0;
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.ext-modal-status.is-error {
  color: #f87171;
}

/* ─── OPCIONES ESTATICAS DEL PANEL DE VIDEO ──────────────────────────────────
   Los controles condicionales (duracion personalizada, plantilla custom) no
   se ocultan: quedan en su lugar, atenuados y deshabilitados, para que la
   grilla del editor nunca cambie de posicion. */
.is-static-off {
  opacity: 0.42;
  transition: opacity 180ms ease;
}

.is-static-off input,
.is-static-off select,
.is-static-off textarea {
  cursor: not-allowed;
}

#custom-template-panel.is-static-off {
  pointer-events: none;
}
