/* ==========================================================================
   Edit — hoja de estulos única
   Papel blanco, tinta negra, filetes de 1px y un solo acento (lima) usado
   como resaltador. Sin degradados de color, sin vidrio esmerilado, sin focos.

   1. Tokens
   2. Base y tipografía
   3. Componentes
   4. Landing
   5. Editor (sidebar, vistas, resultado)
   6. Administración
   7. Responsive
   ========================================================================== */

/* ------------------------------------------------------------ 1. tokens */
:root {
  --paper: #ffffff;
  --paper-soft: #f7f7f4;
  --paper-inset: #efefea;
  --ink: #101113;
  --ink-2: #3c3e42;
  --muted: #5d6064;
  --faint: #66696e;
  --rule: #e5e5df;
  --rule-2: #c9c9c1;
  --lime: #c8ff47;
  --red: #bf2c18;
  --green: #14663a;

  --sidebar: 254px;
  --radius: 5px;
  --wrap: 1180px;

  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif: "New York", Georgia, "Times New Roman", serif;
}

/* -------------------------------------------------- 2. base y tipografía */
* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

h1 em, h2 em {
  font-style: normal;
  background-image: linear-gradient(var(--lime), var(--lime));
  background-repeat: no-repeat;
  background-size: 100% 0.32em;
  background-position: 0 88%;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img, video { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 56px);
}

.kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 16px;
}

.kicker::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--ink);
  vertical-align: middle;
  margin-right: 10px;
}

.num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.lead {
  font-size: clamp(16px, 1.6vw, 18.5px);
  line-height: 1.55;
  color: var(--ink-2);
}

.section-lead {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 46ch;
}

code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--paper-inset);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 5px;
}

kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--paper-inset);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3px 7px;
}

.mono-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 4px 9px;
  white-space: nowrap;
}

/* -------------------------------------------------------- 3. componentes */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.045em;
}


.brand-mark {
  width: 25px;
  height: 25px;
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 5px 4px;
  background: var(--lime);
  border: 1px solid var(--ink);
  border-radius: 4px;
}

.brand-mark i {
  display: block;
  width: 3px;
  background: var(--ink);
  border-radius: 1px;
}

.brand-mark i:nth-child(1) { height: 6px; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 9px; }

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 19px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.primary-button:hover { background: #000; transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }

.primary-button:disabled,
.primary-button[disabled] {
  background: var(--paper-inset);
  border-color: var(--rule-2);
  color: var(--faint);
  cursor: not-allowed;
  transform: none;
}

.secondary-button {
  background: var(--paper);
  border-color: var(--rule-2);
  color: var(--ink);
}

.secondary-button:hover { border-color: var(--ink); background: var(--paper-soft); }

.primary-button.large,
.secondary-button.large { padding: 15px 26px; font-size: 15px; }

.primary-button.full { width: 100%; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.link-button:hover { text-decoration-color: var(--lime); text-decoration-thickness: 3px; }

.icon-button {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.icon-button:hover { border-color: var(--ink); }

.small-button {
  padding: 7px 14px;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.small-button:hover { border-color: var(--ink); }

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--paper);
}

.system-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  border: 1px solid transparent;
}

/* Invitación a pagar dentro de la pastilla de estado (usuarios del plan gratis). */
.pill-upgrade {
  margin-left: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.pill-upgrade:hover { filter: brightness(1.05); text-decoration: none; }
.pill-upgrade b { margin-left: 2px; }

/* Consentimiento de términos y cookies. */
.consent-row { margin: 18px 0 4px; align-items: flex-start; }
.consent-row span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.consent-row a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
#consentHint { display: block; margin-top: 8px; color: #b3401f; }

/* Accesibilidad: foco visible en todo control interactivo. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 2px;
}
.consent-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--ink);
  flex: none;
  cursor: pointer;
}

/* Contraste: textos apagados subidos a AA sobre papel blanco. */
:root { --muted: #55585c; --faint: #5d6064; }

.cookie-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  z-index: 60;
  width: min(680px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(16, 17, 19, 0.16);
}
.cookie-banner p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.cookie-banner a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.cookie-actions { display: flex; gap: 10px; justify-content: flex-end; }
.cookie-actions .primary-button,
.cookie-actions .secondary-button { padding: 8px 16px; font-size: 13px; }

.system-status span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44ch;
}

.system-status.ready i { background: var(--lime); border-color: var(--ink); }
.system-status.missing i { background: var(--red); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
  border: 1px solid transparent;
}

.status-dot.connected { background: var(--lime); border-color: var(--ink); }

.chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  padding: 5px 10px;
}

.chip.ok { background: var(--lime); border-color: var(--ink); color: var(--ink); }

.privacy-note {
  display: block;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.field {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.field input,
.field select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}

.field input:focus,
.field select:focus { border-color: var(--ink); outline: none; }
.field input::placeholder { color: var(--faint); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
}

.card-title h3 { font-size: 14.5px; letter-spacing: -0.02em; }
.card-title p { margin-top: 4px; font-size: 12px; color: var(--muted); }

.card-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--faint);
  margin-bottom: 7px;
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr);
  gap: 36px;
  align-items: end;
  padding-bottom: 24px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--ink);
}

.section-head h2 { font-size: clamp(28px, 3.4vw, 44px); }
.section-head .section-lead { justify-self: end; text-align: right; }
.section-head .plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-self: end;
}

.next-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.next-row p {
  font-size: 13.5px;
  color: var(--muted);
  max-width: 62ch;
}

.next-row .num {
  display: inline-block;
  background: var(--lime);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 2px 7px;
  margin-right: 10px;
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  max-width: min(560px, 88vw);
  padding: 13px 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* utilidad: JS alterna esta clase en tarjetas, vistas y previsualizaciones */
.hidden { display: none !important; }

/* ------------------------------------------------------------- 4. landing */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.head-nav { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 32px); }

.head-nav a:not(.primary-button) {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}

.head-nav a:not(.primary-button):hover { text-decoration: underline; text-underline-offset: 4px; }
.head-nav .head-admin { color: var(--muted); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.62fr);
  gap: clamp(30px, 5vw, 64px);
  padding-top: clamp(56px, 9vw, 110px);
  padding-bottom: clamp(50px, 7vw, 84px);
}

.hero-main h1 {
  font-size: clamp(40px, 6.4vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin-bottom: 26px;
}

.hero .lead { max-width: 56ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  list-style: none;
  margin-top: 36px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.hero-notes li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  background: var(--lime);
  border: 1px solid var(--ink);
}

.hero-spec {
  align-self: start;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 22px 22px 20px;
  background: var(--paper-soft);
}

.hero-spec dl { margin: 0; }

.hero-spec dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--rule);
}

.hero-spec dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hero-spec dd { margin: 0; font-size: 13px; font-weight: 600; text-align: right; }
.spec-note { margin-top: 16px; font-size: 12px; line-height: 1.55; color: var(--muted); }

.section { padding-top: clamp(58px, 8vw, 110px); }

.process-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  border-top: 1px solid var(--ink);
}

.process-list li { padding: 22px 26px 10px; border-left: 1px solid var(--rule); }
.process-list li:first-child { border-left: 0; padding-left: 0; }
.process-list .num { display: block; color: var(--ink); margin-bottom: 14px; }
.process-list h3 { font-size: 17px; margin-bottom: 8px; }
.process-list p { font-size: 13.5px; line-height: 1.55; color: var(--muted); }

.caps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(28px, 5vw, 64px);
}

.caps-grid article {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 6px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}

.caps-grid .num { padding-top: 4px; }
.caps-grid h3 { font-size: 17px; margin-bottom: 7px; }
.caps-grid p { font-size: 13.5px; line-height: 1.6; color: var(--muted); }

.pull { padding-top: clamp(58px, 8vw, 110px); }

.pull blockquote {
  margin: 0;
  padding: clamp(36px, 6vw, 78px) 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-align: center;
}

.pull blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(30px, 5vw, 62px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.pull cite {
  display: block;
  margin-top: 20px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 22px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
}

.price-card.featured { border-color: var(--ink); box-shadow: 0 10px 30px rgba(16, 17, 19, 0.06); }
.price-card > p { font-size: 13px; color: var(--muted); }

.price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 2px;
  color: var(--ink);
}

.price strong { font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.03em; line-height: 1; }
.price span { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.price-limits { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--rule); }
.price-card .secondary-button,
.price-card .primary-button { width: 100%; justify-content: center; }
/* Suscripciones apagadas: el botón se ve pero no se puede pulsar. */
.price-card .secondary-button:disabled,
.price-card .secondary-button[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* --------------------------------------- hueco publicitario del sidebar */
.sidebar-ad {
  margin: 14px 0 4px;
  padding: 10px;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  background: var(--paper);
  max-width: 100%;
  overflow: hidden;
}
.sidebar-ad .ad-tag {
  display: inline-block;
  margin-bottom: 8px;
}
/* El formato "auto" de AdSense intenta crecer sin límite: la caja manda.
   Cuadrada (250×250, estándar de AdSense) para que quepa en el sidebar. */
.sidebar-ad #sidebarAdBox {
  width: 100%;
  height: 250px;
  overflow: hidden;
}
.sidebar-ad #sidebarAdBox .adsbygoogle {
  width: 100%;
  height: 100%;
  max-height: 250px;
}

/* Estadísticas de costes en /admin */
.stats-totals { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0 16px; }
.stats-totals .stat {
  display: grid;
  gap: 2px;
}
.stats-totals .stat b { font-size: 18px; }
.stats-totals .stat small { color: var(--muted); font-size: 12px; }
.stats-table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stats-table th, .stats-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.stats-table th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.06em; }
.stats-table td:last-child { font-weight: 700; }
.stats-table .neg { color: #b3261e; }
.stats-table .pos { color: #2e6b1f; }

/* Borradores: proyectos a medias recuperables desde el Paso 01 */
.drafts { margin-top: 14px; }
.drafts-title {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.drafts-list { display: grid; gap: 8px; }
.draft-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-soft);
  cursor: pointer;
}
.draft-item:hover { border-color: var(--rule-2); }
.draft-item strong { font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.draft-item small { color: var(--muted); font-size: 12px; }
.draft-state {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-inset);
  color: var(--ink-2);
  flex: none;
}

/* --------------------------------------------------- ajustes de la cuenta */
.settings-dialog {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 0;
  width: min(840px, calc(100vw - 32px));
  max-height: min(88vh, 820px);
  overflow: auto;
  color: var(--ink);
}
.settings-dialog[open] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
/* Identidad dentro de Ajustes */
.settings-account { display: flex; align-items: center; gap: 14px; }
.settings-avatar { width: 44px; height: 44px; font-size: 18px; flex: none; }
.settings-account-copy { display: grid; gap: 2px; min-width: 0; }
.settings-account-copy strong { font-size: 15px; }
.settings-account-copy small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.settings-provider { text-transform: capitalize; }
.settings-provider::before { content: "Entra con "; }
.settings-provider:empty { display: none; }
.settings-provider:empty::before { content: none; }
/* Chip del plan */
.plan-chip {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--paper);
}
.plan-chip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan-chip-head strong { font-size: 15px; }
.plan-chip-price { font-family: var(--mono, monospace); font-size: 12.5px; color: var(--muted); }
.plan-chip-meta { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.usage-meter { margin-top: 12px; display: grid; gap: 6px; }
.usage-meter-bar { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.usage-meter-bar i { display: block; height: 100%; background: var(--lime, #b8e600); border-radius: 3px; transition: width 0.3s ease; }
.usage-meter small { font-size: 12px; color: var(--muted); }
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--rule);
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
}
.settings-head h3 { margin: 0; font-size: 18px; }
.settings-section { padding: 16px 22px; border-bottom: 1px solid var(--rule); }
.settings-section:last-child { border-bottom: 0; }
.settings-account, .settings-dialog > .settings-section:nth-of-type(2) { grid-column: 1 / -1; }
.settings-projects-section { grid-column: 1 / -1; }
.settings-section { background: var(--paper); }
.settings-privacy-section, .settings-data-section { align-self: stretch; }
.settings-meter-label { font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.storage-usage-meter .usage-meter-bar i { background: #55ae68; }
.credits-usage-meter .usage-meter-bar i { background: #5b6ee1; }
.settings-section h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.settings-text { margin: 0 0 10px; font-size: 14px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.settings-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.danger-button {
  border: 1px solid #b3261e;
  color: #b3261e;
  background: transparent;
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.danger-button:hover { background: #b3261e; color: #fff; }
.danger-button:disabled { opacity: .45; cursor: not-allowed; }
.project-storage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.project-storage-heading h4 { margin-bottom: 0; }
.project-storage-heading .settings-hint { max-width: 58ch; }
.project-storage-list { display: grid; gap: 7px; }
.project-storage-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.project-storage-info { display: grid; gap: 3px; min-width: 0; }
.project-storage-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.project-storage-info small { color: var(--muted); font-size: 11px; }
.project-storage-row .danger-button { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }

.pricing-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-top: clamp(60px, 8vw, 110px);
  padding-top: 32px;
  padding-bottom: 60px;
  border-top: 1px solid var(--rule);
}

.foot-brand p { margin-top: 14px; font-size: 12.5px; color: var(--muted); max-width: 46ch; }
.foot-nav { display: grid; gap: 9px; text-align: right; }
.foot-nav a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.foot-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --------------------------------------------------------- 5. el editor */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 20px 20px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
}

.steps {
  display: grid;
  margin-top: 38px;
  border-top: 1px solid var(--rule);
}

.step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  padding: 13px 8px 13px 6px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-left: 2px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.step b {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
  padding-top: 3px;
}

.step > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.step small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 400; color: var(--faint); }

.step:hover { background: var(--paper-soft); }

.step.active {
  background: var(--paper-soft);
  border-left-color: var(--lime);
}

.step.active b { color: var(--ink); }
.step.active > span { color: var(--ink); }

.sidebar-bottom { margin-top: auto; display: grid; gap: 14px; }

.principle {
  display: flex;
  gap: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
}

.principle i {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 7px;
  background: var(--lime);
  border: 1px solid var(--ink);
}

.key-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.key-button:hover { border-color: var(--ink); }
.key-label small { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); }
.key-button b { color: var(--faint); }

main {
  min-width: 0;
  max-width: 1300px;
  margin-inline: auto;
  padding: 0 clamp(20px, 3.2vw, 46px) 90px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 20px 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.topbar h1 {
  margin-top: 8px;
  font-size: clamp(17px, 1.8vw, 21px);
  letter-spacing: -0.03em;
}

.view { display: none; padding-top: 30px; }
.view.active { display: block; }

.material-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.72fr);
  gap: 22px;
  align-items: start;
}

.upload-stack { display: grid; }

.upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 330px;
  padding: 42px 26px;
  text-align: center;
  background: var(--paper-soft);
  border: 1px dashed var(--rule-2);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.upload-card:hover { border-color: var(--ink); background: var(--paper); }

.upload-card.dragging {
  border-style: solid;
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.upload-arrow {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 23px;
  line-height: 1;
}

.upload-card h3 { font-size: clamp(19px, 2.1vw, 25px); letter-spacing: -0.03em; }
.upload-card p { font-size: 13.5px; color: var(--muted); }
.upload-card small { font-family: var(--mono); font-size: 11px; color: var(--faint); }

.uploaded-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
  overflow: hidden;
}

.file-preview { position: relative; background: var(--ink); }
.file-preview video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; }

.file-duration {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 3px 8px;
  border-radius: 3px;
  background: rgba(16, 17, 19, 0.85);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-top: 1px solid var(--rule);
}

.file-icon {
  padding: 4px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.file-name strong { display: block; font-size: 14px; letter-spacing: -0.01em; }
.file-name small { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.file-meta .icon-button { margin-left: auto; }

.setup-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
  padding: 0 18px 18px;
}

.card-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 18px 0 15px;
  border-bottom: 1px solid var(--ink);
}

.card-heading .num { padding-top: 4px; font-size: 12px; color: var(--ink); }
.card-heading h3 { font-size: 15.5px; }
.card-heading p { margin-top: 4px; font-size: 12px; color: var(--muted); }

.option-block { padding: 16px 0; border-bottom: 1px solid var(--rule); }

.option-block > label,
.option-block > .field {
  display: block;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--paper-inset);
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.segmented button {
  flex: 1 1 auto;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.segmented button:hover { color: var(--ink); }

.segmented button.active {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
}

.resource-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resource-copy { flex: 1; }
.resource-copy strong { display: block; font-size: 13.5px; }
.resource-copy small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }

.asset-list { display: grid; gap: 6px; padding-top: 12px; }
.asset-list:empty { display: none; }

.asset-row {
  padding: 8px 10px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------- progreso */
.progress-wrap {
  max-width: 780px;
  margin: clamp(40px, 8vw, 84px) auto 0;
  text-align: center;
}

.progress-wrap .kicker::before { display: none; }
.progress-wrap h2 { font-size: clamp(32px, 5vw, 56px); letter-spacing: -0.04em; }

.progress-lead {
  margin-top: 16px;
  font-size: 15px;
  color: var(--muted);
}

.progress-track {
  position: relative;
  height: 15px;
  margin-top: 42px;
  border: 1px solid var(--ink);
  background: var(--paper);
  background-image: repeating-linear-gradient(90deg, transparent 0 39px, var(--rule) 39px 40px);
  overflow: hidden;
}

.progress-track i {
  position: relative;
  display: block;
  width: 10%;
  height: 100%;
  background: var(--lime);
  border-right: 1px solid var(--ink);
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.progress-track i::after {
  position: absolute;
  inset: 0 auto 0 -45%;
  width: 45%;
  content: "";
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 55%), transparent);
  animation: progress-sheen 1.8s ease-in-out infinite;
}

@keyframes progress-sheen {
  to { transform: translateX(330%); }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track i::after { animation: none; }
}

.pipeline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pipeline span { color: var(--faint); padding-bottom: 4px; border-bottom: 2px solid transparent; }
.pipeline span.done { color: var(--ink); border-bottom-color: var(--lime); }
.pipeline span.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.pipeline b { color: var(--faint); }

.progress-note {
  margin-top: 50px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------ resultado */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
  overflow: hidden;
}

.metrics > div {
  padding: 15px 17px;
  box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule);
}

.metrics small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.metrics strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(20px, 2.4vw, 27px);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.78fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.timeline-card,
.analysis-card,
.thumb-section,
.admin-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 7px;
}

.output-wrap { padding: 18px 18px 0; }

.output-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-radius: 5px;
}

.timeline {
  display: flex;
  gap: 3px;
  padding: 16px 18px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.clip {
  flex: 0 1 auto;
  flex-basis: 0;
  min-width: 88px;
  padding: 9px 8px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}

.clip strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip small {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 15px 18px 17px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.timeline-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border: 1px solid var(--rule-2);
  vertical-align: -1px;
}

.legend-main { background: var(--ink); border-color: var(--ink) !important; }
.legend-caption { background: var(--lime); border-color: var(--ink) !important; }
.legend-overlay { background: var(--paper-inset); }

.analysis-content { padding: 14px 18px 4px; }

.analysis-content strong {
  display: block;
  margin-top: 15px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.analysis-content strong:first-child { margin-top: 0; }

.analysis-content p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}

.qc-box {
  display: flex;
  gap: 12px;
  margin: 14px 18px 18px;
  padding: 14px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 5px;
}

.qc-box > span {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  font-size: 11.5px;
}

.qc-box strong { font-size: 13px; }
.qc-box p { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

.qc-warning {
  display: block;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-2);
}

.credits-box {
  margin: 0 18px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.credits-box > strong {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.credits-box p {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
}

.credits-box p span {
  flex: none;
  padding: 2px 5px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--muted);
}

.thumb-section { margin-top: 22px; }
.thumb-section .row-actions { margin-bottom: 0; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  padding: 18px;
}

.thumb-card {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}

.thumb-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--paper-inset);
}

.thumb-grid.is-vertical {
  grid-template-columns: repeat(auto-fit, minmax(150px, 230px));
  align-items: start;
}

.thumb-grid.is-vertical .thumb-card img { aspect-ratio: 9 / 16; }
.thumb-grid.is-square .thumb-card img { aspect-ratio: 1 / 1; }

.thumb-card figcaption {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-top: 1px solid var(--rule);
}

.thumb-card figcaption strong { display: block; font-size: 13px; line-height: 1.3; }
.thumb-card figcaption small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.thumb-card figcaption .icon-button { margin-left: auto; }

/* ----------------------------------------------------- 6. administración */
.admin-body { background: var(--paper-soft); }

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.login-card {
  width: min(432px, 100%);
  padding: 32px 30px 26px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: 0 18px 44px rgba(16, 17, 19, 0.07);
}

.login-card .brand-mark { margin-bottom: 22px; }
.login-card h1 { font-size: 27px; margin-bottom: 12px; }
.login-lead { margin-bottom: 24px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.login-card .field { margin-bottom: 12px; }
.login-card .privacy-note { margin-bottom: 20px; }

.back-link {
  display: block;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}

.back-link:hover { color: var(--ink); }

.admin-shell { min-height: 100vh; }

.admin-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px clamp(18px, 3vw, 34px);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.admin-top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-top .secondary-button { padding: 9px 15px; font-size: 12.5px; }

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 34px clamp(18px, 3vw, 34px) 80px;
}

.admin-main .section-head { margin-bottom: 24px; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.admin-side { display: grid; gap: 20px; }

.engine-card { display: flex; flex-direction: column; padding-bottom: 4px; }

.model-toolbar { display: grid; gap: 12px; padding: 16px 18px 12px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
}

.search-box:focus-within { border-color: var(--ink); }
.search-icon { color: var(--muted); font-size: 14px; }

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: 13.5px;
  outline: none;
}

.filter-tabs { display: flex; flex-wrap: wrap; gap: 7px; }

.filter-tabs button {
  padding: 7px 14px;
  border: 1px solid var(--rule-2);
  border-radius: 99px;
  background: var(--paper);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.filter-tabs button:hover { border-color: var(--ink); color: var(--ink); }

.filter-tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.catalog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  border: 1px solid var(--ink);
  margin-right: 6px;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 10px;
  max-height: 470px;
  overflow-y: auto;
  align-content: start;
  padding: 0 18px 16px;
}

.model-card {
  padding: 13px 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.model-card:hover { border-color: var(--ink); }

.model-card.selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  background: var(--paper-soft);
}

.model-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.model-card h3 { font-size: 13px; line-height: 1.3; letter-spacing: -0.01em; }
.model-card > p {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  background: var(--paper);
  font-size: 11px;
  color: var(--ink);
}

.model-card.selected .model-check { background: var(--lime); border-color: var(--ink); }

.model-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }

.model-tags span {
  padding: 3px 6px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.model-tags .image-tag { background: var(--lime); border-color: var(--ink); color: var(--ink); }

.skeleton {
  height: 98px;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: linear-gradient(90deg, var(--paper-inset) 0%, #fbfbf9 50%, var(--paper-inset) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer { to { background-position: -200% 0; } }

.model-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: auto;
  padding: 15px 18px;
  background: var(--paper-soft);
  border-top: 1px solid var(--rule);
  border-radius: 0 0 7px 7px;
}

.selected-model { min-width: 0; }

.selected-model > span {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.selected-model strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.selected-model small {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refresh-link { align-self: flex-start; margin: 12px 18px 14px; font-size: 12px; }

.admin-card .card-title { padding: 16px 18px 14px; }
.admin-card .field,
.admin-card .field-row,
.admin-card .row-actions,
.admin-card .privacy-note { margin-left: 18px; margin-right: 18px; }
.admin-card .field { margin-top: 16px; }
.admin-card .field-row { margin-top: 16px; }
.admin-card .field-row .field { margin-top: 0; }
.admin-card .row-actions { margin-top: 4px; }
.admin-card .privacy-note { margin-top: -4px; margin-bottom: 16px; }

.status-list,
.project-list { list-style: none; padding: 4px 18px 14px; }

.status-list li,
.project-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}

.status-list li:last-child,
.project-list li:last-child { border-bottom: 0; }

.status-list span { color: var(--muted); }
.status-list strong { text-align: right; font-weight: 600; }
.status-list strong.ok { color: var(--green); }
.status-list strong.bad { color: var(--red); }

.project-list li div { min-width: 0; }
.project-list li div strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list li div small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.project-list li > span { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* --------------------------------- 6a. cuenta, acceso y pie del editor */
/* El acceso y la fila de cuenta se ven dentro del editor (no como el login
   de pantalla completa de /admin), pero comparten el mismo lenguaje visual. */
.auth-view.active { display: grid; place-items: start center; padding-top: clamp(28px, 6vw, 70px); }

.auth-card {
  width: min(468px, 100%);
  padding: 32px 30px 26px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 9px;
  box-shadow: 0 18px 44px rgba(16, 17, 19, 0.06);
}

.auth-card h2 { font-size: clamp(25px, 3vw, 32px); letter-spacing: -0.035em; }
.auth-card .section-lead { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.auth-card .privacy-note { margin-top: 16px; }

.google-slot { display: flex; justify-content: center; margin-top: 22px; }
.google-slot > div { min-height: 44px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--faint);
}

.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.auth-form { display: grid; gap: 12px; margin-top: 4px; }
.auth-form .row-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.auth-card .back-link { margin-top: 20px; }

.account-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--lime);
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.account-copy { min-width: 0; }

.account-copy strong {
  display: block;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.usage-line {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.progress-actions { display: flex; justify-content: center; gap: 12px; margin-top: 26px; }

/* Slot de anuncios del plan gratuito: visible solo mientras el editor trabaja. */
.ad-slot {
  margin: 26px auto 0;
  max-width: 640px;
  border: 1px dashed var(--rule);
  border-radius: 12px;
  padding: 12px 14px 14px;
  background: var(--paper);
}
.ad-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ad-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 6px;
}
.ad-head small { color: var(--muted); font-size: 11.5px; }
#adBox:empty::after {
  content: "Espacio publicitario";
  display: block;
  text-align: center;
  padding: 42px 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}
.usage-ads { font-size: 11.5px; color: var(--muted); }

.app-foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px clamp(20px, 3.2vw, 46px);
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
}

.app-foot nav { display: flex; flex-wrap: wrap; gap: 16px; }
.app-foot a { color: var(--muted); }
.app-foot a:hover { color: var(--ink); }

/* ------------------------------------------------ 6b. admin · rentabilidad */
.login-notice {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.login-notice p { font-size: 12.5px; color: var(--muted); }
.login-notice .secondary-button { margin-top: 12px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink);
}

.check-row input { width: 15px; height: 15px; accent-color: var(--ink); }
.check-row span { line-height: 1.35; }

.admin-grid.monetize { grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.45fr); }

.catalog-block { padding: 4px 18px 12px; }
.catalog-head { padding: 12px 0 10px; border-top: 1px solid var(--rule); }
.catalog-head strong { display: block; font-size: 13.5px; letter-spacing: -0.01em; }
.catalog-head small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.catalog-empty { padding: 14px 0; font-size: 12.5px; color: var(--muted); }

.feature-list,
.plan-list { display: grid; gap: 10px; }

.feature-box,
.plan-box {
  padding: 12px 14px;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.feature-box.off { opacity: 0.55; }

.feature-box header,
.plan-box header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.box-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.box-title {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.box-price { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.box-tools { display: flex; gap: 4px; }

.box-tools button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}

.box-tools button:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.box-tools button:disabled { opacity: 0.35; cursor: default; }

.mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--paper);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.mini-toggle input { accent-color: var(--ink); }

.box-desc {
  width: 100%;
  margin-top: 9px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font: inherit;
  font-size: 12px;
  color: var(--ink);
}

.box-id {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.plan-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.subscriber-storage-field { display: grid; gap: 3px; color: var(--muted); font: 9px var(--mono); }
.subscriber-storage-field input { width: 92px; min-width: 0; padding: 7px 8px; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); color: var(--ink); font: 12px var(--sans); }

@media (max-width: 640px) {
  .settings-dialog[open] { grid-template-columns: minmax(0, 1fr); }
  .settings-head, .settings-account, .settings-dialog > .settings-section:nth-of-type(2), .settings-projects-section, .settings-privacy-section, .settings-data-section { grid-column: 1; }
  .project-storage-heading { flex-direction: column; }
}

.plan-fields label {
  display: grid;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.plan-fields input {
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font: inherit;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
}

.plan-flags { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 4px; }
.plan-flags .check-row { margin-top: 8px; }

.plan-features {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.plan-features-title {
  width: 100%;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.plan-features .feature-toggle { margin-top: 0; }

.subscribers-card { margin-top: 18px; }

.subscriber-list { list-style: none; padding: 4px 18px 14px; }

.subscriber-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
}

.subscriber-list li:last-child { border-bottom: 0; }
.subscriber-list li div strong { display: block; }
.subscriber-list li div small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }

.subscriber-actions { display: flex; align-items: center; gap: 8px; }

.subscriber-actions select {
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

/* ---------------------------------------------------------- 7. responsive */
@media (max-width: 1120px) {
  .section-head { grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
  .section-head .section-lead,
  .section-head .plan-actions { justify-self: start; text-align: left; }
  .material-grid { grid-template-columns: minmax(0, 1fr); }
  .result-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-spec { margin-top: 8px; }
  .process-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-list li { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .process-list li:first-child { border-top: 0; }
}

@media (max-width: 860px) {
  .caps-grid { grid-template-columns: minmax(0, 1fr); }
  .pricing-grid { grid-template-columns: minmax(0, 1fr); }
  .foot-nav { text-align: left; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .steps { display: flex; margin-top: 0; border-top: 0; gap: 4px; }
  .step { grid-template-columns: auto; padding: 7px 11px; border: 1px solid var(--rule); border-radius: 99px; border-left-width: 1px; }
  .step b, .step small { display: none; }
  .step.active { background: var(--ink); border-color: var(--ink); }
  .step.active > span { color: #fff; }
  .sidebar-bottom { margin-top: 0; grid-auto-flow: column; align-items: center; gap: 14px; }
  .principle { display: none; }
  .key-button { padding: 8px 10px; }
  .topbar { position: static; }
}

@media (max-width: 680px) {
  .head-nav a:not(.primary-button) { display: none; }
  .process-list { grid-template-columns: minmax(0, 1fr); }
  .process-list li { border-top: 1px solid var(--rule); padding-top: 20px; }
  .process-list li:first-child { border-top: 0; }
  .hero-actions .primary-button,
  .hero-actions .secondary-button { width: 100%; }
  .next-row { align-items: flex-start; flex-direction: column; }
  .admin-top { flex-wrap: wrap; }
}

/* ---------------------------------------------------- editor en teléfonos */
@media (max-width: 680px) {
  html { scroll-padding-top: 16px; }

  .app-shell { min-height: 100dvh; }

  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 12px;
    padding: 12px 16px;
  }

  .sidebar .brand { font-size: 21px; }

  .steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .step {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-radius: 6px;
    text-align: center;
  }

  .step > span {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-bottom {
    width: 100%;
    grid-auto-flow: row;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
  }

  .sidebar-ad,
  .account-row,
  .usage-line,
  .principle { grid-column: 1 / -1; }

  .sidebar-ad { max-height: 180px; overflow: hidden; }

  .account-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 7px;
    padding: 8px 0;
  }

  .account-row .link-button { padding: 5px 2px; font-size: 12px; }
  .usage-line { overflow-wrap: anywhere; }
  .sidebar-bottom > .secondary-button.full { width: 100%; min-width: 0; padding-inline: 8px; }

  main { width: 100%; padding: 0 16px 40px; }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0 12px;
  }

  .topbar h1 { max-width: 100%; margin-top: 5px; font-size: 17px; }
  .system-status { max-width: 100%; font-size: 11px; }
  .view { padding-top: 20px; }

  .section-head {
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 20px;
  }

  .section-head h2 { font-size: clamp(29px, 8vw, 38px); }
  .section-head .section-lead { max-width: none; font-size: 13px; }
  .section-head .plan-actions { width: 100%; }
  .section-head .plan-actions > * { flex: 1 1 140px; }

  .material-grid { gap: 14px; }
  .upload-card { min-height: 240px; gap: 10px; padding: 26px 14px; }
  .upload-card h3 { font-size: 20px; }
  .upload-card p { font-size: 13px; }
  .upload-card small { max-width: 100%; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }

  .file-meta { align-items: flex-start; gap: 9px; padding: 11px; }
  .file-name { flex: 1; min-width: 0; }
  .file-name strong { font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
  .file-name small { margin-top: 4px; }
  .file-meta .icon-button { margin-left: 0; }
  .setup-card { padding: 0 14px 14px; }
  .card-heading { gap: 10px; padding: 15px 0 12px; }
  .option-block { padding: 13px 0; }
  .segmented { gap: 3px; }
  .segmented button { min-width: 0; padding: 9px 5px; font-size: 11px; white-space: normal; }
  #styleOptions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #styleOptions button { width: 100%; min-height: 42px; line-height: 1.25; }
  .resource-upload { align-items: flex-start; gap: 8px; }
  .resource-copy { min-width: 0; }
  .resource-upload .secondary-button { flex: none; padding: 9px 11px; }

  .draft-item { align-items: flex-start; flex-wrap: wrap; gap: 5px 10px; padding: 10px 12px; }
  .draft-item > span:first-child { flex: 1 1 100%; min-width: 0; }
  .draft-item strong { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .draft-state { margin-left: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

  .progress-wrap { margin-top: 32px; }
  .progress-wrap h2 { font-size: clamp(31px, 9vw, 42px); }
  .progress-lead { font-size: 14px; }
  .progress-track { margin-top: 28px; }
  .pipeline { gap: 8px; font-size: 9px; letter-spacing: 0.06em; }
  .progress-note { margin-top: 28px; font-size: 12px; }
  .progress-actions { flex-direction: column; gap: 8px; }
  .progress-actions > * { width: 100%; }
  .ad-slot { padding: 10px; }
  .ad-head { align-items: flex-start; flex-wrap: wrap; gap: 6px; }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics > div { min-width: 0; padding: 12px; }
  .result-layout { gap: 14px; margin-top: 14px; }
  .card-title { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .card-title > :first-child { min-width: 0; }
  .output-wrap { padding: 10px 10px 0; }
  .timeline { padding: 12px 10px 0; }
  .timeline-legend { gap: 8px 12px; padding: 12px 10px; font-size: 9.5px; }
  .analysis-content { padding: 12px 14px 4px; }
  .qc-box { margin: 12px; padding: 11px; }
  .credits-box { margin: 0 12px 14px; }
  .thumb-grid,
  .thumb-grid.is-vertical { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px; }
  .thumb-card figcaption { align-items: flex-start; gap: 7px; padding: 8px; }
  .thumb-card figcaption strong { font-size: 11px; overflow-wrap: anywhere; }
  .thumb-card figcaption small { font-size: 10px; overflow-wrap: anywhere; }
  .thumb-card figcaption .icon-button { margin-left: 0; }
  .next-row { gap: 14px; margin-top: 24px; padding-top: 18px; }
  .next-row .secondary-button { width: 100%; }

  .settings-dialog {
    width: calc(100vw - 20px);
    max-width: 520px;
    max-height: 90dvh;
    border-radius: 12px;
  }

  .settings-head { padding: 14px 16px 10px; }
  .settings-section { padding: 14px 16px; }
  .settings-actions > * { flex: 1 1 145px; }
  .project-storage-row { align-items: flex-start; }

  .auth-view.active { padding-top: 20px; }
  .auth-card { padding: 24px 18px 20px; }
  .auth-form .row-actions { align-items: stretch; flex-direction: column; gap: 8px; }
  .auth-form .row-actions > * { width: 100%; }

  .app-foot { align-items: flex-start; flex-direction: column; padding: 18px 16px; }
  .app-foot nav { gap: 8px 14px; }
  .toast { bottom: max(12px, env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); padding: 11px 14px; font-size: 12.5px; }
}

@media (max-width: 380px) {
  main { padding-inline: 12px; }
  .sidebar { padding-inline: 12px; }
  .step { padding-inline: 2px; }
  .step > span { font-size: 10px; }
  .account-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  #logoutUser { grid-column: 3; }
  .thumb-grid,
  .thumb-grid.is-vertical { grid-template-columns: minmax(0, 1fr); }
  .thumb-grid.is-vertical .thumb-card img { max-height: 62vh; object-fit: contain; }
}
