/* =======================================================================
   Influsxy · Estilos de la plataforma de generación IA
   Reutiliza los tokens del sistema de diseño (oklch, radios, sombras).
   ======================================================================= */

/* ---------------------------------------------------------- Spinner --- */
.ai-spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid color-mix(in oklab, currentColor 35%, transparent);
  border-top-color: currentColor;
  animation: ai-rot .7s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
}
@keyframes ai-rot { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- Avatares --- */
.ai-avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .14), 0 6px 16px -10px rgb(0 0 0 / .8);
  overflow: hidden;
}
.ai-avatar.sq { border-radius: 14px; }
.ai-avatar-logo { position: relative; box-shadow: 0 6px 16px -10px rgb(0 0 0 / .8); }
.ai-avatar-logo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #0b0b12;
  padding: 10%;
  box-sizing: border-box;
  object-fit: contain;
}

/* --------------------------------------------------- Fila de modelo --- */
.ai-modelrow {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-2xl);
  padding: 10px 12px;
  margin-bottom: 10px;
  animation: popIn .22s ease both;
}
.ai-modelrow-open {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ai-modelrow-open:active { transform: scale(.99); }
.ai-modelrow-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.ai-modelrow-name {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-modelrow-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ai-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: var(--primary-glow);
  border: 1px solid color-mix(in oklab, var(--primary) 26%, transparent);
}
.ai-tag.alt {
  background: color-mix(in oklab, var(--muted-foreground) 14%, transparent);
  color: var(--muted-foreground);
  border-color: color-mix(in oklab, var(--muted-foreground) 22%, transparent);
}
/* Badges reales por modalidad (colores distintos, mismo lenguaje visual) */
.ai-tag.video { background: color-mix(in oklab, #8b5cf6 20%, transparent); color: #c4b5fd; border-color: color-mix(in oklab, #8b5cf6 40%, transparent); }
.ai-tag.img { background: color-mix(in oklab, #06b6d4 18%, transparent); color: #67e8f9; border-color: color-mix(in oklab, #06b6d4 38%, transparent); }
.ai-tag.t2v { background: color-mix(in oklab, #f59e0b 18%, transparent); color: #fcd34d; border-color: color-mix(in oklab, #f59e0b 38%, transparent); }
.ai-tag.i2v { background: color-mix(in oklab, #ec4899 18%, transparent); color: #f9a8d4; border-color: color-mix(in oklab, #ec4899 38%, transparent); }
.ai-tag.t2i { background: color-mix(in oklab, #10b981 18%, transparent); color: #6ee7b7; border-color: color-mix(in oklab, #10b981 38%, transparent); }
.ai-tag.i2i { background: color-mix(in oklab, #3b82f6 18%, transparent); color: #93c5fd; border-color: color-mix(in oklab, #3b82f6 38%, transparent); }
.ai-tag.audio { background: color-mix(in oklab, #14b8a6 18%, transparent); color: #5eead4; border-color: color-mix(in oklab, #14b8a6 38%, transparent); }
.ai-tag.three-d { background: color-mix(in oklab, #a855f7 22%, transparent); color: #d8b4fe; border-color: color-mix(in oklab, #a855f7 42%, transparent); }
.ai-tag.avatar { background: color-mix(in oklab, #f43f5e 18%, transparent); color: #fda4af; border-color: color-mix(in oklab, #f43f5e 38%, transparent); }
.ai-tag.edit { background: color-mix(in oklab, #eab308 18%, transparent); color: #fde047; border-color: color-mix(in oklab, #eab308 38%, transparent); }
.ai-modelrow-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--foreground);
}
.ai-modelrow-price small { font-size: 10px; font-weight: 600; color: var(--muted-foreground); }

.ai-fav {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: transform .1s, color .1s, background .1s;
}
.ai-fav:hover { background: var(--secondary); }
.ai-fav.on { color: var(--warning); }
.ai-fav:active { transform: scale(.88); }

/* ------------------------------------------------- Catálogo plataformas */
.ai-platform {
  display: flex;
  align-items: center;
  gap: 12px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-2xl);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
  animation: popIn .22s ease both;
}
.ai-platform:active { transform: scale(.99); }
.ai-platform-main { flex: 1; min-width: 0; }
.ai-platform-name { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.ai-platform-meta { font-size: 12px; color: var(--muted-foreground); margin-top: 3px; }
.ai-platform-count {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 15%, transparent);
  color: var(--primary-glow);
  border: 1px solid color-mix(in oklab, var(--primary) 24%, transparent);
}
.ai-chiprow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.ai-chiprow::-webkit-scrollbar { display: none; }
.ai-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ai-chip.on { background-image: var(--gradient-primary); color: var(--primary-foreground); border-color: transparent; }

/* ----------------------------------------------------- Tarjeta generación */
.ai-gen-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.ai-gen-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  animation: popIn .22s ease both;
}
.ai-gen-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: oklch(0.18 0.02 286);
  overflow: hidden;
}
.ai-gen-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-gen-thumb video, .ai-gen-vthumb { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.ai-gen-thumb.noimg { display: flex; align-items: center; justify-content: center; }
.ai-gen-thumb.noimg .ai-gen-vthumb { position: absolute; inset: 0; }
.ai-gen-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
}
.ai-gen-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgb(0 0 0 / .5);
  color: #fff;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 0 1px rgb(255 255 255 / .25);
}
.ai-gen-kind {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgb(0 0 0 / .55);
  color: #fff;
  backdrop-filter: blur(3px);
}
.ai-gen-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgb(0 0 0 / .4);
}
.ai-gen-progress > span {
  display: block;
  height: 100%;
  background-image: var(--gradient-primary);
  transition: width .4s ease;
}
.ai-gen-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.ai-gen-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ai-gen-top b { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-gen-date { font-size: 11px; color: var(--muted-foreground); }
.ai-gen-actions { display: flex; gap: 6px; margin-top: 2px; }
.ai-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-md);
  background: var(--secondary);
  color: var(--foreground);
  cursor: pointer;
  transition: transform .1s, filter .1s;
}
.ai-icon-btn:hover { filter: brightness(1.15); }
.ai-icon-btn:active { transform: scale(.9); }
.ai-icon-btn.on { color: var(--warning); border-color: color-mix(in oklab, var(--warning) 40%, transparent); }
.ai-status { display: inline-flex; align-items: center; }

/* --------------------------------------------------------- Reproductor */
.ai-player {
  position: relative;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}
.ai-player video { display: block; width: 100%; height: auto; max-height: 70vh; background: #000; }
.ai-player-img img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: oklch(0.12 0.01 286); }
.ai-player-dl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  background: var(--secondary);
  color: var(--foreground);
}
.ai-player-dl:hover { filter: brightness(1.1); }

/* ---------------------------------------------------- Formulario generar */
.ai-field { margin-bottom: 14px; }
.ai-field > label { margin-top: 0; }
.ai-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-choice button {
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: var(--secondary);
  color: var(--muted-foreground);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s;
}
.ai-choice button:active { transform: scale(.96); }
.ai-choice button.on {
  background-image: var(--gradient-primary);
  color: var(--primary-foreground);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.ai-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-xl);
  border: 1px dashed color-mix(in oklab, var(--border) 90%, transparent);
  background: color-mix(in oklab, var(--secondary) 50%, transparent);
  cursor: pointer;
}
.ai-drop.has { border-style: solid; border-color: color-mix(in oklab, var(--primary) 40%, transparent); }
.ai-drop img { width: 48px; height: 48px; border-radius: var(--radius-md); object-fit: cover; }
.ai-drop small { display: block; color: var(--muted-foreground); font-size: 11px; }
.ai-counter { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }

.ai-price-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-2xl);
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
  box-shadow: var(--shadow-glow);
  margin-bottom: 12px;
}
.ai-price-bar .lbl { font-size: 12px; color: var(--muted-foreground); }
.ai-price-bar .val { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.ai-price-bar .val small { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }

/* ------------------------------------------------------------- Detalle */
.ai-kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid color-mix(in oklab, var(--border) 50%, transparent); font-size: 13px; }
.ai-kv:last-child { border-bottom: 0; }
.ai-kv span:first-child { color: var(--muted-foreground); }
.ai-kv span:last-child { font-weight: 600; text-align: right; word-break: break-word; }
.ai-prompt {
  font-size: 13px;
  line-height: 1.5;
  color: var(--foreground);
  background: color-mix(in oklab, var(--secondary) 55%, transparent);
  border-radius: var(--radius-xl);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------- Admin */
.ai-plat-card {
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-2xl);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.ai-plat-head { display: flex; align-items: center; gap: 12px; }
.ai-plat-head .grow { flex: 1; min-width: 0; }
.ai-plat-head b { font-size: 15px; font-weight: 800; display: block; }
.ai-plat-head small { font-size: 12px; color: var(--muted-foreground); }
.ai-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.ai-kpi {
  background: color-mix(in oklab, var(--secondary) 60%, transparent);
  border-radius: var(--radius-lg);
  padding: 10px;
  text-align: center;
}
.ai-kpi small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.ai-kpi b { font-size: 14px; font-weight: 800; }
.ai-plat-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-plat-actions .btn { width: auto; }

.ai-model-card {
  background: color-mix(in oklab, var(--secondary) 45%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 60%, transparent);
  border-radius: var(--radius-xl);
  padding: 12px;
  margin-bottom: 10px;
}
.ai-model-card .row { margin-bottom: 6px; }
.ai-model-card .name { font-size: 14px; font-weight: 700; }
.ai-model-card .meta { font-size: 11px; color: var(--muted-foreground); }
.ai-mult { display: flex; gap: 6px; }
.ai-mult button {
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: var(--secondary);
  color: var(--foreground);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ai-mult button.on { background-image: var(--gradient-primary); color: var(--primary-foreground); border-color: transparent; }
.ai-profit { font-size: 12px; font-weight: 700; }
.ai-profit.up { color: var(--success); }
.ai-profit.down { color: var(--destructive); }

.ai-driver-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-driver-pick button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: var(--secondary);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--foreground);
}
.ai-driver-pick button b { font-size: 13px; }
.ai-driver-pick button small { font-size: 10px; color: var(--muted-foreground); }
.ai-driver-pick button.on { border-color: var(--ring); background: color-mix(in oklab, var(--primary) 16%, transparent); }

.ai-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ai-tabs button, .ai-tabs a {
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: var(--secondary);
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center;
}
.ai-tabs button.on, .ai-tabs a.on { background-image: var(--gradient-primary); color: var(--primary-foreground); border-color: transparent; }

.ai-empty { padding: 32px 16px; text-align: center; color: var(--muted-foreground); font-size: 14px; }
.ai-empty .big { display: flex; justify-content: center; margin-bottom: 10px; opacity: .6; }

/* ---------------------------------------------- Tiles home (Inicio IA) */
.ai-home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.ai-home-actions .action { align-items: flex-start; text-align: left; }
.ai-home-actions .action .ico { border-radius: var(--radius-lg); }
.ai-home-actions .action small { display: block; }

.ai-quick { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; margin-bottom: 4px; }
.ai-quick::-webkit-scrollbar { display: none; }
.ai-quick a {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 76px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-align: center;
}

/* ------------------------------------------------ Responsive (desktop) */
@media (min-width: 640px) {
  .ai-gen-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .ai-gen-grid { grid-template-columns: repeat(3, 1fr); }
  .ai-home-actions { grid-template-columns: repeat(4, 1fr); }
  .ai-driver-pick { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 360px) {
  .ai-gen-grid { grid-template-columns: 1fr; }
}

/* ======================================================================
   Ajustes de fidelidad visual (según mockups de referencia)
   ====================================================================== */

/* ------------------- Catálogo de plataformas en grilla 2x2 ------------------- */
.ai-plat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-plat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  min-height: 132px;
  padding: 18px 12px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  animation: popIn .22s ease both;
  transition: transform .08s, border-color .1s;
}
.ai-plat-tile:active { transform: scale(.97); }
.ai-plat-tile:hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); }
.ai-plat-tile .ai-avatar { box-shadow: 0 8px 20px -10px rgb(0 0 0 / .9); }
.ai-plat-tile .t { font-size: 14px; font-weight: 800; line-height: 1.15; }
.ai-plat-tile .m { font-size: 11px; font-weight: 600; color: var(--muted-foreground); }
.ai-plat-tile .n {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: var(--primary-glow);
  border: 1px solid color-mix(in oklab, var(--primary) 26%, transparent);
}
@media (min-width: 640px) { .ai-plat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .ai-plat-grid { grid-template-columns: repeat(4, 1fr); } }

.ai-top-badge{display:inline-flex;align-items:center;font-size:9px;font-weight:800;letter-spacing:.06em;padding:2px 7px;border-radius:6px;background-image:var(--gradient-primary);color:var(--primary-foreground);box-shadow:var(--shadow-glow)}
/* ------------------------- Vista previa (generar) ------------------------- */
.ai-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-2xl);
  border: 1px dashed color-mix(in oklab, var(--border) 90%, transparent);
  background: color-mix(in oklab, var(--secondary) 45%, transparent);
  color: var(--muted-foreground);
  text-align: center;
  overflow: hidden;
  margin-bottom: 14px;
}
.ai-preview .play {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 18%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 34%, transparent);
  color: var(--primary-glow);
}
.ai-preview .cap { font-size: 13px; font-weight: 600; }
.ai-preview .sub { font-size: 11px; }
.ai-preview img, .ai-preview video { width: 100%; height: 100%; object-fit: cover; }

/* --------------------- Contador de duración (- valor +) --------------------- */
.ai-stepper {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: var(--secondary);
  border-radius: var(--radius-xl);
  padding: 8px 10px;
}
.ai-stepper button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: var(--radius-md);
  background: color-mix(in oklab, var(--primary) 14%, transparent);
  color: var(--primary-glow);
  font-size: 20px; font-weight: 800; line-height: 1; cursor: pointer;
}
.ai-stepper button:active { transform: scale(.92); }
.ai-stepper .val { font-size: 18px; font-weight: 800; text-align: center; flex: 1; }
.ai-stepper .val small { display: block; font-size: 10px; font-weight: 600; color: var(--muted-foreground); }

/* -------------------- Tarjetas home con chevron (Inicio) -------------------- */
.ai-home-actions .action { position: relative; }
.ai-home-actions .action .chev {
  position: absolute; right: 12px; top: 12px;
  color: var(--muted-foreground); opacity: .8;
}

/* ---------------------- Admin: saldo plataforma (rojo) ---------------------- */
.ai-plat-bal { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.ai-plat-bal .l { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.ai-plat-bal .v { font-size: 14px; font-weight: 800; color: var(--destructive); }
.ai-plat-bal .v.ok { color: var(--success); }

/* ======================================================================
   Inicio: tarjetas horizontales (icono a la izquierda, texto, chevron)
   ====================================================================== */
.ai-home-actions .action.home-card {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px;
  text-align: left;
  min-height: 76px;
}
.ai-home-actions .action.home-card .ico {
  position: relative;
  flex: none;
  height: 44px;
  width: 44px;
  border-radius: 999px;
  background-image: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: 0 8px 18px -10px oklch(0.58 0.222 296 / 0.9);
}
.ai-home-actions .action.home-card .ico-dot {
  position: absolute;
  right: -1px;
  top: -1px;
  height: 10px;
  width: 10px;
  border-radius: 999px;
  background: var(--destructive);
  box-shadow: 0 0 0 2px var(--card);
}
.ai-home-actions .action.home-card .txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ai-home-actions .action.home-card .txt b { font-size: 13.5px; font-weight: 800; line-height: 1.15; }
.ai-home-actions .action.home-card .txt small { font-size: 11px; color: var(--muted-foreground); }
.ai-home-actions .action.home-card .chev {
  position: static;
  flex: none;
  color: var(--muted-foreground);
  opacity: .7;
  display: flex;
}

/* Home: cuatro accesos directos (grilla 2x2) */
.grid2 .action.home-card {
  position: relative;
  gap: 10px;
  padding: 18px 14px 16px;
  text-align: left;
  align-items: flex-start;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 16%, transparent) 0%, transparent 58%),
    var(--card);
  border: 1px solid color-mix(in oklab, var(--border) 78%, transparent);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.grid2 .action.home-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, color-mix(in oklab, #fff 8%, transparent), transparent 45%);
  pointer-events: none;
  z-index: -1;
}
.grid2 .action.home-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 46%, transparent);
  box-shadow: 0 18px 34px -22px color-mix(in oklab, var(--primary) 70%, transparent);
}
.grid2 .action.home-card .ico {
  height: 46px;
  width: 46px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background-image: var(--gradient-primary);
  box-shadow: 0 10px 22px -12px color-mix(in oklab, var(--primary) 85%, transparent), inset 0 1px 0 rgba(255,255,255,.28);
}
.grid2 .action.home-card .ico svg { width: 23px; height: 23px; stroke-width: 2.1; }
.grid2 .action.home-card b { font-size: 14px; font-weight: 800; line-height: 1.2; }
.grid2 .action.home-card small { font-size: 11px; line-height: 1.3; color: var(--muted-foreground); }
.grid2 .action.home-card .chev {
  position: absolute;
  right: 12px;
  top: 14px;
  display: flex;
  color: var(--muted-foreground);
  opacity: .55;
  transition: transform .16s ease, opacity .16s ease;
}
.grid2 .action.home-card:hover .chev { opacity: .95; transform: translate(2px, -2px); }
/* Acentos por tarjeta */
.grid2 .action.home-card.card-models .ico { background-image: linear-gradient(135deg, #6d5efc, #a855f7); }
.grid2 .action.home-card.card-create .ico { background-image: linear-gradient(135deg, #8b5cf6, #ec4899); }
.grid2 .action.home-card.card-wallet .ico { background-image: linear-gradient(135deg, #7c3aed, #22d3ee); }
.grid2 .action.home-card.card-gen .ico { background-image: linear-gradient(135deg, #a855f7, #6366f1); }

/* ---- Encabezado de categoría en el catálogo de modelos ---- */
.ai-cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 2px 10px;
}
.ai-cat-head:first-of-type { margin-top: 6px; }
.ai-cat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
  border-radius: 10px;
  color: var(--primary-glow);
  background: color-mix(in oklab, var(--primary) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary) 34%, transparent);
  flex: none;
}
.ai-cat-name { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.ai-cat-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-foreground);
  background: color-mix(in oklab, var(--muted-foreground) 14%, transparent);
  border-radius: 999px;
  padding: 2px 9px;
}

/* ---- Formulario público de generación ---- */
.ai-gen-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 2px 8px;
  box-sizing: border-box;
}
.ai-gen-wrap form { display: flex; flex-direction: column; gap: 14px; }
.ai-gen-wrap select,
.ai-gen-wrap textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
.ai-gen-modelhead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ai-gen-modeltxt {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.ai-gen-modeltxt b {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.ai-gen-modeltxt .ai-tag { align-self: flex-start; }
.ai-gen-desc {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
@media (max-width: 430px) {
  .ai-gen-wrap { padding: 0 0 6px; }
  .ai-gen-wrap form { gap: 12px; }
  .ai-gen-modelhead { gap: 10px; }
  .ai-gen-modeltxt b { font-size: 14px; }
}

/* ==========================================================================
   Generador público: botón de ajustes, modal centrado y pantalla de carga
   ========================================================================== */
body.ai-noscroll { overflow: hidden; }

.ai-cfgbtn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 14px; padding: 12px 14px; cursor: pointer;
  color: var(--foreground); text-align: left; font: inherit;
  transition: border-color .15s;
}
.ai-cfgbtn:hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); }
.ai-cfgbtn-ico { display: inline-flex; color: var(--primary-glow); flex: none; }
.ai-cfgbtn-txt { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-cfgbtn-chev { display: inline-flex; color: var(--muted-foreground); flex: none; }

.ai-balance {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 26%, transparent);
  border-radius: 14px; padding: 11px 14px; font-size: 12.5px; color: var(--muted-foreground);
}
.ai-balance b { font-size: 15px; font-weight: 800; color: var(--primary-glow); }

/* Modal centrado de configuración */
.ai-cfg-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  padding: 14px;
}
.ai-cfg-backdrop[hidden] { display: none; }
.ai-cfg-sheet {
  width: 100%; max-width: 24rem; max-height: calc(100dvh - 28px);
  background: var(--card); border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 24px; padding: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8);
  display: flex; flex-direction: column; animation: aiCfgIn .18s ease;
}
@keyframes aiCfgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.ai-cfg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ai-cfg-head b { font-size: 15px; font-weight: 800; }
.ai-cfg-x {
  border: 0; background: var(--secondary); color: var(--foreground); border-radius: 999px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px; line-height: 1;
}
.ai-cfg-model {
  background: color-mix(in oklab, var(--background) 55%, transparent);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 12px;
}
.ai-cfg-model .ai-gen-desc { margin: 6px 0 0; font-size: 11.5px; }
.ai-cfg-body { display: flex; flex-direction: column; gap: 14px; }
.ai-cfg-block label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); margin-bottom: 7px; }
.ai-cfg-foot { margin-top: 16px; }
.ai-cfg-foot .btn { width: 100%; justify-content: center; }

/* Aviso de costo variable (modelos por consumo) */
.ai-cost-sheet { text-align: center; gap: 10px; }
.ai-cost-ico {
  width: 52px; height: 52px; margin: 2px auto 4px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, #c3a4ff 0%, var(--primary) 55%, #4d2596 100%);
  box-shadow: 0 12px 26px rgb(109 40 217 / .45), inset 0 2px 4px rgb(255 255 255 / .45);
}
.ai-cost-title { font-size: 16px; font-weight: 800; line-height: 1.25; }
.ai-cost-text { margin: 0 0 6px; font-size: 13px; line-height: 1.5; color: var(--muted-foreground); }

/* Pantalla de carga animada */
.ai-load {
  position: fixed; inset: 0; z-index: 95; background: rgba(6,4,12,.86);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ai-load[hidden] { display: none; }
.ai-load-card {
  width: 100%; max-width: 22rem; text-align: center; padding: 26px 20px;
  background: var(--card); border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 26px; box-shadow: 0 30px 90px -20px rgba(0,0,0,.85);
  animation: aiCfgIn .22s ease;
}
.ai-ring {
  width: 112px; height: 112px; margin: 0 auto 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; position: relative;
  background: conic-gradient(var(--primary) 0deg, rgba(255,255,255,.10) 0deg);
  transition: background .25s linear;
}
.ai-ring::before {
  content: ""; position: absolute; inset: 9px; border-radius: 999px;
  background: var(--card);
}
.ai-ring span {
  position: relative; z-index: 1; font-size: 24px; font-weight: 800;
  color: var(--primary-glow); letter-spacing: -.02em;
}
.ai-load-title { margin: 0; font-size: 16px; font-weight: 800; }
.ai-load-sub { margin: 6px 0 14px; font-size: 12.5px; color: var(--muted-foreground); min-height: 18px; }
.ai-load-bar {
  height: 6px; border-radius: 999px; background: var(--secondary); overflow: hidden; margin-bottom: 14px;
}
.ai-load-bar span {
  display: block; height: 100%; width: 0%; border-radius: 999px;
  background-image: var(--gradient-primary); transition: width .3s ease;
}
.ai-load-note { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted-foreground); }
@media (max-width: 430px) {
  .ai-cfg-sheet { padding: 16px; border-radius: 20px; }
  .ai-load-card { padding: 22px 16px; }
  .ai-ring { width: 96px; height: 96px; }
  .ai-ring span { font-size: 21px; }
}

/* Carga animada dentro de la página de resultado */
.ai-load-inline {
  text-align: center; padding: 26px 18px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 22px; margin-bottom: 14px;
}
.ai-load-inline .ai-ring { margin-bottom: 14px; }
.ai-load-inline .ai-load-bar { max-width: 280px; margin: 0 auto 12px; }
.ai-saved-note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11.5px; color: var(--muted-foreground); margin: 10px 0 0;
}
.ai-saved-note a { color: var(--primary-glow); font-weight: 700; text-decoration: none; }

/* ===== Vista previa del modelo (video de ejemplo visible antes de generar) ===== */
.ai-prev-wrap{position:relative;margin-top:10px;border-radius:14px;overflow:hidden;background:#000;border:1px solid color-mix(in oklab,var(--border) 70%,transparent)}
.ai-prev-video{display:block;width:100%;max-height:260px;object-fit:contain;background:#000}
.ai-prev-badge{position:absolute;top:8px;left:8px;display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:800;letter-spacing:.02em;color:#fff;background:rgba(0,0,0,.55);backdrop-filter:blur(6px);padding:4px 8px;border-radius:999px;pointer-events:none}
.ai-prev-wrap.compact .ai-prev-video{max-height:150px}
@media (max-width:520px){.ai-prev-video{max-height:200px}.ai-prev-wrap.compact .ai-prev-video{max-height:120px}}

/* ==========================================================================
   Ronda 2 · tarjeta de modelo, ajustes por opción, precio en vivo y modales
   ========================================================================== */

/* Avatar circular liso (sin gradiente) */
.ai-avatar.round { border-radius: 999px; background: var(--primary); box-shadow: none; }

/* Tarjeta del modelo en el generador */
.ai-modelcard { border-radius: 18px; }
.ai-gen-modelprice {
  margin-left: auto; display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; white-space: nowrap; flex: none;
}
.ai-gen-modelprice b { font-size: 15px; font-weight: 800; color: var(--foreground); }
.ai-gen-modelprice small { font-size: 10px; font-weight: 700; color: var(--muted-foreground); }

/* Lista de ajustes: cada fila abre su propio modal */
.ai-setlist { display: flex; flex-direction: column; gap: 8px; }
.ai-setrow {
  width: 100%; display: flex; align-items: center; gap: 11px;
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 14px; padding: 11px 13px; cursor: pointer;
  color: var(--foreground); text-align: left; font: inherit;
  transition: border-color .15s, transform .1s;
}
.ai-setrow:hover { border-color: color-mix(in oklab, var(--primary) 42%, transparent); }
.ai-setrow:active { transform: scale(.995); }
.ai-setrow-ico {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 10px;
  background: color-mix(in oklab, var(--primary) 16%, transparent);
  color: var(--primary-glow);
}
.ai-setrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-setrow-lbl { font-size: 12px; font-weight: 700; color: var(--muted-foreground); }
.ai-setrow-val {
  font-size: 13.5px; font-weight: 700; color: var(--foreground);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-setrow-chev { display: inline-flex; color: var(--muted-foreground); flex: none; }

/* Precio en vivo */
.ai-quote {
  background-image: var(--gradient-surface);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
  border-radius: 16px; padding: 14px 15px;
  display: flex; flex-direction: column; gap: 4px;
}
.ai-quote-line { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.ai-quote-total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ai-quote-total span { font-size: 12px; font-weight: 700; color: var(--muted-foreground); }
.ai-quote-total b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--primary-glow); }
.ai-quote-total b small { font-size: 11px; font-weight: 700; color: var(--muted-foreground); }
.ai-quote-usd { font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.ai-quote-bal { font-size: 11.5px; font-weight: 600; color: var(--muted-foreground); margin-top: 4px; }
.ai-quote-bal.bad { color: var(--destructive); }

/* Toggle de booleanos */
.ai-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; color: var(--muted-foreground); }
.ai-switch {
  flex: none; width: 46px; height: 26px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--secondary); position: relative; transition: background .18s;
}
.ai-switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: left .18s; }
.ai-switch.on { background: var(--primary); }
.ai-switch.on i { left: 23px; }

/* Preview del archivo dentro del modal */
.ai-drop-preview {
  min-height: 120px; border-radius: 14px; border: 1px dashed color-mix(in oklab, var(--border) 90%, transparent);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: color-mix(in oklab, var(--background) 55%, transparent);
}
.ai-drop-preview img { max-width: 100%; max-height: 200px; object-fit: contain; display: block; }
.ai-drop-preview .muted { font-size: 12px; }

/* Modales centrados, sin cortes */
.ai-cfg-backdrop { align-items: center; justify-content: center; }
.ai-cfg-sheet { max-height: calc(100dvh - 24px); }
.ai-cfg-body { min-height: 0; }
.ai-cfg-body .ai-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-cfg-body .ai-choice button {
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  background: var(--secondary); color: var(--foreground);
  border-radius: 11px; padding: 9px 13px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.ai-cfg-body .ai-choice button.on {
  background: color-mix(in oklab, var(--primary) 22%, transparent);
  border-color: color-mix(in oklab, var(--primary) 55%, transparent);
  color: var(--primary-glow);
}
.ai-cfg-body textarea {
  width: 100%; box-sizing: border-box; border-radius: 12px; resize: vertical;
  background: var(--secondary); color: var(--foreground); font: inherit; font-size: 13px;
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent); padding: 10px 12px;
}

/* Tarjetas de categoría: ícono arriba, texto abajo a la izquierda */
.ai-plat-tile {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  gap: 2px;
  min-height: 150px;
  padding: 16px;
}
.ai-plat-tile .ai-avatar { position: absolute; top: 14px; left: 14px; }
.ai-plat-tile .t { margin-top: auto; font-size: 15px; }
.ai-plat-tile .m { font-size: 11px; }

/* Línea única de modalidad en las filas de modelo */
.ai-modelrow-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Ronda 3 · Archivos, modales por opción, carga con checklist, vista previa
   ========================================================================== */

/* --- Bloque "Archivos (opcional)" --- */
.ai-files { margin-top: 4px; }
.ai-files-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--secondary); color: var(--foreground);
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  transition: border-color .18s ease, background .18s ease;
}
.ai-files-head:hover { border-color: color-mix(in oklab, var(--primary) 42%, transparent); }
.ai-files-head[aria-expanded="true"] .ai-setrow-chev { transform: rotate(180deg); }
.ai-files-head .ai-setrow-chev { transition: transform .2s ease; }
.ai-files-body {
  margin-top: 10px; padding: 14px; border-radius: 14px;
  background: color-mix(in oklab, var(--secondary) 60%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  animation: aiCfgIn .18s ease;
}

/* --- Sub-título de los modales --- */
.ai-cfg-sub { margin: 3px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted-foreground); font-weight: 500; }

/* --- Relación de aspecto: tarjetas con proporción real --- */
.ai-aspect-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ai-aspect {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 8px; border-radius: 14px; cursor: pointer; min-height: 92px;
  background: var(--secondary); color: var(--foreground);
  border: 1.5px solid color-mix(in oklab, var(--border) 80%, transparent);
  transition: border-color .16s ease, background .16s ease, transform .1s ease;
}
.ai-aspect:active { transform: scale(.98); }
.ai-aspect .box {
  display: block; border-radius: 4px;
  border: 1.5px solid color-mix(in oklab, var(--foreground) 55%, transparent);
  background: color-mix(in oklab, var(--foreground) 8%, transparent);
}
.ai-aspect b { font-size: 12.5px; font-weight: 800; }
.ai-aspect small { font-size: 10.5px; color: var(--muted-foreground); font-weight: 600; }
.ai-aspect.on { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 14%, var(--secondary)); }
.ai-aspect.on .box { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 30%, transparent); }
.ai-aspect.on b { color: var(--primary-glow); }

/* --- Lista de opciones (calidad / duración) con precio y check --- */
.ai-optlist { display: flex; flex-direction: column; gap: 8px; }
.ai-optrow {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--secondary); color: var(--foreground);
  border: 1.5px solid color-mix(in oklab, var(--border) 80%, transparent);
  transition: border-color .16s ease, background .16s ease;
}
.ai-optrow:hover { border-color: color-mix(in oklab, var(--primary) 42%, transparent); }
.ai-optrow-ico {
  flex: none; width: 38px; height: 38px; border-radius: 11px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--primary-glow);
  background: color-mix(in oklab, var(--primary) 14%, transparent);
}
.ai-optrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-optrow-main b { font-size: 14px; font-weight: 800; }
.ai-optrow-main small { font-size: 12px; color: var(--muted-foreground); font-weight: 600; }
.ai-optrow-check {
  flex: none; width: 24px; height: 24px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; color: #fff;
  border: 1.5px solid color-mix(in oklab, var(--border) 90%, transparent);
}
.ai-optrow.on { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 12%, var(--secondary)); }
.ai-optrow.on .ai-optrow-check { background: var(--primary); border-color: var(--primary); }
.ai-optrow.on .ai-optrow-main b { color: var(--primary-glow); }

/* --- Pantalla de carga: checklist + bloque de costo --- */
.ai-steps { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ai-steps li {
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600;
  color: var(--muted-foreground); transition: color .25s ease;
}
.ai-steps li i {
  flex: none; width: 16px; height: 16px; border-radius: 999px; position: relative;
  border: 2px solid color-mix(in oklab, var(--border) 90%, transparent);
  background: transparent; transition: all .25s ease;
}
.ai-steps li.on { color: var(--foreground); }
.ai-steps li.on i { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 22%, transparent); }
.ai-steps li.on i::after {
  content: ""; position: absolute; inset: 2px; border-radius: 999px; background: var(--primary);
  animation: aiPulse 1s ease-in-out infinite;
}
.ai-steps li.done { color: var(--foreground); }
.ai-steps li.done i { border-color: var(--primary); background: var(--primary); }
.ai-steps li.done i::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
@keyframes aiPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.ai-load-cost {
  margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; text-align: center;
  background: color-mix(in oklab, var(--primary) 8%, var(--secondary));
  border: 1px solid color-mix(in oklab, var(--primary) 24%, transparent);
}
.ai-load-cost .l { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.ai-load-cost .v { font-size: 12.5px; font-weight: 700; margin-top: 3px; }
.ai-load-cost .s { font-size: 17px; font-weight: 800; color: var(--primary-glow); margin-top: 2px; letter-spacing: -.02em; }

/* --- Vista previa: HD + play + resumen --- */
.ai-prev-hd {
  position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 800; letter-spacing: .03em;
  color: #fff; background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  padding: 4px 8px; border-radius: 999px; pointer-events: none;
}
.ai-prev-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; pointer-events: none;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.35);
}
.ai-prev-sum { margin-top: 12px; display: flex; flex-direction: column; }
.ai-prev-sum .ai-kv { font-size: 13px; }

@media (max-width: 430px) {
  .ai-aspect-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-optrow { padding: 11px 12px; }
  .ai-prev-play { width: 48px; height: 48px; }
}

/* --- Inicio: mosaico de categorías "Modelos IA" --- */
.home-cats { margin-top: 18px; }
.home-cats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.home-cats-head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.home-cats-head a { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; color: var(--primary-glow); text-decoration: none; }
.home-cats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.home-cat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 14px; border-radius: 16px; text-decoration: none; color: var(--foreground);
  background: var(--card); border: 1px solid color-mix(in oklab, var(--border) 75%, transparent);
  transition: border-color .18s ease, transform .1s ease, background .18s ease;
}
.home-cat:hover { border-color: color-mix(in oklab, var(--primary) 45%, transparent); background: color-mix(in oklab, var(--primary) 6%, var(--card)); }
.home-cat:active { transform: scale(.98); }
.home-cat .t { font-size: 13.5px; font-weight: 800; }
.home-cat .m { font-size: 11.5px; color: var(--muted-foreground); font-weight: 600; }
@media (max-width: 360px) { .home-cats-grid { grid-template-columns: repeat(2, 1fr); } }

/* --- Resultado: "¡Listo! Tu video está preparado" --- */
.gen-done-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.gen-done-ico {
  flex: none; width: 38px; height: 38px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; background: var(--primary);
}
.gen-done-head h3 { margin: 0; font-size: 16.5px; font-weight: 800; letter-spacing: -.01em; }
.gen-done-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted-foreground); }
.gen-result { position: relative; }
.gen-res-hd {
  position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 800; letter-spacing: .03em;
  color: #fff; background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  padding: 4px 8px; border-radius: 999px; pointer-events: none;
}
.gen-res-dur {
  position: absolute; bottom: 10px; right: 10px; font-size: 11px; font-weight: 800;
  color: #fff; background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  padding: 4px 8px; border-radius: 999px; pointer-events: none;
}

/* --- Saldo del proveedor (hero) --- */
.ai-bal-hero {
  margin: 4px 0 0; padding: 18px; border-radius: 20px;
  background: linear-gradient(160deg, color-mix(in oklab, var(--primary) 20%, var(--card)), var(--card));
  border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent);
}
.ai-bal-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-bal-hero-lbl { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); }
.ai-bal-hero-badge {
  font-size: 10.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  color: #fff; background: var(--success);
}
.ai-bal-hero-badge.off { background: var(--destructive); }
.ai-bal-hero-val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; color: var(--foreground); }
.ai-bal-hero-meta { font-size: 11px; color: var(--muted-foreground); margin-top: 2px; }
.ai-bal-hero-actions { display: flex; gap: 8px; margin-top: 14px; }
.ai-bal-hero-actions .btn { font-size: 12.5px; padding: 10px 12px; }

/* ==========================================================================
   Ronda 4 · Modales independientes, scroll de duración y pulido
   ========================================================================== */

/* El cuerpo del modal hace scroll si el contenido excede la pantalla */
.ai-cfg-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

/* Listas de opciones (calidad / duración): scroll propio, también en móvil */
.ai-optlist {
  max-height: min(54vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 4px 2px 2px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--primary) 55%, transparent) transparent;
}
.ai-optlist::-webkit-scrollbar { width: 8px; }
.ai-optlist::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--primary) 50%, transparent);
  border-radius: 999px;
}
.ai-optlist::-webkit-scrollbar-track { background: transparent; }
.ai-optrow { flex: none; }

@media (max-width: 430px) {
  .ai-optlist { max-height: 46vh; }
}

/* Filas de acceso del generador */
.ai-gen-actions .ai-setrow { margin-bottom: 8px; }
.ai-gen-actions .ai-setrow:last-child { margin-bottom: 0; }

/* ==========================================================================
   Ronda 4 · Vista de generación (resultado + detalles)
   ========================================================================== */
.gen-view {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: start;
}
.gen-view-main { min-width: 0; }
.gen-view-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 860px) {
  .gen-view { grid-template-columns: 1fr; }
}
.gen-result {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: #0b0713;
  border: 1px solid color-mix(in oklab, var(--primary) 22%, var(--border));
  box-shadow: 0 26px 60px -34px color-mix(in oklab, var(--primary) 70%, transparent);
}
.gen-result video, .gen-result img { display: block; width: 100%; height: auto; }
.gen-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.gen-actions .btn { width: 100%; justify-content: center; }
@media (max-width: 560px) {
  .gen-actions { grid-template-columns: 1fr 1fr; }
  .gen-actions .btn:first-child { grid-column: 1 / -1; }
}
.gen-meta { padding: 16px; }
.gen-meta-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.gen-meta-head h3 { margin: 0; font-size: 14px; font-weight: 800; }
.gen-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gen-meta-item {
  background: color-mix(in oklab, var(--background) 55%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 55%, transparent);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 0;
}
.gen-meta-item span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); font-weight: 700; }
.gen-meta-item b { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 800; overflow-wrap: anywhere; }
.gen-meta-cost { color: var(--primary-glow); }
.gen-prompt-card { padding: 16px; }
.gen-prompt-card .section { margin-top: 0; }
.gen-ref-img { max-width: 100%; border-radius: 14px; display: block; }
.gen-side-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.gen-side-actions .btn { width: 100%; justify-content: center; }
.gen-fail { text-align: center; padding: 36px 16px; }
.gen-fail-ico { display: flex; justify-content: center; margin-bottom: 12px; color: var(--destructive); }

/* ---- Ronda 5: total + saldo + Generar siempre visibles (sin scroll) ---- */
.ai-gen-footer{
  display:flex;flex-direction:column;gap:10px;
}
@media (max-width:820px){
  .ai-gen-footer{
    position:sticky;bottom:0;z-index:30;
    padding:10px 0 calc(8px + env(safe-area-inset-bottom));
    margin:0 -2px;
    background:linear-gradient(to top,
      var(--background) 62%,
      color-mix(in oklab,var(--background) 55%,transparent) 88%,
      transparent);
    backdrop-filter:blur(6px);
    -webkit-backdrop-filter:blur(6px);
  }
  .ai-gen-footer .ai-quote{padding:10px 12px;gap:2px}
  .ai-gen-footer .ai-quote-total b{font-size:18px}
  .ai-gen-footer .ai-balance{padding:9px 12px}
  .ai-gen-footer .btn.lg{width:100%}
}

/* ---- Ronda 5: categorías más prolijas (íconos y espaciado) ---- */
.ai-plat-tile{
  min-height:158px;padding:18px;border-radius:20px;
}
.ai-plat-tile .ai-avatar{
  width:60px!important;height:60px!important;border-radius:18px!important;
  box-shadow:0 12px 26px -14px rgb(0 0 0 / .95), inset 0 0 0 1px rgb(255 255 255 / .16);
}
.ai-plat-tile .t{letter-spacing:.012em;line-height:1.2;margin-top:12px}
.ai-plat-tile .m{opacity:.85;letter-spacing:.01em}
.ai-plat-tile .n{top:12px;right:12px}
.ai-cat-head{gap:12px;margin:24px 2px 12px}
.ai-cat-ico{height:34px;width:34px;border-radius:11px}
.ai-cat-name{letter-spacing:.015em}

/* Total en vivo dentro del modal de opciones */
.ai-opt-live{flex:1;min-width:0;font-size:12px;font-weight:600;color:var(--muted-foreground)}
.ai-opt-live b{font-size:15px;font-weight:800;color:var(--primary-glow)}
.ai-opt-live small{font-size:10px;color:var(--muted-foreground)}
.ai-cfg-foot{display:flex;align-items:center;justify-content:space-between;gap:10px}

/* =====================================================================
   Ronda 6 · Barra "Generar" integrada (sin tarjetas que tapen opciones)
   ===================================================================== */
.ai-gen-wrap form { padding-bottom: 4px; }
.ai-gen-footer { display: block; margin-top: 6px; }
.ai-genbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 18px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--card) 92%, transparent),
      color-mix(in oklab, var(--card) 78%, transparent));
  box-shadow: 0 18px 40px -26px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05);
}
.ai-genbar-l { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-genbar-total { display: flex; align-items: baseline; gap: 8px; }
.ai-genbar-total span {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted-foreground); font-weight: 800;
}
.ai-genbar-total b { font-size: 21px; font-weight: 800; color: var(--primary-glow); letter-spacing: -.015em; }
.ai-genbar-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted-foreground); }
.ai-genbar-meta span:empty { display: none; }
.ai-genbar-bal { font-size: 10.5px; color: var(--muted-foreground); }
.ai-genbar-bal.bad { color: var(--destructive); font-weight: 700; }
.ai-genbar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.ai-genbar-wallet { display: flex; flex-direction: column; text-align: right; line-height: 1.15; }
.ai-genbar-wallet span {
  font-size: 9px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted-foreground); font-weight: 800;
}
.ai-genbar-wallet b { font-size: 13px; font-weight: 800; }
.ai-genbar .btn.lg { width: auto; white-space: nowrap; }

@media (max-width: 820px) {
  .ai-gen-footer {
    position: sticky; bottom: 0; z-index: 40;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    margin: 0 -2px;
    background: linear-gradient(to top,
      var(--background) 68%,
      color-mix(in oklab, var(--background) 60%, transparent) 90%,
      transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .ai-genbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-radius: 16px; }
  .ai-genbar-l { order: 1; flex: 1 1 100%; }
  .ai-genbar-right { order: 2; flex: 1 1 100%; justify-content: space-between; gap: 10px; }
  .ai-genbar .btn.lg { flex: 1; justify-content: center; }
  .ai-genbar-total b { font-size: 18px; }
  .ai-genbar-wallet { text-align: left; }
}

/* =====================================================================
   Ronda 6 · Estado de publicación + switch (admin)
   ===================================================================== */
.ai-pubstate {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 12px; border-radius: 14px;
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: color-mix(in oklab, var(--secondary) 55%, transparent);
}
.ai-pubstate.on {
  border-color: color-mix(in oklab, var(--success) 45%, transparent);
  background: color-mix(in oklab, var(--success) 12%, transparent);
}
.ai-pubstate-ico { display: inline-flex; color: var(--muted-foreground); flex: none; }
.ai-pubstate.on .ai-pubstate-ico { color: var(--success); }
.ai-pubstate-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ai-pubstate-txt b { font-size: 12.5px; font-weight: 800; }
.ai-pubstate-txt small { font-size: 10.5px; color: var(--muted-foreground); }
.ai-switch { position: relative; flex: none; width: 42px; height: 24px; display: inline-block; cursor: pointer; }
.ai-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ai-switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
  transition: background .18s ease;
}
.ai-switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / .35);
  transition: transform .18s ease;
}
.ai-switch input:checked + span { background: var(--success); }
.ai-switch input:checked + span::after { transform: translateX(18px); }

@media (max-width: 820px) {
  .ai-mfoot {
    position: sticky; bottom: 0; z-index: 20;
    background: linear-gradient(to top, var(--background) 75%, transparent);
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }
}

/* =====================================================================
   Ronda 6 · Pulido general (superficies, foco, densidad)
   ===================================================================== */
.card, .admin-list, .ai-plat-tile, .ai-model-card {
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ai-model-card:hover {
  border-color: color-mix(in oklab, var(--primary) 45%, transparent);
  box-shadow: 0 14px 30px -22px rgb(0 0 0 / .95);
}
.ai-model-card:focus-visible,
.ai-setrow:focus-visible,
.home-card:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--primary) 70%, transparent);
  outline-offset: 2px;
}
.ai-setrow { transition: background .16s ease, border-color .16s ease; }
.ai-setrow:hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); }
.ai-setrow-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  background: color-mix(in oklab, var(--primary) 14%, transparent);
  color: var(--primary-glow);
}
.ai-cat-head { padding-bottom: 2px; border-bottom: 1px solid color-mix(in oklab, var(--border) 55%, transparent); }
.ai-quote { border-radius: 14px; }
.ai-cfg-sheet { border-radius: 22px 22px 0 0; }
@media (min-width: 821px) { .ai-cfg-sheet { border-radius: 22px; } }

/* =====================================================================
   Ronda 6 · Ícono "Nueva Generación" (crear video)
   ===================================================================== */
.grid2 .action.home-card.card-create {
  border-color: color-mix(in oklab, #ec4899 32%, var(--border));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, #ec4899 16%, transparent) 0%, transparent 58%),
    var(--card);
}
.grid2 .action.home-card.card-create .ico {
  position: relative;
  background-image: linear-gradient(135deg, #8b5cf6 0%, #d946ef 55%, #ec4899 100%);
  box-shadow:
    0 12px 26px -12px rgba(236, 72, 153, .70),
    inset 0 1px 0 rgba(255, 255, 255, .38);
}
.grid2 .action.home-card.card-create .ico::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 22px;
  background: radial-gradient(circle at 72% 18%, rgba(236, 72, 153, .50), transparent 62%);
  filter: blur(9px);
  z-index: -1;
  pointer-events: none;
}
.grid2 .action.home-card.card-create .ico svg { stroke-width: 2; }
.grid2 .action.home-card.card-create:hover .ico {
  box-shadow:
    0 16px 32px -12px rgba(236, 72, 153, .85),
    inset 0 1px 0 rgba(255, 255, 255, .45);
}

/* Tarjeta del modelo en el generador: más compacta para no empujar opciones */
.ai-gen-modelhead { padding: 2px 0; }
@media (max-width: 820px) {
  .ai-gen-modelhead { gap: 10px; }
  .ai-gen-modelprice b { font-size: 14px; }
}

/* Modelo sin costo real publicado por el proveedor */
.ai-model-nocost { color: var(--warning, #f59e0b); font-size: 12px; }

/* =====================================================================
   Ronda 6 · Modales de opciones: el cuerpo scrollea, nada queda tapado
   ===================================================================== */
.ai-cfg-sheet { overflow: hidden; }
.ai-cfg-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.ai-cfg-foot {
  flex: none;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--card) 70%, color-mix(in oklab, var(--card) 70%, transparent));
  padding-top: 8px;
}
.ai-setrow { scroll-margin-bottom: 90px; }
@media (max-width: 820px) {
  .ai-cfg-backdrop { padding: 10px; align-items: flex-end; }
  .ai-cfg-sheet {
    max-height: calc(100dvh - 20px);
    border-radius: 22px 22px 0 0;
    padding: 16px 14px calc(12px + env(safe-area-inset-bottom));
  }
  .ai-cfg-head { padding-bottom: 8px; }
}

/* =====================================================================
   Ronda 6 · Pulido visual general (tipografía, superficies, controles)
   ===================================================================== */
:root {
  --r6-radius: 18px;
  --r6-ring: color-mix(in oklab, var(--primary) 55%, transparent);
}

.page-title { gap: 12px; }
.page-title h2 { letter-spacing: -.02em; font-weight: 800; }
.page-title p { color: var(--muted-foreground); }

.card {
  border-radius: var(--r6-radius);
  border: 1px solid color-mix(in oklab, var(--border) 72%, transparent);
  background:
    linear-gradient(180deg,
      color-mix(in oklab, var(--card) 96%, transparent),
      color-mix(in oklab, var(--card) 88%, transparent));
  box-shadow: 0 20px 44px -34px rgb(0 0 0 / .95), inset 0 1px 0 rgb(255 255 255 / .04);
}

.btn {
  border-radius: 13px;
  font-weight: 700;
  letter-spacing: .005em;
  transition: transform .14s ease, box-shadow .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--r6-ring); outline-offset: 2px; }
.btn.lg { border-radius: 15px; }

input, select, textarea {
  border-radius: 12px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in oklab, var(--primary) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
  outline: none;
}

.ai-tabs { gap: 8px; padding-bottom: 4px; }
.ai-tabs a, .ai-tabs button {
  border-radius: 999px;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.ai-plat-tile {
  border: 1px solid color-mix(in oklab, var(--border) 72%, transparent);
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 14%, transparent), transparent 60%),
    var(--card);
}
.ai-plat-tile:hover {
  border-color: color-mix(in oklab, var(--primary) 45%, transparent);
  box-shadow: 0 22px 40px -28px color-mix(in oklab, var(--primary) 65%, transparent);
}

.ai-empty, .ai-hint { color: var(--muted-foreground); }

.notice { border-radius: 13px; }
.admin-modal-sheet { border-radius: 22px; }
.admin-list { border-radius: var(--r6-radius); }

/* Micro-animación de entrada para listas largas */
@keyframes r6In { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ai-model-card, .ai-pub-row, .ai-plat-tile { animation: r6In .22s ease both; }
@media (prefers-reduced-motion: reduce) {
  .ai-model-card, .ai-pub-row, .ai-plat-tile { animation: none; }
  .btn:hover { transform: none; }
}

/* =====================================================================
   Ronda 7 · Scroll de duración/calidad: un solo contenedor, todo accesible
   ===================================================================== */
.ai-cfg-sheet { display: flex; flex-direction: column; }
.ai-cfg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* La lista de opciones ya no crea un scroll anidado: scrollea el cuerpo del modal */
.ai-optlist {
  max-height: none !important;
  overflow: visible !important;
  touch-action: pan-y;
  padding: 2px 4px 6px 2px;
}
@media (max-width: 430px) {
  .ai-optlist { max-height: none !important; }
}

/* =====================================================================
   Ronda 7 · Botón "Saldo insuficiente"
   ===================================================================== */
.btn.insufficient,
.btn.insufficient:disabled,
.btn.insufficient[disabled] {
  background: color-mix(in oklab, var(--destructive) 22%, var(--secondary)) !important;
  border-color: color-mix(in oklab, var(--destructive) 60%, transparent) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12) !important;
  cursor: not-allowed !important;
  opacity: .95;
}
.btn.insufficient::after { display: none !important; }
.btn.insufficient svg { opacity: .85; }

/* =====================================================================
   Ronda 7 · Recibo de generación (centrado, sin repetir el precio)
   ===================================================================== */
.ai-gen-footer { margin-top: 10px; }
.ai-genbar.ai-receipt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 18px 18px 16px;
  border-radius: 24px;
  border: 1px solid color-mix(in oklab, var(--primary) 26%, var(--border));
  background:
    radial-gradient(130% 120% at 50% -20%, color-mix(in oklab, var(--primary) 22%, transparent), transparent 58%),
    linear-gradient(180deg,
      color-mix(in oklab, var(--card) 98%, transparent),
      color-mix(in oklab, var(--card) 90%, transparent));
  box-shadow:
    0 28px 64px -36px rgb(0 0 0 / .95),
    inset 0 1px 0 rgb(255 255 255 / .07);
}
.ai-receipt-head { display: flex; align-items: center; gap: 12px; justify-content: center; }
.ai-receipt-ico {
  flex: none; width: 44px; height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background-image: var(--gradient-primary);
  box-shadow:
    0 12px 24px -12px color-mix(in oklab, var(--primary) 90%, transparent),
    inset 0 2px 4px rgb(255 255 255 / .40),
    inset 0 -4px 8px rgb(0 0 0 / .28);
}
.ai-receipt-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ai-receipt-titles b { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.ai-receipt-titles span {
  font-size: 11.5px; color: var(--muted-foreground); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 15rem;
}
.ai-receipt-amount { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin: 16px 0 2px; }
.ai-receipt-amount b {
  font-size: 36px; font-weight: 900; letter-spacing: -.03em; line-height: 1;
  color: var(--primary-glow);
  text-shadow: 0 10px 30px color-mix(in oklab, var(--primary) 45%, transparent);
}
.ai-receipt-cur { font-size: 12px; font-weight: 800; letter-spacing: .09em; color: var(--muted-foreground); }
.ai-receipt-usd { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted-foreground); min-height: 16px; }
.ai-receipt-div {
  height: 1px; margin: 14px 0;
  background-image: linear-gradient(90deg, transparent, color-mix(in oklab, var(--border) 95%, transparent) 18%, color-mix(in oklab, var(--border) 95%, transparent) 82%, transparent);
}
.ai-receipt-bal { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted-foreground); margin-bottom: 14px; }
.ai-receipt-bal.bad { color: var(--destructive); }
.ai-receipt-actions { display: flex; align-items: center; gap: 12px; }
.ai-receipt-actions .ai-genbar-wallet { flex: 1; text-align: left; display: flex; flex-direction: column; line-height: 1.2; }
.ai-receipt-actions .ai-genbar-wallet span { font-size: 10px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.ai-receipt-actions .ai-genbar-wallet b { font-size: 15px; font-weight: 800; }
.ai-receipt-actions .btn.lg { flex: none; white-space: nowrap; }

@media (max-width: 820px) {
  .ai-gen-footer {
    position: static;
    padding: 8px 0 0;
    margin: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .ai-genbar.ai-receipt { padding: 14px 14px 13px; border-radius: 20px; }
  .ai-receipt-head { display: none; }
  .ai-receipt-amount { margin: 2px 0 0; }
  .ai-receipt-amount b { font-size: 28px; }
  .ai-receipt-usd { min-height: 0; margin-top: 2px; }
  .ai-receipt-div { margin: 10px 0; }
  .ai-receipt-bal { margin-bottom: 10px; }
  .ai-receipt-actions { flex-wrap: wrap; gap: 8px; }
  .ai-receipt-actions .ai-genbar-wallet { flex: 1 1 100%; text-align: center; }
  .ai-receipt-actions .btn.lg { flex: 1 1 100%; justify-content: center; }
}

/* =====================================================================
   Ronda 7 · Estética glossy / plástica violeta (sin tocar el logo)
   ===================================================================== */
/* Botones con brillo y relieve plástico */
.btn:not(.ghost):not(.link) {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 12px 26px -16px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 1px 0 rgb(255 255 255 / .30),
    inset 0 -2px 6px rgb(0 0 0 / .22);
}
.btn:not(.ghost):not(.link)::after {
  content: "";
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .38), transparent);
  transform: skewX(-18deg);
  transition: left .55s ease;
  pointer-events: none;
}
.btn:not(.ghost):not(.link):hover::after { left: 135%; }
.btn.sec:not(.ghost)::after { background: linear-gradient(100deg, transparent, rgb(255 255 255 / .16), transparent); }

/* Superficies: brillo superior sutil tipo plástico */
.card, .ai-modelcard, .gen-meta, .gen-prompt-card {
  position: relative;
  box-shadow:
    0 22px 52px -40px rgb(0 0 0 / .95),
    inset 0 1px 0 rgb(255 255 255 / .06);
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 45%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgb(255 255 255 / .045), transparent);
  pointer-events: none;
}

/* Filas de ajustes y opciones: relieve y brillo al pasar */
.ai-setrow, .ai-optrow {
  position: relative;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), 0 8px 18px -16px rgb(0 0 0 / .9);
}
.ai-setrow:hover, .ai-optrow:hover {
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / .10),
    0 12px 26px -18px color-mix(in oklab, var(--primary) 70%, transparent);
}
.ai-setrow-ico {
  background-image: linear-gradient(160deg, color-mix(in oklab, var(--primary) 34%, transparent), color-mix(in oklab, var(--primary) 12%, transparent));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), inset 0 -3px 6px rgb(0 0 0 / .18);
  color: #fff;
}

/* Hero del inicio: brillo plástico */
.hero {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 30px 70px -34px color-mix(in oklab, var(--primary) 75%, transparent),
    inset 0 1px 0 rgb(255 255 255 / .28),
    inset 0 -18px 40px rgb(0 0 0 / .22);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 60% at 15% 0%, rgb(255 255 255 / .22), transparent 55%),
    linear-gradient(115deg, transparent 55%, rgb(255 255 255 / .12) 70%, transparent 82%);
  pointer-events: none;
}
.hero .inner, .hero .ghost-logo { position: relative; }

/* Tarjetas del inicio: relieve plástico y brillo al hover */
.grid2 .action.home-card {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 22px 48px -34px rgb(0 0 0 / .95),
    inset 0 1px 0 rgb(255 255 255 / .07);
  transition: transform .16s ease, box-shadow .18s ease, border-color .18s ease;
}
.grid2 .action.home-card::after {
  content: "";
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .12), transparent);
  transform: skewX(-18deg);
  transition: left .6s ease;
  pointer-events: none;
}
.grid2 .action.home-card:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--primary) 42%, transparent); }
.grid2 .action.home-card:hover::after { left: 135%; }
.grid2 .action.home-card .ico {
  box-shadow:
    0 12px 26px -12px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 2px 5px rgb(255 255 255 / .40),
    inset 0 -5px 10px rgb(0 0 0 / .28);
}

/* =====================================================================
   Ronda 7 · Categorías: tarjetas glossy con avatar circular plástico
   ===================================================================== */
.ai-plat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 640px) { .ai-plat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .ai-plat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.ai-plat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 3px;
  min-height: 150px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid color-mix(in oklab, var(--primary) 18%, var(--border));
  background:
    radial-gradient(130% 110% at 0% 0%, color-mix(in oklab, var(--primary) 24%, transparent), transparent 58%),
    linear-gradient(180deg,
      color-mix(in oklab, var(--card) 98%, transparent),
      color-mix(in oklab, var(--card) 88%, transparent));
  box-shadow:
    0 24px 54px -36px rgb(0 0 0 / .95),
    inset 0 1px 0 rgb(255 255 255 / .07);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .18s ease, border-color .18s ease;
}
.ai-plat-tile::after {
  content: "";
  position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .12), transparent);
  transform: skewX(-18deg);
  transition: left .6s ease;
  pointer-events: none;
}
.ai-plat-tile:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--primary) 55%, transparent);
  box-shadow:
    0 32px 64px -32px color-mix(in oklab, var(--primary) 55%, transparent),
    inset 0 1px 0 rgb(255 255 255 / .10);
}
.ai-plat-tile:hover::after { left: 135%; }
.ai-plat-tile .ai-avatar {
  position: static !important;
  width: 58px !important;
  height: 58px !important;
  border-radius: 18px !important;
  margin-bottom: 10px;
  background: radial-gradient(circle at 30% 22%, #c3a4ff 0%, var(--primary) 52%, #4d2596 100%) !important;
  border: 1px solid rgb(255 255 255 / .20);
  box-shadow:
    0 16px 30px -12px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 3px 7px rgb(255 255 255 / .48),
    inset 0 -6px 12px rgb(0 0 0 / .38) !important;
}
.ai-plat-tile .ai-avatar svg { filter: drop-shadow(0 2px 3px rgb(0 0 0 / .40)); }
.ai-plat-tile .t { margin: auto 0 0; font-size: 15.5px; font-weight: 800; letter-spacing: .01em; }
.ai-plat-tile .m { font-size: 11.5px; color: var(--muted-foreground); font-weight: 600; }
.ai-plat-tile .n { top: 12px; right: 12px; }

/* ============================================================ Ronda 8 — Inicio compacto
   Solo las cuatro opciones principales. Sin scroll innecesario ni relleno inferior
   excesivo en pantallas cortas. El contenido se centra verticalmente si sobra alto. */
.page-home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 96px;
  gap: 4px;
}
.page-home .hero { margin-bottom: 16px; }
.page-home .grid2.home-actions { margin-bottom: 0; }
@media (max-width: 430px) {
  .page-home { padding-bottom: 84px; justify-content: flex-start; }
  .page-home .hero { margin-bottom: 12px; }
  .page-home .action.home-card { padding: 16px 14px; }
}
@media (min-width: 900px) {
  .page-home { justify-content: center; padding-bottom: 32px; }
  .page-home .hero { margin-bottom: 22px; }
}

/* ============================================================ Asistente de guía
   Burbuja flotante + panel de chat. Violeta glossy, centrado y responsive. */
.fx-assist { position: fixed; right: 16px; bottom: 84px; z-index: 70; font-family: inherit; }
.fx-assist-btn {
  position: relative;
  display: grid; place-items: center;
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  color: #fff; cursor: pointer;
  background: radial-gradient(120% 120% at 30% 20%, #c3a4ff 0%, var(--primary) 55%, #4d2596 100%);
  box-shadow: 0 14px 30px rgb(109 40 217 / .45), inset 0 2px 4px rgb(255 255 255 / .45), inset 0 -4px 10px rgb(0 0 0 / .28);
  transition: transform .16s ease, box-shadow .16s ease;
}
.fx-assist-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 18px 36px rgb(109 40 217 / .55), inset 0 2px 4px rgb(255 255 255 / .5), inset 0 -4px 10px rgb(0 0 0 / .3); }
.fx-assist-btn:active { transform: scale(.96); }
/* X de minimizar: aparece sólo al mantener apretado el globito. */
.fx-assist-kill {
  position: absolute;
  top: -4px; right: -4px;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  padding: 0; border: 0; border-radius: 50%;
  color: #fff; cursor: pointer;
  background: radial-gradient(120% 120% at 30% 20%, #ff8a8a 0%, #ef4444 60%, #b91c1c 100%);
  box-shadow: 0 6px 14px rgb(185 28 28 / .5), inset 0 1px 2px rgb(255 255 255 / .5), inset 0 -2px 5px rgb(0 0 0 / .25);
  opacity: 0; transform: scale(.4); pointer-events: none;
  transition: opacity .16s ease, transform .16s cubic-bezier(.34,1.56,.64,1);
  z-index: 5;
}
.fx-assist-kill[hidden] { display: none !important; }
.fx-assist.show-kill .fx-assist-kill {
  opacity: 1; transform: scale(1); pointer-events: auto;
}
.fx-assist-kill:hover { transform: scale(1.12); box-shadow: 0 8px 18px rgb(185 28 28 / .6), inset 0 1px 2px rgb(255 255 255 / .55); }
.fx-assist-kill:active { transform: scale(.92); }
.fx-assist-kill svg { pointer-events: none; }
.fx-assist-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--primary) 55%, transparent);
  animation: fxAssistPulse 2.6s ease-out infinite; pointer-events: none;
}
@keyframes fxAssistPulse {
  0% { transform: scale(.9); opacity: .7; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}
.fx-assist-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--background);
}
/* El atributo [hidden] debe ganarle a cualquier display de clase. Sin esto el
   panel y el badge nunca se ocultan (display:flex/grid pisa el display:none del UA). */
.fx-assist-panel[hidden],
.fx-assist-badge[hidden] { display: none !important; }
.fx-assist-panel {
  position: absolute; right: 0; bottom: 70px;
  width: min(370px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 150px));
  display: flex; flex-direction: column;
  background: color-mix(in oklab, var(--card) 92%, #1a1030);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, var(--border));
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 26px 60px rgb(0 0 0 / .5), inset 0 1px 0 rgb(255 255 255 / .08);
  animation: fxAssistIn .18s ease-out;
}
@keyframes fxAssistIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.fx-assist-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 14px;
  background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 88%, #000), color-mix(in oklab, var(--primary) 55%, #000));
  color: #fff;
}
.fx-assist-ava { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgb(255 255 255 / .16); box-shadow: inset 0 1px 0 rgb(255 255 255 / .35); }
.fx-assist-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fx-assist-titles b { font-size: 14px; font-weight: 800; }
.fx-assist-titles span { display: flex; align-items: center; gap: 5px; font-size: 11px; opacity: .9; }
.fx-assist-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.fx-assist-x { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgb(255 255 255 / .14); color: #fff; cursor: pointer; }
.fx-assist-x:hover { background: rgb(255 255 255 / .24); }
.fx-assist-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fx-msg { display: flex; }
.fx-msg.user { justify-content: flex-end; }
.fx-bubble {
  max-width: 85%; padding: 10px 13px; border-radius: 16px; font-size: 13px; line-height: 1.45;
  background: color-mix(in oklab, var(--secondary) 80%, transparent);
  color: var(--foreground);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  white-space: normal; word-break: break-word;
}
.fx-msg.bot .fx-bubble { border-bottom-left-radius: 6px; }
.fx-msg.user .fx-bubble {
  background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--primary) 70%, #000));
  color: #fff; border: 0; border-bottom-right-radius: 6px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22);
}
.fx-bubble-note { font-size: 12px; opacity: .95; }
.fx-bubble a { color: var(--primary); font-weight: 700; text-decoration: underline; }
.fx-msg.user .fx-bubble a { color: #fff; }
.fx-assist-chips { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 2px; }
.fx-assist-chips button {
  border: 1px solid color-mix(in oklab, var(--primary) 40%, var(--border));
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  color: var(--foreground); border-radius: 999px; padding: 7px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: background .12s, transform .12s;
}
.fx-assist-chips button:hover { background: color-mix(in oklab, var(--primary) 22%, transparent); transform: translateY(-1px); }
.fx-typing .fx-bubble { display: flex; gap: 4px; align-items: center; }
.fx-typing .fx-bubble span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-foreground); animation: fxTyping 1.1s infinite ease-in-out; }
.fx-typing .fx-bubble span:nth-child(2) { animation-delay: .15s; }
.fx-typing .fx-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes fxTyping { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.fx-assist-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid color-mix(in oklab, var(--border) 70%, transparent); background: color-mix(in oklab, var(--card) 96%, #000); }
.fx-assist-form input {
  flex: 1; min-width: 0; border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  background: var(--background); color: var(--foreground);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; outline: none;
}
.fx-assist-form input:focus { border-color: color-mix(in oklab, var(--primary) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent); }
.fx-assist-form button {
  display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px;
  color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--primary) 65%, #000));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25);
}
.fx-assist-form button:disabled { opacity: .6; cursor: default; }
.fx-assist-foot { display: block; text-align: center; font-size: 11.5px; padding: 9px 12px 12px; color: var(--muted-foreground); }
.fx-assist-foot:hover { color: var(--primary); }
@media (min-width: 900px) { .fx-assist { bottom: 24px; right: 24px; } }
@media (max-width: 430px) {
  .fx-assist-panel { position: fixed; right: 8px; left: 8px; bottom: 78px; width: auto; max-height: calc(100dvh - 110px); }
}

/* =====================================================================
   Ronda 9 · Limpieza, rendimiento y unificación visual
   - Sin blurs (backdrop-filter) ni animaciones decorativas
   - Hero de inicio/saldo compacto y prolijo (como la versión estable)
   - Tarjetas del inicio con una única identidad violeta
   - Barra "Generar" prolija, sin tapar el tab bar
   - Topbar siempre visible
   ===================================================================== */

/* ---------- 1. Sin blurs ---------- */
*,
*::before,
*::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.card-create .ico::after,
.grid2 .action.home-card.card-create .ico::after { content: none !important; display: none !important; filter: none !important; }
.welcome-bg .blob { filter: none !important; opacity: .22 !important; }

/* ---------- 2. Sin animaciones decorativas (se conservan los spinners de carga) ---------- */
.card, .listrow, .tile,
.ai-model-card, .ai-pub-row, .ai-plat-tile,
.ai-cfg-sheet, .ai-load-card, .fx-assist-panel,
.ai-gen-card, .ai-modelrow, .ai-genbar {
  animation: none !important;
}
.fx-assist-pulse, .fx-assist::before, .fx-assist::after { animation: none !important; }
.fx-typing .fx-bubble span { animation: none !important; opacity: .6; }
.btn:not(.ghost):not(.link)::after,
.grid2 .action.home-card::after,
.ai-plat-tile::after { content: none !important; display: none !important; }
.grid2 .action.home-card:hover,
.ai-plat-tile:hover { transform: none !important; }
.ripple-violet, .ripple-violet::after { animation: none !important; }

/* ---------- 3. Hero compacto y correcto (Inicio + Saldo) ---------- */
.hero {
  padding: 20px;
  margin-bottom: 20px;
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}
.hero::before { content: none !important; display: none !important; }
.hero .inner { position: relative; z-index: 2; }
.hero .ghost-logo {
  position: absolute !important;
  z-index: 1;
  right: 4px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  height: 150px;
  width: 150px;
  opacity: .3;
  object-fit: contain;
  pointer-events: none;
}
.hero.saldo .ghost-logo {
  right: -32px;
  top: auto;
  bottom: -40px;
  transform: none;
  height: 128px;
  width: 128px;
  opacity: .2;
}
.hero.saldo .wallet-badge { position: absolute; right: 20px; top: 24px; }
.hero .bal { font-size: 30px; }

/* Inicio: flujo normal, sin centrado flex que recorta el contenido */
.page-home {
  display: block !important;
  padding-bottom: 104px !important;
}
.page-home .hero { margin-bottom: 16px; }
.page-home .grid2.home-actions { margin-bottom: 0; }

/* ---------- 4. Identidad única de las tarjetas del inicio ---------- */
.grid2 .action.home-card,
.grid2 .action.home-card.card-gen,
.grid2 .action.home-card.card-models,
.grid2 .action.home-card.card-create,
.grid2 .action.home-card.card-wallet {
  border-radius: 20px;
  border: 1px solid color-mix(in oklab, var(--primary) 22%, var(--border));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 15%, transparent) 0%, transparent 60%),
    var(--card);
  box-shadow: 0 14px 30px -26px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05);
  transition: border-color .14s ease, background .14s ease;
}
.grid2 .action.home-card:hover,
.grid2 .action.home-card.card-gen:hover,
.grid2 .action.home-card.card-models:hover,
.grid2 .action.home-card.card-create:hover,
.grid2 .action.home-card.card-wallet:hover {
  border-color: color-mix(in oklab, var(--primary) 52%, transparent);
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 22%, transparent) 0%, transparent 60%),
    var(--card);
}
.grid2 .action.home-card .ico,
.grid2 .action.home-card.card-gen .ico,
.grid2 .action.home-card.card-models .ico,
.grid2 .action.home-card.card-create .ico,
.grid2 .action.home-card.card-wallet .ico {
  background-image: var(--gradient-primary) !important;
  color: var(--primary-foreground);
  border-radius: 15px;
  box-shadow:
    0 10px 22px -14px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .26) !important;
}
.grid2 .action.home-card .ico svg { width: 24px; height: 24px; stroke-width: 2; }

/* ---------- 5. Barra "Generar": flujo normal, nunca tapa el contenido ---------- */
.ai-gen-footer {
  position: static !important;
  bottom: auto !important;
  z-index: auto !important;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  background: none !important;
}
.ai-genbar.ai-receipt {
  background:
    radial-gradient(130% 120% at 50% -20%, color-mix(in oklab, var(--primary) 16%, transparent), transparent 58%),
    var(--card) !important;
  box-shadow: 0 18px 40px -30px rgb(0 0 0 / .95), inset 0 1px 0 rgb(255 255 255 / .05) !important;
}
@media (max-width: 820px) {
  .ai-genbar.ai-receipt { border-radius: 18px; }
  .ai-gen-wrap form { padding-bottom: 0; }
  .page { padding-bottom: 120px; }
}

/* ---------- 6. Topbar siempre visible ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--background);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.page { scroll-padding-bottom: 140px; }

/* ---------- 7. Pulido general ---------- */
.page-title h2 { letter-spacing: -.02em; }
.ai-plat-tile { box-shadow: 0 16px 34px -30px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05) !important; }
.ai-plat-tile .ai-avatar { box-shadow: 0 10px 22px -14px color-mix(in oklab, var(--primary) 80%, transparent), inset 0 2px 5px rgb(255 255 255 / .34), inset 0 -4px 9px rgb(0 0 0 / .30) !important; }
.card { border-radius: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ronda 9 · Ajustes de escritorio (mantener proporciones del hero) */
@media (min-width: 900px) {
  .hero { padding: 28px 32px; }
  .hero .bal { font-size: 38px; }
  .hero .ghost-logo { height: 190px; width: 190px; right: 16px; }
  .hero.saldo .ghost-logo { height: 128px; width: 128px; right: -32px; bottom: -40px; top: auto; transform: none; }
  .page-home { padding-bottom: 32px !important; }
  .page-home .hero { margin-bottom: 22px; }
}

/* =====================================================================
   Ronda 9 · Catálogo y generador con la misma identidad del inicio
   ===================================================================== */

/* Filas de modelo del catálogo (categorías públicas) */
.ai-modelrow {
  border-radius: 20px;
  border: 1px solid color-mix(in oklab, var(--primary) 20%, var(--border));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 13%, transparent) 0%, transparent 60%),
    var(--card);
  box-shadow: 0 14px 30px -28px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05);
  padding: 12px 14px;
  transition: border-color .14s ease, background .14s ease;
}
.ai-modelrow:hover {
  border-color: color-mix(in oklab, var(--primary) 48%, transparent);
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 20%, transparent) 0%, transparent 60%),
    var(--card);
}
.ai-modelrow .ai-avatar,
.ai-modelrow-open > .ai-avatar {
  border-radius: 15px !important;
  box-shadow:
    0 10px 22px -14px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .26) !important;
}
.ai-modelrow-name { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.ai-modelrow-sub { font-size: 11.5px; }
.ai-modelrow-price b { color: var(--primary-glow); font-size: 14.5px; }
.ai-modelrow .ai-fav { border-radius: 12px; }

/* Tarjeta del modelo dentro del generador */
.ai-modelcard {
  border-radius: 20px !important;
  border: 1px solid color-mix(in oklab, var(--primary) 20%, var(--border)) !important;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 13%, transparent) 0%, transparent 60%),
    var(--card) !important;
  box-shadow: 0 14px 30px -28px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05) !important;
}
.ai-modelcard .ai-avatar { border-radius: 15px !important; }

/* Filas de ajustes del generador, mismo lenguaje visual */
.ai-setrow {
  border-radius: 16px;
  border: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  background: color-mix(in oklab, var(--card) 92%, transparent);
  box-shadow: none !important;
}
.ai-setrow-ico {
  border-radius: 11px;
  background-image: var(--gradient-primary) !important;
  color: var(--primary-foreground) !important;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .24) !important;
}
.ai-setrow:hover { background: color-mix(in oklab, var(--primary) 7%, var(--card)); }

/* Precio "desde" en el catálogo (rango real según calidad) */
.ai-modelrow-price .ai-modelrow-from {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  line-height: 1;
}

/* ---------- 8. Cobro por tokens: consumo estimado + aviso ---------- */
.ai-receipt-token {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted-foreground);
}
.ai-receipt-token[hidden] { display: none; }
.ai-receipt-token span {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 9.5px;
  font-weight: 800;
  opacity: .85;
}
.ai-receipt-token b {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--foreground);
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 13%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 26%, transparent);
}
.ai-token-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 16px;
  background: color-mix(in oklab, var(--primary) 8%, var(--card));
  border: 1px solid color-mix(in oklab, var(--primary) 20%, transparent);
}
.ai-token-hint[hidden] { display: none; }
.ai-token-hint b {
  font-size: 12px;
  font-weight: 800;
  color: color-mix(in oklab, var(--primary) 82%, var(--foreground));
  letter-spacing: -.01em;
}
.ai-token-hint span {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted-foreground);
  font-weight: 500;
}
@media (max-width: 820px) {
  .ai-receipt-token { margin-top: 6px; }
  .ai-token-hint { border-radius: 14px; padding: 10px 12px; }
}

/* ---------- 9. Categorías del catálogo con la identidad de Inicio ---------- */
.ai-plat-grid { gap: 12px; }
.ai-plat-tile {
  border-radius: 20px !important;
  border: 1px solid color-mix(in oklab, var(--primary) 22%, var(--border)) !important;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 15%, transparent) 0%, transparent 60%),
    var(--card) !important;
  box-shadow: 0 14px 30px -26px rgb(0 0 0 / .9), inset 0 1px 0 rgb(255 255 255 / .05) !important;
  transition: border-color .14s ease, background .14s ease, transform .08s ease !important;
}
.ai-plat-tile:hover {
  border-color: color-mix(in oklab, var(--primary) 52%, transparent) !important;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 22%, transparent) 0%, transparent 60%),
    var(--card) !important;
}
.ai-plat-tile .ai-avatar {
  background-image: var(--gradient-primary) !important;
  color: var(--primary-foreground) !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 22px -14px color-mix(in oklab, var(--primary) 85%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .26) !important;
}
.ai-plat-tile .t { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.ai-plat-tile .m { color: var(--muted-foreground); font-weight: 600; }

/* Encabezado de categoría: mismo lenguaje visual que las tarjetas de Inicio */
.ai-cat-head {
  padding: 10px 12px;
  margin: 20px 0 10px;
  border-radius: 16px;
  border: 1px solid color-mix(in oklab, var(--primary) 18%, var(--border));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in oklab, var(--primary) 12%, transparent) 0%, transparent 65%),
    var(--card);
}
.ai-cat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background-image: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .24);
}
.ai-cat-name { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.ai-cat-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--primary-glow);
  background: color-mix(in oklab, var(--primary) 15%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 26%, transparent);
}

/* =====================================================================
   Ronda 11 · Vista previa (CTA verde) + modales sin cortes + aviso suave
   ===================================================================== */
.ai-preview-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  cursor: pointer;
  color: oklch(0.86 0.16 150);
  background: color-mix(in oklab, oklch(0.62 0.16 150) 16%, var(--card));
  border: 1px solid color-mix(in oklab, oklch(0.62 0.16 150) 45%, transparent);
  box-shadow: 0 8px 22px -16px oklch(0.55 0.18 150);
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.ai-preview-cta:hover { border-color: oklch(0.68 0.17 150); background: color-mix(in oklab, oklch(0.62 0.16 150) 22%, var(--card)); }
.ai-preview-cta:active { transform: scale(.995); }
.ai-preview-cta-ico {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: oklch(0.62 0.16 150);
  color: #04120a;
}
.ai-preview-cta-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.ai-preview-cta-txt b { font-size: 13px; font-weight: 800; color: oklch(0.9 0.12 150); }
.ai-preview-cta-txt small { font-size: 10.5px; color: color-mix(in oklab, oklch(0.86 0.12 150) 72%, var(--muted-foreground)); }
.ai-preview-cta-chev { flex: none; color: oklch(0.8 0.13 150); }

/* Aviso de consumo: verde suave, sin jerga técnica */
.ai-token-hint {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  line-height: 1.45;
  color: color-mix(in oklab, oklch(0.82 0.12 150) 80%, var(--muted-foreground));
  background: color-mix(in oklab, oklch(0.62 0.16 150) 12%, transparent);
  border: 1px solid color-mix(in oklab, oklch(0.62 0.16 150) 32%, transparent);
}
.ai-token-hint[hidden] { display: none; }
.ai-token-hint b { font-size: 12px; font-weight: 800; color: oklch(0.86 0.14 150); }

/* Modales/bottom sheet: nada queda cortado (safe-area + aire al final) */
.ai-cfg-sheet { max-height: calc(100dvh - 24px); }
.ai-cfg-body { padding-bottom: 18px; scroll-padding-bottom: 24px; }
.ai-cfg-foot { padding-bottom: max(2px, env(safe-area-inset-bottom)); }
.admin-modal-sheet { max-height: calc(100dvh - 20px); }
@media (max-width: 820px) {
  .ai-cfg-backdrop { padding: 8px; }
  .ai-cfg-sheet { max-height: calc(100dvh - 16px); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .admin-modal-sheet { max-height: calc(100dvh - 16px); }
}

/* ============================================================
   Aviso de instalación / push  vs.  burbuja de asistencia
   ------------------------------------------------------------
   El globito del asistente tapaba la "×" del cartel de instalar.
   Ahora el cartel siempre queda por encima y, cuando está visible,
   el asistente se corre hacia arriba para no chocar nunca.
   ============================================================ */
.install-prompt { z-index: 90; }
.install-prompt .x {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: color-mix(in oklab, var(--secondary) 88%, transparent);
  color: var(--foreground);
  font-size: 18px; font-weight: 700; line-height: 1;
  cursor: pointer;
  position: relative; z-index: 2;
  transition: background .14s ease, transform .14s ease;
}
.install-prompt .x:hover { background: color-mix(in oklab, var(--primary) 28%, var(--secondary)); transform: scale(1.06); }
.install-prompt .x:active { transform: scale(.94); }

@media (max-width: 760px) {
  body.has-install-prompt .fx-assist,
  body:has(.install-prompt) .fx-assist {
    bottom: calc(96px + 92px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   Cintita violeta minimizada del asistente (arrastrable)
   ------------------------------------------------------------
   Al cerrar el panel, el asistente queda como una cintita fina
   pegada al borde derecho. Se puede arrastrar con el dedo/dedo-
   mouse y al tocarla vuelve a abrir. Al cerrarla con la "×"
   vuelve siempre a su posición original (centro del borde).
   ============================================================ */
.fx-assist-mini {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 66px;
  padding: 0;
  border: 0;
  border-radius: 13px 0 0 13px;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 72;
  background: linear-gradient(180deg, #b79bff 0%, var(--primary) 55%, #4d2596 100%);
  box-shadow: -5px 0 16px rgb(109 40 217 / .45), inset 0 1px 0 rgb(255 255 255 / .4), inset 0 -3px 8px rgb(0 0 0 / .25);
  transition: box-shadow .16s ease, width .16s ease;
}
.fx-assist-mini[hidden] { display: none !important; }
.fx-assist-mini:hover { width: 30px; box-shadow: -7px 0 22px rgb(109 40 217 / .6), inset 0 1px 0 rgb(255 255 255 / .45); }
.fx-assist-mini.dragging { cursor: grabbing; width: 30px; transition: none; }
.fx-assist-mini svg { pointer-events: none; }
.fx-assist-mini .fx-mini-dot {
  position: absolute;
  top: 6px; left: 50%;
  width: 6px; height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 7px #4ade80;
  pointer-events: none;
}
/* Mientras se arrastra, el globito/panel no debe capturar el puntero. */
.fx-assist.is-mini .fx-assist-btn,
.fx-assist.is-mini .fx-assist-panel { display: none !important; }
