:root {
  color-scheme: light;

  --bg: #faf7f4;
  --surface: #ffffff;
  --surface-2: #f2ece6;
  --surface-3: #e9e1d9;
  --line: #e2d9d0;
  --line-strong: #cfc2b6;

  --text: #1f1a16;
  --text-soft: #453b34;
  --muted: #6b5f56;

  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.10);
  --on-accent: #ffffff;

  --ok: #2f6b3a;
  --ok-soft: #e4f0e6;
  --warn: #8a5a08;
  --warn-soft: #fbeed6;
  --error: #a53225;
  --error-soft: #f9e5e2;

  --shadow-sm: 0 1px 2px rgb(31 26 22 / 0.06);
  --shadow-md: 0 2px 8px rgb(31 26 22 / 0.07);
  --shadow-lg: 0 8px 28px rgb(31 26 22 / 0.1);

  --radius: 10px;
  --radius-sm: 7px;

  --font-sans: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;

  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #191512;
  --surface: #221d19;
  --surface-2: #2b2521;
  --surface-3: #362f29;
  --line: #3a322c;
  --line-strong: #4d4239;

  --text: #f4efe9;
  --text-soft: #ded5cc;
  --muted: #a89d93;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --on-accent: #ffffff;

  --ok: #7fb87a;
  --ok-soft: #23301f;
  --warn: #dcae52;
  --warn-soft: #322713;
  --error: #e0776a;
  --error-soft: #331d19;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-md: 0 2px 10px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 10px 30px rgb(0 0 0 / 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.7rem;
  letter-spacing: -0.015em;
  margin: 0;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin: 0;
}

h3 {
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
  color: var(--text);
}

h4,
h5 {
  font-size: 0.78rem;
  margin: 1rem 0 0.35rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p {
  margin: 0 0 0.7rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.82rem;
}

.error {
  color: var(--error);
}

.ok {
  color: var(--ok);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 1.2rem 0.9rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.brand {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.4rem;
  padding: 0 0.3rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-hover));
  color: var(--on-accent);
  border-radius: 9px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.brand strong {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}

.sidebar nav a {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
}

.sidebar nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.sidebar nav a.on {
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-toggle {

  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 0.85rem;
}

.theme-toggle:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.content {
  padding: 1.8rem 2.2rem 4rem;
  overflow-x: hidden;
}

/* columna derecha: contenido + barra de consumo */
.main-col {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-col .content {
  flex: 1;
}

.usage-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 2.2rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--text-soft);
  z-index: 5;
}

.usage-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.usage-bar .sep {
  color: var(--line-strong);
}

.usage-provider small {
  color: var(--muted);
  margin-left: 0.25rem;
}

.usage-link {
  margin-left: auto;
  color: var(--accent, #2563eb);
  text-decoration: none;
  font-size: 0.8rem;
}

.usage-link:hover {
  text-decoration: underline;
}

.page {
  max-width: 1080px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.page-head p {
  margin: 0.3rem 0 0;
  max-width: 60ch;
}

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.breadcrumb strong {
  color: var(--text-soft);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.form {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
  box-shadow: var(--shadow-md);
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

input,
textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.9rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.book-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.book-card h2 a {
  color: var(--text);
}

.premise {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.meta {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
  margin-bottom: 0.7rem;
}

.meta span:not(:last-child)::after {
  content: '·';
  margin-left: 0.8rem;
  color: var(--line-strong);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

button,
.btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:hover,
.btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.danger {
  border-color: var(--error);
  color: var(--error);
}

.danger:hover:not(:disabled) {
  background: var(--error-soft);
  border-color: var(--error);
}

.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--text);
}

.small {
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.empty a {
  display: inline-block;
  margin-top: 0.8rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 0.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.4rem;
}

.tabs a {
  padding: 0.55rem 1rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: -1px;
}

.tabs a.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabs a:hover {
  text-decoration: none;
  color: var(--text);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line-strong);
}

.table td {
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tr:hover td {
  background: var(--surface);
}

.table td a {
  font-weight: 500;
}

.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.synopsis {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 60ch;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
}

.pill-planned {
  color: var(--muted);
}

.pill-drafted {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn);
}

.pill-reviewed {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok);
}

.pill-drafting,
.pill-run-running,
.pill-step-running {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.pill-run-failed,
.pill-step-failed {
  color: var(--error);
  background: var(--error-soft);
  border-color: var(--error);
}

.pill-run-succeeded,
.pill-step-succeeded {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok);
}

.chapter-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1.4rem;
  align-items: start;
}

.chapter-list {
  display: grid;
  gap: 0.15rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.87rem;
}

.chapter-item:hover {
  background: var(--surface);
  text-decoration: none;
}

.chapter-item.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.chapter-num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.4rem;
}

.chapter-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
}

.dot-drafted {
  background: var(--warn);
}

.dot-reviewed {
  background: var(--ok);
}

.chapter-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.chapter-head h2 {
  margin: 0;
}

.brief {
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
}

.brief ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.87rem;
}

.brief li {
  margin-bottom: 0.2rem;
}

.revisions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.83rem;
}

.chip {
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  border-radius: 999px;
  min-width: 2rem;
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.editor textarea {
  width: 100%;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.75;
  padding: 1.4rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  max-width: 72ch;
}

.editor-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.editor-bar .primary {
  margin-left: auto;
}

.run-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.4rem;
  align-items: start;
}

.run-controls {
  display: grid;
  gap: 0.9rem;
  box-shadow: var(--shadow-md);
}

.run-controls h3 {
  margin: 0;
}

.run-controls p {
  margin: 0;
}

.check {
  grid-template-columns: auto 1fr;
  display: grid;
  gap: 0.6rem;
  align-items: start;
}

.check input {
  margin-top: 0.28rem;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.check span {
  font-weight: 500;
  color: var(--text-soft);
}

.check small {
  display: block;
  font-weight: 400;
}

.run-history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.run-history li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.steps {
  margin-top: 1.2rem;
}

.steps-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.steps-head h3 {
  margin: 0;
}

.bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.7rem 0 1rem;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.45rem 0.6rem;
  font-weight: 400;
}

.step-head:hover {
  background: var(--surface-2);
  border-color: transparent;
}

.step-name {
  flex: 1;
  font-size: 0.87rem;
}

.step-body {
  padding: 0.3rem 0.9rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  border-left: 2px solid var(--accent-soft);
  margin: 0.2rem 0 0.5rem 1rem;
  white-space: pre-wrap;
}

.memory-top {
  margin-bottom: 1.6rem;
}

.threads,
.facts,
.plain {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.87rem;
  display: grid;
  gap: 0.35rem;
}

.plain {
  list-style: none;
  padding-left: 0;
}

.section-title {
  margin: 1.8rem 0 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 600;
}

.memory-card {
  box-shadow: var(--shadow-sm);
}

.memory-card h4 {
  margin-top: 0;
}

.memory-card h4 a {
  color: var(--text);
}

.summary {
  color: var(--text-soft);
  font-size: 0.87rem;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .brand {
    margin-bottom: 0;
  }

  .theme-toggle {
    margin-top: 0;
    margin-left: auto;
    width: auto;
  }

  .content {
    padding: 1.2rem 1rem 3rem;
  }

  .stats,
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-layout,
  .run-layout,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .chapter-list {
    position: static;
    max-height: 200px;
    overflow-y: auto;
  }
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.export-actions p {
  margin: 0;
  font-size: 0.85rem;
}

.book-export {
  background: #fff;
  color: #1a1a1a;
  padding: 3rem;
  border-radius: var(--radius);
  max-width: 720px;
  margin: 0 auto;
}

.book-cover {
  text-align: center;
  padding: 3rem 0;
  border-bottom: 2px solid #ddd;
  margin-bottom: 2rem;
}

.book-cover h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #111;
}

.book-premise {
  font-style: italic;
  color: #555;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.book-meta {
  margin-top: 1rem;
  color: #888;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.book-chapter {
  page-break-before: always;
  margin-bottom: 2rem;
}

.book-chapter h2 {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #ddd;
  color: #111;
}

.book-chapter p {
  margin-bottom: 1rem;
  line-height: 1.8;
  text-align: justify;
  color: #222;
  font-size: 1rem;
}

/* ---------- Exportar: vista previa de libro compilado ---------- */

.export-cover-page {
  text-align: center;
  page-break-before: always;
}

.export-cover-page img {
  width: 100%;
  height: auto;
  display: block;
}

.export-portadilla {
  text-align: center;
  padding: 3rem 0 1rem;
  page-break-before: always;
}

.export-portadilla h1 {
  font-size: 1.8rem;
  margin: 0 0 0.5rem;
  color: #111;
}

.export-portadilla .subtitle {
  font-style: italic;
  color: #444;
  font-size: 1.1rem;
}

.export-portadilla .author {
  margin-top: 1.2rem;
  font-size: 1rem;
}

.export-portadilla .publisher {
  margin-top: 2.4rem;
  color: #666;
  font-size: 0.85rem;
}

.export-part,
.export-chapter,
.export-toc-page,
.export-back-cover {
  page-break-before: always;
}

.export-part h2,
.export-chapter h2 {
  text-align: center;
  font-size: 1.3rem;
  margin: 0 0 1.2rem;
  color: #111;
}

.export-part p,
.export-chapter p {
  margin-bottom: 0.8rem;
  line-height: 1.8;
  text-align: justify;
  color: #222;
}

.export-part ul,
.export-chapter ul {
  margin: 0 0 0.8rem;
  padding-left: 1.2rem;
}

.export-part li,
.export-chapter li {
  margin-bottom: 0.3rem;
  line-height: 1.7;
  text-align: justify;
  color: #222;
}

.export-chapter h3 {
  font-size: 1.05rem;
  margin: 0.9rem 0 0.3rem;
  color: #111;
}

.export-toc-page h2 {
  text-align: center;
}

.export-toc-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-bottom: 0.28rem;
}

.export-toc-row.level2 {
  margin-left: 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 0.18rem;
}

.export-toc-row .toc-label {
  min-width: 0;
}

.export-toc-row .toc-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted #999;
  transform: translateY(-0.2em);
}

.export-toc-row .toc-pg {
  width: 1.7em;
  min-width: 1.7em;
  text-align: right;
}

.export-back-cover {
  text-align: center;
}

.export-back-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.export-back-cover .blurb {
  font-style: italic;
  line-height: 1.6;
  text-align: justify;
  color: #222;
  margin: 0.8rem auto 0;
  max-width: 38em;
}

/* ---------- Marketing: productos ---------- */

.product-card {
  display: flex;
  gap: 1rem;
}

.product-image {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload,
.image-replace {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  width: 100%;
  height: 100%;
  padding: 0.3rem;
}

.btn.image-replace {
  width: auto;
  height: auto;
  margin-top: 0.4rem;
}

.image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-info h3 {
  margin: 0 0 0.25rem;
}

.product-info .actions {
  margin-top: 0.4rem;
}

/* ---------- Marketing: contenido ---------- */

.content-cards {
  display: grid;
  gap: 0.8rem;
}

.content-card {
  padding: 0;
  overflow: hidden;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  color: inherit;
}

.content-head h3 {
  margin: 0 0 0.3rem;
}

.content-card .meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.content-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.content-body .brief {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin: 0.8rem 0 0.4rem;
}

.copy-text {
  margin: 0.6rem 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

.hashtags {
  color: var(--accent, #2563eb);
  font-size: 0.9rem;
  margin: 0.3rem 0 0.6rem;
}

.image-prompt-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
}

.image-prompt-box strong {
  font-size: 0.8rem;
}

.image-prompt-box p {
  margin: 0.3rem 0 0.4rem;
}

.reject-input {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

.chip {
  font-size: 0.7rem;
  background: var(--surface-3);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  color: var(--muted);
}

/* ---------- Zona de imagen de la pieza ---------- */

.image-zone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.5rem 0;
}

.image-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.piece-image {
  position: relative;
}

.piece-image img {
  width: 100%;
  max-width: 280px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.btn.whatsapp {
  background: #25d366;
  color: #fff;
  border-color: #25d366;
}

.btn.whatsapp:hover {
  background: #1fb855;
}

/* ---------- Links de marca y edición ---------- */

.brand-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin: 0.4rem 0;
}

.brand-links a {
  font-size: 0.82rem;
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.brand-links a:hover {
  text-decoration: underline;
}

.social-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  margin: 0;
}

.social-fields legend {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 0.4rem;
}

.part-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem;
  padding: 0.2rem 0;
}

/* ---------- Diseño del libro (portada/contraportada) ---------- */

.cover-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toggle-cover {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.cover-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.6rem;
}

.cover-side {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cover-side h4 {
  margin: 0;
}

.cover-img {
  width: 100%;
  max-width: 220px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 220px;
  height: 150px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 0.85rem;
}

@media print {
  body * {
    visibility: hidden;
  }

  .book-export,
  .book-export * {
    visibility: visible;
  }

  .book-export {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .no-print,
  .sidebar,
  .tabs,
  .breadcrumb,
  .stats,
  .page-head {
    display: none !important;
  }

  .book-chapter {
    page-break-before: always;
  }

  .book-cover {
    page-break-after: always;
    border-bottom: none;
  }

  .export-cover-page,
  .export-portadilla,
  .export-part,
  .export-chapter,
  .export-toc-page,
  .export-back-cover {
    page-break-before: always;
  }

  @page {
    margin: 2cm;
  }
}

/* ---------- Videos YouTube ---------- */

.video-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.video-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.video-card-head a {
  color: inherit;
  text-decoration: none;
}

.video-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.video-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.pill-keywords,
.pill-scripted,
.pill-scenes {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.pill-rendering {
  background: rgba(234, 179, 8, 0.18);
  color: #ca8a04;
}

.pill-ready,
.pill-uploaded {
  background: rgba(34, 197, 94, 0.16);
  color: #16a34a;
}

.pill-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.pill-scene-planned {
  background: rgba(100, 116, 139, 0.16);
  color: #64748b;
}

.pill-scene-audio_ready {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.pill-scene-asset_ready {
  background: rgba(34, 197, 94, 0.16);
  color: #16a34a;
}

.pill-scene-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.scene-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.scene {
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.scene:last-child {
  border-bottom: none;
}

.scene-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem 0.2rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.scene-num {
  font-weight: 600;
  min-width: 2.2rem;
  color: #888;
}

.scene-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-detail {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0 0.9rem 2.9rem;
  flex-wrap: wrap;
  align-items: center;
}

.scene-detail img {
  border-radius: 6px;
}

.seo-block h4 {
  margin: 0.8rem 0 0.2rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
}

.seo-block p {
  margin: 0;
}

.pre-wrap {
  white-space: pre-wrap;
}

.thumbnail-preview {
  margin-top: 0.8rem;
}

.thumbnail-preview img {
  border-radius: 8px;
  border: 1px solid rgba(128, 128, 128, 0.25);
}


/* ---------- Barra de progreso moderna (shimmer + chips) ---------- */

.fj-progress {
  margin: 0.6rem 0;
}

.fj-progress-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3, rgba(128, 128, 128, 0.18));
  overflow: hidden;
}

.fj-progress-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, #7c3aed 0%, #4f46e5 55%, #0ea5e9 100%);
  overflow: hidden;
}

.fj-progress-track.fj-done .fj-progress-fill {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.fj-progress-track.fj-error .fj-progress-fill {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* brillo que recorre la barra (shimmer) */
.fj-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.45) 50%,
    transparent 80%
  );
  animation: fj-shimmer 1.8s infinite;
}

@keyframes fj-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.fj-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.35rem;
}

.fj-progress-label {
  font-size: 0.82rem;
  color: var(--muted, #888);
  font-weight: 500;
}

.fj-progress-pct {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted, #666);
}

.fj-compact .fj-progress-track {
  height: 5px;
}

/* chips de pasos */
.fj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.fj-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem 0.22rem 0.5rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  background: rgba(128, 128, 128, 0.1);
  color: var(--muted, #777);
  border: 1px solid rgba(128, 128, 128, 0.12);
  backdrop-filter: blur(6px);
}

.fj-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(128, 128, 128, 0.35);
}

.fj-chip-succeeded {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #059669;
}

.fj-chip-succeeded .fj-chip-dot {
  background: #10b981;
}

.fj-chip-running {
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.15), rgba(14, 165, 233, 0.15));
  border-color: rgba(124, 58, 237, 0.35);
  color: #7c3aed;
}

.fj-chip-running .fj-chip-dot {
  background: #7c3aed;
  animation: fj-pulse 1.4s ease-in-out infinite;
}

@keyframes fj-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

.fj-chip-failed {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.fj-chip-failed .fj-chip-dot {
  background: #ef4444;
}

/* integración: reemplaza la barra vieja dentro de .steps */
.card.steps .bar {
  display: none;
}

.audio-preview-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}


/* ---------- Prompts para IA externa ---------- */

.prompts-section {
  margin-bottom: 1rem;
}

.prompts-head h3 {
  margin-bottom: 0.2rem;
}

.prompts-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.6rem 0 0.8rem;
}

.prompt-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.8rem;
}

.prompt-row {
  border-bottom: 1px solid rgba(128, 128, 128, 0.14);
}

.prompt-row:last-child {
  border-bottom: none;
}

.prompt-row-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.45rem 0.2rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.prompt-preview {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted, #888);
  font-style: italic;
}

.prompt-detail {
  padding: 0.3rem 0 0.8rem 2.9rem;
}

.prompt-detail textarea {
  width: 100%;
  font-size: 0.82rem;
  resize: vertical;
}

.prompt-detail-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.btn.tiny {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.thumb-prompt-block,
.copy-block {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(128, 128, 128, 0.14);
}

.thumb-prompt-block h4,
.copy-block h4 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
}

.thumb-prompt-block textarea,
.copy-block textarea {
  width: 100%;
  font-size: 0.82rem;
  resize: vertical;
}

.confirm-cost-box {
  margin: 0.5rem 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.08);
  border-radius: 8px;
  font-size: 0.85rem;
}

.confirm-cost-box p {
  margin: 0.15rem 0;
}

.usage-chip {
  font-size: 0.75rem;
  margin: 0.2rem 0 0.5rem;
}

.yt-chip {
  display: inline-block;
  margin-right: 0.4rem;
}

.publish-section {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.publish-section select {
  padding: 0.35rem 0.5rem;
}

/* ---------- Ajustes ---------- */
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(128, 128, 128, 0.18);
  padding-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.8rem;
}

.sidebar-bottom a {
  color: var(--muted, #999);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.2rem;
}

.sidebar-bottom a.on {
  color: inherit;
  font-weight: 600;
}

.tabs-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(128, 128, 128, 0.2);
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.tab.on {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.4);
  font-weight: 600;
}

.settings-card textarea {
  width: 100%;
  font-size: 0.85rem;
  resize: vertical;
}

.yt-conn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.6rem 0 1rem;
  flex-wrap: wrap;
}

.conn-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.7rem;
}

.conn-field input {
  padding: 0.5rem 0.6rem;
}

.limit-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.13);
}

.limit-row:last-of-type {
  border-bottom: none;
}

.limit-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-weight: 500;
}

.limit-row input {
  width: 4.5rem;
  text-align: center;
}

/* ---------- Tendencias ---------- */
.trend-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-badge {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: #7c3aed;
}

.trend-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.trend-angle {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: inherit;
  opacity: 0.85;
}

.trend-actions {
  margin-top: auto;
}

.pill-trend-google_news {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.pill-trend-reddit {
  background: rgba(255, 90, 27, 0.14);
  color: #ff5a1b;
}

.pill-trend-wikipedia {
  background: rgba(120, 120, 120, 0.16);
  color: #666;
}

.digest p {
  white-space: pre-wrap;
  font-size: 0.86rem;
  margin: 0.2rem;
}

.pulsing {
  animation: fj-pulse 1.4s ease-in-out infinite;
}

.pill-trend-google_trending {
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.16), rgba(14, 165, 233, 0.16));
  color: #7c3aed;
}

.tiny {
  font-size: 0.75rem;
}


/* ============================================================
   RESPONSIVE (tablet + móvil): sidebar compacto, grids apilados,
   targets táctiles, sin zoom iOS en inputs
   ============================================================ */

/* ---------- Tablet y móvil: barra superior compacta ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.6rem 0.8rem;
    gap: 0.35rem;
    align-items: center;
  }

  .brand {
    margin: 0;
    padding: 0;
  }

  .brand small {
    display: none;
  }

  /* nav como pills en scroll horizontal */
  .sidebar nav {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: calc(100vw - 200px);
    flex: 1;
    min-width: 0;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar nav a {
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 999px;
  }

  .sidebar-bottom {
    margin: 0 0 0 auto !important;
    border-top: none;
    padding: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .sidebar-bottom a {
    padding: 0.45rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
  }

  .theme-toggle {
    margin: 0 !important;
    width: auto;
    padding: 0.45rem 0.6rem;
    background: transparent;
  }

  /* grids apilados */
  .grid-3,
  .cover-sides {
    grid-template-columns: 1fr;
  }

  .export-actions,
  .page-head,
  .actions {
    flex-wrap: wrap;
  }

  .page-head {
    gap: 0.6rem;
  }

  .page-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* targets táctiles */
  button,
  .btn,
  .tab,
  .pill {
    min-height: 40px;
  }

  button.tiny,
  .btn.tiny {
    min-height: 34px;
  }

  .label,
  label {
    font-size: 0.88rem;
  }

  /* indents de detalle reducidos (prompts/escenas) */
  .prompt-detail,
  .scene-detail {
    padding-left: 0.4rem;
  }

  .prompt-row-head,
  .scene-head {
    align-items: center;
  }

  .prompt-preview {
    white-space: normal;
    font-size: 0.82rem;
  }

  .scene-text {
    white-space: normal;
    font-size: 0.82rem;
  }

  .geo-filter {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .geo-filter::-webkit-scrollbar {
    display: none;
  }

  .usage-bar {
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    padding: 0.5rem 0.8rem;
  }

  .step-list .step-head {
    padding: 0.5rem 0.2rem;
  }

  .book-meta {
    flex-wrap: wrap;
  }

  .run-history li {
    flex-wrap: wrap;
  }
}

/* ---------- Móvil angosto ---------- */
@media (max-width: 700px) {
  .sidebar {
    padding: 0.5rem 0.6rem;
  }

  .brand-mark {
    display: none;
  }

  .content {
    padding: 1rem 0.75rem 2.5rem;
  }

  .stats,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-cards {
    grid-template-columns: 1fr;
  }

  /* sin zoom de iOS al enfocar inputs */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  input,
  select,
  textarea,
  .btn,
  button {
    -webkit-appearance: none;
    appearance: none;
  }

  select {
    -webkit-appearance: menulist;
    appearance: menulist;
  }

  .tabs-row {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .tabs-row::-webkit-scrollbar {
    display: none;
  }

  .tab {
    white-space: nowrap;
  }

  .limit-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .limit-row input {
    width: 100%;
    text-align: center;
  }

  .scene-detail {
    flex-direction: column;
    align-items: stretch;
  }

  .scene-detail img {
    width: 100%;
  }

  form .actions,
  .export-actions {
    flex-direction: column;
    align-items: stretch;
  }

  form .actions button,
  .export-actions button,
  .export-actions .btn {
    width: 100%;
    min-height: 46px;
  }

  .fj-chips {
    gap: 0.3rem;
  }

  .fj-chip {
    font-size: 0.7rem;
    padding: 0.18rem 0.5rem 0.18rem 0.4rem;
  }

  .score-badge {
    font-size: 0.95rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1rem;
  }
}

/* ---------- Móvil ultra angosto ---------- */
@media (max-width: 430px) {
  .sidebar nav {
    max-width: calc(100vw - 150px);
  }

  .sidebar nav a {
    font-size: 0.78rem;
    padding: 0.4rem 0.6rem;
  }

  .theme-toggle {
    font-size: 0;
  }

  .theme-toggle::first-letter {
    font-size: 0.85rem;
  }
}


/* ============================================================
   ZONA PÚBLICA (landing ecommerce)
   ============================================================ */

.pub-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pub-page-inner {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.4rem 1rem 3rem;
}

.pub-center {
  text-align: center;
  padding-top: 3rem;
}

.pub-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 0.8rem 1.4rem;
  background: var(--surface, #fff);
  border-bottom: 1px solid rgba(128, 128, 128, 0.18);
  backdrop-filter: blur(10px);
}

.pub-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}

.pub-brand .brand-mark {
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}

.pub-nav {
  display: flex;
  gap: 1.1rem;
  flex: 1;
}

.pub-nav a {
  color: var(--muted, #666);
  text-decoration: none;
  font-size: 0.92rem;
}

.pub-nav a:hover {
  color: var(--text, inherit);
}

.pub-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pub-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.2rem;
  align-items: center;
  max-width: 1080px;
  margin: 0 auto;
  padding: 4.2rem 1rem 3.4rem;
}

.pub-tag {
  display: inline-block;
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pub-hero h1 {
  font-size: 2.5rem;
  line-height: 1.12;
  margin: 0.9rem 0 0.9rem;
}

.pub-hero h1 em {
  font-style: italic;
  background: linear-gradient(90deg, #7c3aed, #0ea5e9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pub-hero p {
  font-size: 1.06rem;
  color: var(--muted, #555);
  line-height: 1.65;
  max-width: 34rem;
}

.pub-hero-cta {
  display: flex;
  gap: 0.7rem;
  margin: 1.3rem 0 1.1rem;
  flex-wrap: wrap;
}

.btn.big {
  font-size: 1rem;
  padding: 0.75rem 1.4rem;
}

.pub-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted, #666);
}

.pub-hero-card {
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 18px;
  padding: 1.2rem 1.4rem;
  background: linear-gradient(160deg, rgba(124, 58, 237, 0.07), rgba(14, 165, 233, 0.07));
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pub-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.pub-metrics strong {
  font-size: 1.7rem;
  display: block;
}

.pub-metrics small {
  color: var(--muted, #777);
}

.pub-services,
.pub-packages,
.pub-how,
.pub-cta {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

.pub-services h2,
.pub-packages h2,
.pub-how h2,
.pub-cta h2 {
  font-size: 1.7rem;
  margin: 0 0 0.4rem;
}

.pub-services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

.pub-service-icon {
  font-size: 1.9rem;
}

.pub-service h3 {
  margin: 0.4rem 0 0.3rem;
}

.pub-service p {
  color: var(--muted, #555);
  margin: 0;
  line-height: 1.55;
}

.pub-packages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

.pub-package {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.pub-package ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.pub-package-hl {
  border: 2px solid rgba(124, 58, 237, 0.5);
  box-shadow: 0 10px 30px -18px rgba(124, 58, 237, 0.5);
}

.pub-badge {
  position: absolute;
  top: -0.75rem;
  right: 0.9rem;
  background: linear-gradient(120deg, #7c3aed, #0ea5e9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.pub-price strong {
  font-size: 1.9rem;
}

.pub-price small {
  color: var(--muted, #888);
}

.pub-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

.pub-step {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.pub-step-n {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(120deg, #7c3aed, #0ea5e9);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.pub-cta {
  text-align: center;
  padding-bottom: 4rem;
}

.pub-cta .btn {
  margin-top: 1rem;
}

.pub-footer {
  border-top: 1px solid rgba(128, 128, 128, 0.16);
  padding: 1.4rem 1rem;
  margin-top: auto;
}

.pub-foot-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.pub-auth-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 1.6rem 1.6rem 2rem;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 16px;
}

.pub-auth-card h1 {
  font-size: 1.4rem;
  margin: 0 0 0.2rem;
}

.pub-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 1rem;
}

.pub-purchases {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.store-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.store-table th {
  text-align: left;
  color: var(--muted, #888);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.store-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.stat-accent strong {
  color: #7c3aed;
}

/* ---------- responsive de la landing ---------- */
@media (max-width: 900px) {
  .pub-hero {
    grid-template-columns: 1fr;
    padding: 2rem 1rem;
    gap: 1.4rem;
  }

  .pub-hero h1 {
    font-size: 1.9rem;
  }

  .pub-services-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pub-packages-grid,
  .pub-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .pub-header {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
  }

  .pub-nav {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
  }

  .pub-nav::-webkit-scrollbar {
    display: none;
  }

  .pub-nav a {
    white-space: nowrap;
  }

  .pub-services-grid,
  .pub-packages-grid,
  .pub-steps {
    grid-template-columns: 1fr;
  }

  .pub-header .btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.7rem;
  }

  .pub-page-inner {
    padding: 1rem 0.8rem 2rem;
  }
}

/* ============================================================
   LANDING V2 — tema oscuro propio (independiente del panel)
   ============================================================ */

.pub-page {
  --pubBg: #090b12;
  --pubSurface: rgba(255, 255, 255, 0.035);
  --pubLine: rgba(255, 255, 255, 0.09);
  --pubText: #f4f5fa;
  --pubMuted: #9aa1b5;
  --pubViolet: #8b5cf6;
  --pubAzure: #38bdf8;
  background:
    radial-gradient(1100px 500px at 82% -12%, rgba(139, 92, 246, 0.16), transparent 62%),
    radial-gradient(900px 480px at 6% 4%, rgba(56, 189, 248, 0.10), transparent 60%),
    var(--pubBg);
  color: var(--pubText);
  color-scheme: dark;
}

/* ---------- header ---------- */
.pub-header {
  background: rgba(9, 11, 18, 0.72);
  border-bottom: 1px solid var(--pubLine);
  backdrop-filter: blur(14px);
}

.pub-nav a,
.pub-actions .pub-ghost {
  color: var(--pubMuted);
}

.pub-nav a:hover { color: var(--pubText); }

.pub-header, .pub-nav a:hover * { color-scheme: dark; }

/* gradiente del logo ya funciona sobre oscuro */

/* ---------- hero ---------- */
.pub-hero { padding-top: 4.6rem; }

.pub-hero h1 {
  font-size: 3.3rem;
  letter-spacing: -0.02em;
  line-height: 1.06;
}

.pub-lede {
  color: var(--pubMuted) !important;
  font-size: 1.12rem !important;
}

.pub-grad {
  background: linear-gradient(92deg, var(--pubViolet) 5%, var(--pubAzure) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pub-tag {
  background: rgba(139, 92, 246, 0.14) !important;
  color: #c4b5fd !important;
  border: 1px solid rgba(139, 92, 246, 0.28);
  box-shadow: 0 0 24px -8px rgba(139, 92, 246, 0.55);
}

.pub-points li { color: var(--pubMuted) !important; }

/* botones */
.pub-cta-btn {
  background: linear-gradient(120deg, #7c3aed, #6366f1 55%, #0ea5e9) !important;
  box-shadow: 0 12px 34px -12px rgba(124, 58, 237, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  border: none;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.pub-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px -14px rgba(124, 58, 237, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.pub-ghost-btn {
  background: var(--pubSurface) !important;
  border: 1px solid var(--pubLine) !important;
  color: var(--pubText) !important;
  backdrop-filter: blur(6px);
}

/* ---------- mock del producto ---------- */
.pub-hero-art { perspective: 1200px; }

.pub-mock {
  border: 1px solid var(--pubLine);
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(165deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  box-shadow: 0 40px 90px -40px rgba(0,0,0,0.8), 0 0 80px -30px rgba(139, 92, 246, 0.35);
  animation: pub-float 7s ease-in-out infinite;
  transform: rotateY(-5deg) rotateX(2deg);
}

@keyframes pub-float {
  0%, 100% { transform: rotateY(-5deg) rotateX(2deg) translateY(0); }
  50% { transform: rotateY(-3deg) rotateX(1deg) translateY(-10px); }
}

.pub-mock-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.045);
  border-bottom: 1px solid var(--pubLine);
}

.pub-mock-bar span {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,0.16);
}
.pub-mock-bar span:first-child { background: #f87171aa; }
.pub-mock-bar span:nth-child(2) { background: #fbbf24aa; }
.pub-mock-bar span:nth-child(3) { background: #34d399aa; }

.pub-mock-bar small {
  margin-left: auto;
  color: var(--pubMuted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.pub-mock-grid {
  padding: 0.9rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0.6rem;
}

.pub-mock-card {
  border: 1px solid var(--pubLine);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  padding: 0.7rem;
  display: flex; flex-direction: column;
}

.mock-thumb {
  aspect-ratio: 16/9;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(124,58,237,0.65), rgba(56,189,248,0.5)),
    radial-gradient(60px 40px at 70% 30%, rgba(255,255,255,0.25), transparent);
  margin-bottom: 0.55rem;
  position: relative;
}

.mock-thumb::after {
  content: "▶";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 1.35rem;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 4px 18px rgba(0,0,0,0.55);
}

.mock-lines {
  display: flex; flex-direction: column; gap: 0.3rem;
}
.mock-lines i {
  height: 7px; border-radius: 4px;
  background: rgba(255,255,255,0.12);
}
.mock-lines i:first-child { width: 88%; }
.mock-lines i:last-child { width: 56%; }

.mock-chip {
  display: inline-block;
  font-size: 0.66rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
  color: #e2e8f0;
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.mock-chip-live {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}

.mock-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mock-row small { color: var(--pubMuted); font-size: 0.68rem; }

.mock-check, .mock-check-2 {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 0.8rem;
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
}

.mock-check-2 {
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
}

.mock-spark {
  display: flex;
  align-items: flex-end;
  gap: 0.22rem;
  height: 44px;
  margin: 0.45rem 0;
}

.mock-spark span {
  flex: 1;
  height: var(--h, 40%);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--pubAzure), rgba(139,92,246,0.35));
  box-shadow: 0 0 14px -4px rgba(56,189,248,0.6);
}

/* ---------- trust strip ---------- */
.pub-trust {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1rem;
  color: var(--pubMuted);
  font-size: 0.8rem;
  border-top: 1px solid var(--pubLine);
  border-bottom: 1px solid var(--pubLine);
  background: rgba(255,255,255,0.015);
  letter-spacing: 0.02em;
}

.trust-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
}

/* ---------- encabezados de sección ---------- */
.pub-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c4b5fd;
  margin-bottom: 0.55rem;
}

.pub-services h2, .pub-packages h2, .pub-how h2, .pub-cta h2, .pub-testimonials h2 {
  font-size: 2.15rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

/* ---------- bento ---------- */
.pub-bento {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1rem;
  margin-top: 1.6rem;
}

.pub-bento-card {
  border: 1px solid var(--pubLine);
  border-radius: 18px;
  background: var(--pubSurface);
  backdrop-filter: blur(8px);
  padding: 1.5rem;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.pub-bento-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(255,255,255,0.055);
}

.bento-big { grid-row: span 2; display: flex; flex-direction: column; }

.bento-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--pubMuted);
  padding-top: 1rem;
  border-top: 1px dashed var(--pubLine);
}

.pub-bento-card h3 { margin: 0.7rem 0 0.45rem; font-size: 1.15rem; }
.pub-bento-card p { color: var(--pubMuted); line-height: 1.6; margin: 0; }

/* ---------- paquetes ---------- */
.pub-package {
  background: var(--pubSurface) !important;
  border: 1px solid var(--pubLine) !important;
  border-radius: 18px !important;
  backdrop-filter: blur(8px);
}

.pub-package-hl {
  border-color: rgba(139, 92, 246, 0.55) !important;
  box-shadow: 0 20px 60px -25px rgba(139, 92, 246, 0.5) !important;
}

.pub-package-hl h3 { color: #c4b5fd; }

.pub-packages-note { margin-top: 1.1rem; }

/* ---------- testimonios ---------- */
.pub-quotes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

.pub-quote {
  background: var(--pubSurface) !important;
  border: 1px solid var(--pubLine) !important;
  border-radius: 16px;
  backdrop-filter: blur(8px);
  position: relative;
  padding-top: 1.7rem !important;
}

.pub-quote-mark {
  position: absolute;
  top: 0.55rem;
  left: 0.85rem;
  font-size: 2.2rem;
  line-height: 1;
  background: linear-gradient(92deg, var(--pubViolet), var(--pubAzure));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: Georgia, serif;
}

.pub-quote p { line-height: 1.6; margin: 0 0 0.7rem; font-size: 0.95rem; }

.pub-quote small { color: var(--pubMuted) !important; }

/* ---------- CTA panel ---------- */
.pub-cta-panel {
  border: 1px solid var(--pubLine);
  border-radius: 24px;
  padding: 3rem 2rem;
  text-align: center;
  background:
    radial-gradient(700px 260px at 50% -40%, rgba(139,92,246,0.35), transparent 70%),
    rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.pub-cta-panel p { color: var(--pubMuted); margin: 0.55rem 0 1.2rem; }

/* ---------- auth + footer oscuro ---------- */
.pub-auth-card {
  background: var(--pubSurface) !important;
  border: 1px solid var(--pubLine) !important;
  backdrop-filter: blur(10px);
}

.pub-form input {
  background: rgba(255,255,255,0.045) !important;
  border: 1px solid var(--pubLine) !important;
  color: var(--pubText) !important;
}

.pub-form input::placeholder { color: #6b728088; }

.pub-form input:focus {
  border-color: rgba(139,92,246,0.55) !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.pub-footer {
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--pubLine) !important;
}

/* ---------- responsive landing v2 ---------- */
@media (max-width: 900px) {
  .pub-hero h1 { font-size: 2.35rem; }
  .pub-bento { grid-template-columns: 1fr; }
  .bento-big { grid-row: auto; }
  .pub-quotes { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .pub-hero { padding-top: 2.2rem; }
  .pub-hero h1 { font-size: 1.95rem; }
  .pub-header { background: rgba(9, 11, 18, 0.88); }
  .pub-mock { transform: none; animation: none; }
}

/* ---------- logo real ---------- */
.pub-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-logo {
  height: 30px;
  width: auto;
  margin-bottom: 0.8rem;
}

/* ---------- carrusel de testimonios ---------- */
.pub-carousel {
  margin-top: 1.4rem;
  border: 1px solid var(--pubLine);
  border-radius: 20px;
  background: var(--pubSurface);
  backdrop-filter: blur(8px);
  overflow: hidden;
  position: relative;
}

.pub-carousel-track {
  display: flex;
  transition: transform 0.65s cubic-bezier(0.65, 0, 0.35, 1);
}

.pub-quote-slide {
  min-width: 100%;
  border: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 1.9rem 5.5rem !important;
  animation: quote-in 0.7s ease both;
}

@keyframes quote-in {
  from { opacity: 0.25; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

.pub-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 0 1.05rem;
}

.pub-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  min-height: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: all 0.3s ease;
}

.pub-dot.on {
  width: 26px;
  border-radius: 999px;
  background: linear-gradient(92deg, var(--pubViolet), var(--pubAzure));
  box-shadow: 0 0 12px -3px rgba(139, 92, 246, 0.8);
}

@media (max-width: 900px) {
  .pub-quote-slide {
    padding: 1.6rem 1.4rem !important;
  }
}

/* ---------- marquee de testimonios (película continua) ---------- */
.pub-marquee {
  margin-top: 1.5rem;
  position: relative;
  overflow: hidden;
  padding: 0.4rem 0;
  /* máscara lateral: tarjetas que nacen/mueren al borde se desvanecen */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}

.pub-marquee-fade {
  display: none; /* la máscara CSS ya hace el desvanecido */
}

.pub-marquee-track {
  display: flex;
  gap: 1rem;
  width: max-content;
  animation: pub-marquee-move 46s linear infinite;
  padding: 0.2rem 0;
}

.pub-marquee:hover .pub-marquee-track {
  animation-play-state: paused;
}

@keyframes pub-marquee-move {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.pub-marquee-card {
  width: 350px !important;
  min-width: 350px;
  display: flex;
  flex-direction: column;
  height: 190px;
  position: relative;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.pub-marquee-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.5) !important;
}

.pub-marquee-card p {
  line-height: 1.55;
  margin: 0 0 0.65rem;
  font-size: 0.93rem;
}

.pub-marquee-card small {
  margin-top: auto;
}

@media (max-width: 700px) {
  .pub-marquee-track {
    animation-duration: 32s;
  }

  .pub-marquee-card {
    width: 270px !important;
    min-width: 270px;
    height: 210px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pub-marquee-track {
    animation: none;
  }

  .pub-marquee {
    overflow-x: auto;
    mask-image: none;
    -webkit-mask-image: none;
  }
}

/* botón primary con la marca completa (violeta→azul) */
.btn.primary {
  background: linear-gradient(120deg, #7c3aed, #6366f1 55%, #0ea5e9) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 26px -14px rgba(124, 58, 237, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: none;
}

.btn.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 32px -14px rgba(124, 58, 237, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.pub-nocuenta {
  text-align: center;
  border-top: 1px solid var(--pubLine, rgba(128,128,128,0.15));
  padding-top: 0.85rem;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pub-nocuenta p {
  margin: 0;
  color: var(--pubMuted, #666);
  font-size: 0.88rem;
}

.pub-nocuenta a {
  color: #a78bfa;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.pub-nocuenta a:hover {
  text-decoration: underline;
}

/* ---------- funnel de registro ---------- */
.pub-funnel h1 {
  font-size: 1.3rem;
  margin-bottom: 0.2rem;
}

.funnel-progress {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.funnel-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.funnel-step.done, .funnel-step.current {
  opacity: 1;
}

.funnel-n {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--pubLine, rgba(128,128,128,0.2));
  font-size: 0.95rem;
}

.funnel-step.current .funnel-n {
  background: linear-gradient(120deg, #7c3aed, #0ea5e9);
  border: none;
  box-shadow: 0 0 18px -4px rgba(124,58,237,0.7);
}

.funnel-step.done .funnel-n {
  background: rgba(52,211,153,0.14);
  border-color: rgba(52,211,153,0.4);
}

.funnel-step small {
  font-size: 0.68rem;
  color: var(--pubMuted, #999);
}

.funnel-packages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 1rem 0 0.4rem;
}

.funnel-pkg {
  text-align: left;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--pubLine, rgba(128,128,128,0.25));
  background: rgba(255,255,255,0.03);
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all 0.2s ease;
}

.funnel-pkg:hover {
  border-color: rgba(139,92,246,0.5);
  transform: translateY(-2px);
}

.funnel-pkg.on {
  border-color: rgba(139,92,246,0.7) !important;
  background: rgba(139,92,246,0.10);
  box-shadow: 0 0 20px -8px rgba(139,92,246,0.6);
}

.funnel-chosen {
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  background: rgba(139,92,246,0.10);
  border: 1px solid rgba(139,92,246,0.35);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.funnel-chosen-soft {
  background: rgba(255,255,255,0.04);
  border-color: var(--pubLine, rgba(128,128,128,0.2));
}

.funnel-thanks {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1rem;
}

.funnel-due {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(52,211,153,0.45);
  background: rgba(52,211,153,0.07);
}

.funnel-due span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6ee7b7;
}

/* cerrar sesión en el grupo inferior */
.sidebar-logout {
  padding: 0.3rem 0.2rem;
  background: transparent;
  border: none;
  color: rgba(239, 68, 68, 0.75);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
}

.sidebar-logout:hover {
  color: #ef4444;
}

/* logo blanco en tema oscuro: un poco más pequeño (wordmark es más ancho) */
.brand-logo-dark {
  height: 24px;
}

/* ---------- Agentes WhatsApp ---------- */
.wa-chat {
  display: flex;
  flex-direction: column;
  height: 520px;
  padding: 0;
  overflow: hidden;
}

.wa-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: rgba(127, 127, 127, 0.04);
}

.wa-bubble {
  max-width: 78%;
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.wa-user {
  align-self: flex-end;
  background: linear-gradient(120deg, #7c3aed, #6366f1);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.wa-agent {
  align-self: flex-start;
  background: var(--surface-2, rgba(127,127,127,0.12));
  border: 1px solid rgba(127,127,127,0.15);
  border-bottom-left-radius: 4px;
  white-space: pre-wrap;
}

.wa-actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.wa-actions .pill {
  font-size: 0.65rem;
}

.wa-input {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid rgba(127,127,127,0.15);
}

.wa-input input {
  flex: 1;
}

.wa-form-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr auto;
  gap: 0.5rem;
  margin: 0.4rem 0 0.8rem;
}

.wa-form-row select {
  padding: 0.55rem;
}

.wa-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.wa-list li {
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(127,127,127,0.12);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wa-list li:last-child { border-bottom: none; }

.wa-list li p {
  flex: 1;
}

.wa-log-out {
  background: rgba(124,58,237,0.045);
  border-left: 3px solid rgba(139,92,246,0.5);
  padding-left: 0.5rem;
}

.page-audiolibro .audiobook-progress {
  margin: 0.8rem 0;
}

/* memoria de marca */
.memoria-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.memoria-form input {
  padding: 0.5rem 0.6rem;
}

.memoria-toggle {
  margin-top: 0.25rem;
}

.memoria-mini {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 1px dashed rgba(139, 92, 246, 0.4);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.05);
  margin-top: 0.3rem;
}

.memoria-mini-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.4rem;
  align-items: center;
}

.memoria-mini-row select {
  padding: 0.4rem;
}


/* ==================== MÓVIL (panel interno responsive) ==================== */
@media (max-width: 900px) {
  /* el sidebar se vuelve barra superior con chips horizontales */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 30;
    height: auto; max-height: none; overflow: visible;
    flex-direction: column; gap: 0.45rem;
    padding: 0.7rem 0.7rem 0.55rem;
    border-right: none; border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
  }
  .sidebar .brand { display: flex; align-items: center; gap: .5rem; }
  .sidebar .brand-logo { height: 30px !important; width: auto !important; }
  .sidebar nav { display: flex; overflow-x: auto; gap: 0.35rem; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { white-space: nowrap; padding: 0.42rem 0.75rem; font-size: 0.88rem; flex: 0 0 auto; }
  .sidebar-bottom { display: flex; flex-direction: row; overflow-x: auto; gap: 0.35rem; padding-top: 0.15rem; }
  .sidebar-bottom::-webkit-scrollbar { display: none; }
  .sidebar-bottom a, .sidebar-bottom button { white-space: nowrap; flex: 0 0 auto; font-size: 0.82rem; padding: 0.35rem 0.6rem; }
  .theme-toggle { font-size: 0.72rem; }

  .main-col { min-height: auto; }
  .content { padding: 1rem 0.8rem 3rem; }

  /* cabeceras: apilar y que botones quepan */
  .page-head { flex-direction: column; align-items: stretch; gap: 0.7rem; margin-bottom: 1rem; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head .btn { align-self: flex-start; }

  /* métricas apiladas 2x2 */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .stat-box { padding: 0.7rem 0.8rem; }
  .stat-box strong { font-size: 1.15rem; }

  /* tarjetas y tablas: scroll horizontal interno en vez de romper el layout */
  .card { padding: 0.9rem 0.85rem; overflow-x: auto; }
  .store-table { min-width: 620px; }

  /* formularios apilados */
  .grid-2 { grid-template-columns: 1fr; }
  .pub-form { gap: 0.7rem; }
  .pub-page-inner { padding: 1rem 0.8rem !important; }

  /* modales a ancho completo útil */
  .card[style*="max-width"] { max-width: 100% !important; }

  /* breadcrumb compacto */
  .breadcrumb { font-size: 0.8rem; overflow-x: auto; }
}


/* ---------- espacio de trabajo: páginas internas en móvil ---------- */
@media (max-width: 900px) {
  /* layouts de 2 columnas -> apilados */
  .chapter-layout, .run-layout, .video-grid { grid-template-columns: 1fr; gap: 0.9rem; }
  .grid-3 { grid-template-columns: 1fr; }
  /* tarjetas de libros/videos más compactas */
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
  /* detalle de escena/prompt sin sangría de escritorio */
  .prompt-detail, .scene-detail { padding-left: 0.4rem; }
  .scene-detail { gap: 0.5rem; }
  /* editor cómodo para dedos */
  .editor textarea { padding: 1rem 0.9rem; font-size: 1rem; max-width: 100%; }
  .editor-bar { flex-wrap: wrap; gap: 0.4rem; }
  .editor-bar .btn { font-size: 0.82rem; padding: 0.4rem 0.6rem; }
  /* barras de pasos/encabezados internos que puedan desbordar */
  .run-detail, .chapter-layout > div { min-width: 0; }
  .wa-panel, .wa-list { width: 100%; }
  .funnel-packages, .pub-packages-grid { grid-template-columns: 1fr !important; display: grid; }
}


/* ---------- candado anti-desborde (viewport del celular se expandia a 946px) ---------- */
@media (max-width: 900px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  .shell { grid-template-columns: minmax(0, 1fr) !important; }
  .sidebar, .nav, .sidebar nav, .sidebar-bottom, .main-col, .content, .page,
  .chapter-layout > *, .run-layout > *, .video-grid > *, .editor textarea {
    min-width: 0 !important; max-width: 100vw;
  }
  .sidebar nav { flex-wrap: wrap; white-space: normal; }
  .sidebar nav a { flex: 1 0 auto; white-space: normal; }
  .sidebar-bottom { flex-wrap: wrap; justify-content: flex-start; }
  .sidebar-bottom a, .sidebar-bottom button { white-space: normal; flex: 1 0 auto; max-width: 100%; }
  .page-head .btn { max-width: 100%; }
  .btn { overflow: hidden; text-overflow: ellipsis; }
}


/* ---------- menú lateral escondible (drawer + hamburguesa) en móvil ---------- */
.menu-hamburger, .mobile-bar, .menu-backdrop { display: none; }

@media (max-width: 900px) {
  /* la barra superior compacta con la hamburguesa */
  .mobile-bar {
    display: flex; align-items: center; gap: 0.6rem;
    position: sticky; top: 0; z-index: 40;
    background: var(--surface, #14161d);
    border-bottom: 1px solid var(--line, rgba(128,128,128,.2));
    padding: 0.5rem 0.7rem;
  }
  .menu-hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.25rem; line-height: 1;
    background: none; border: 1px solid var(--line, rgba(128,128,128,.3));
    border-radius: 8px; color: var(--text, #fff);
    padding: 0.3rem 0.55rem; cursor: pointer;
  }
  .mobile-bar-title { font-weight: 700; letter-spacing: 0.02em; }

  /* el sidebar sale DESPUÉS del main-col en el DOM: lo fijamos fuera de pantalla */
  .menu-backdrop.show {
    display: block; position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55); z-index: 55;
  }

  .sidebar {
    position: fixed !important;
    top: 0; bottom: 0; left: 0;
    width: 272px; max-width: 84vw;
    height: 100vh;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    z-index: 60;
    flex-direction: column;
    padding: 1rem 0.9rem;
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 44px rgba(0, 0, 0, 0.45); }

  /* de regreso al estilo vertical (menú "igual que en escritorio") */
  .sidebar nav, .sidebar-bottom {
    flex-direction: column; flex-wrap: nowrap;
    display: flex; overflow-x: visible; gap: 0.35rem;
  }
  .sidebar nav a, .sidebar-bottom a, .sidebar-bottom button {
    white-space: normal; flex: 0 0 auto;
    font-size: 0.92rem; padding: 0.55rem 0.7rem;
    display: block; text-align: left;
  }
  /* neutralizar overrides viejos del bloque responsivo anterior */
  .sidebar-bottom { margin: auto 0 0 0 !important; }
  .sidebar .brand { margin-bottom: 0.6rem; }
}
