@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Graduate&display=swap');

/* Mismas tipografías que se queman en los subtítulos del Editor de Video
   (assets/fonts, servidas también en public/fonts) — así el selector de
   estilo las puede mostrar en su letra real, no solo el nombre. */
@font-face { font-family: 'Poppins'; src: url('/fonts/Poppins-Bold.ttf') format('truetype'); font-weight: 700; }
@font-face { font-family: 'Bebas Neue'; src: url('/fonts/BebasNeue-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat.ttf') format('truetype'); }
@font-face { font-family: 'Anton'; src: url('/fonts/Anton-Regular.ttf') format('truetype'); }

:root,
:root[data-theme="dark"] {
  --bg: #0B0F19;
  --card: #12172a;
  --border: #232a42;
  --text: #f5f5f7;
  --muted: #8b8fa3;
  --indigo: #4F46E5;
  --purple: #A855F7;
  --input-bg: #0d1220;
  --hover-overlay: rgba(255, 255, 255, 0.04);
  --status-error: #f87171;
  --status-success: #86efac;
  --status-warning: #fbbf24;
  --badge-app-bg: rgba(79, 70, 229, 0.2);
  --badge-app-text: #a5b4fc;
  --badge-ig-bg: rgba(168, 85, 247, 0.2);
  --badge-ig-text: #d8b4fe;
  --badge-manual-bg: rgba(255, 255, 255, 0.08);
}

/* Modo claro — minimalista y blanco, no solo un degradado de marca sobre fondo
   oscuro. Especificidad [data-theme="light"] > :root plano, así siempre gana
   incluso sobre el <style> con --bg de marca que el servidor inyecta por cliente. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f7f7f9;
  --border: #e4e4e8;
  --text: #14161f;
  --muted: #6b7280;
  --input-bg: #ffffff;
  --hover-overlay: rgba(0, 0, 0, 0.04);
  --status-error: #dc2626;
  --status-success: #16a34a;
  --status-warning: #d97706;
  --badge-app-bg: rgba(79, 70, 229, 0.12);
  --badge-app-text: #4338ca;
  --badge-ig-bg: rgba(168, 85, 247, 0.12);
  --badge-ig-text: #7e22ce;
  --badge-manual-bg: rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.layout {
  min-height: 100vh;
  padding-left: 220px; /* espacio reservado para el sidebar, que ahora es fixed */
}

/* Fijo al viewport (no a la altura del contenido) — si no, cuando una vista es
   muy larga, flexbox estira el sidebar a esa misma altura y el hueco antes del
   footer (créditos/tema/usuario) se alarga muchísimo. Con position:fixed el
   sidebar siempre mide exactamente 100vh sin importar cuánto contenido tenga
   la vista activa. */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-header {
  padding: 0 4px 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-greeting {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--hover-overlay); color: var(--text); }

.nav-item.active {
  background: var(--badge-app-bg);
  border-color: rgba(79, 70, 229, 0.35);
  color: var(--indigo);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 4px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.logout-link {
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 999px;
  color: var(--status-error);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.logout-link:hover { background: rgba(248, 113, 113, 0.25); }

.theme-toggle {
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.theme-toggle:hover { border-color: var(--indigo); }

.credits-indicator {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.credits-indicator.low { color: var(--status-error); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  width: 100%;
}
/* Estadísticas necesita más ancho que el resto de vistas para que el scatter
   y el heatmap quepan lado a lado sin quedar apretados. */
.content:has(#statsView:not(.hidden)) { max-width: 1180px; }

.view.hidden { display: none; }

.logo {
  font-size: 19px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.25;
  margin: 0;
  padding: 0 4px;
}

.grad {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.muted { color: var(--muted); font-weight: 400; }

textarea, input[type="text"], input[type="password"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px;
  resize: vertical;
  margin-bottom: 16px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 15px;
}

select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px;
  margin-bottom: 16px;
}

/* ---------- Selector de estilo con vista previa real de la tipografía ---------- */
.font-picker { position: relative; margin-bottom: 16px; }
.font-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px;
  margin: 0;
  cursor: pointer;
}
.font-picker-chevron { color: var(--muted); font-size: 18px; }
.font-picker-menu {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.25);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.font-picker-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 19px;
  color: var(--text);
}
.font-picker-option:hover { background: var(--hover-overlay); }
.font-picker-option .muted { font-size: 16px; flex-shrink: 0; }

/* ---------- Búsqueda de música: barra + resultados como un solo bloque ---------- */
.music-search-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.music-search-bar {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.music-search-bar input[type="text"] {
  flex: 1;
  margin: 0;
  border: none;
  background: transparent;
  padding: 8px 10px;
}
.music-search-bar input[type="text"]:focus { outline: none; }
.music-search-bar button { margin: 0; flex-shrink: 0; }
#musicSearchResults { max-height: 280px; overflow-y: auto; }
#musicSearchResults:empty { display: none; }
.music-search-box:has(#musicSearchResults:empty) .music-search-bar { border-bottom: none; }
#musicSearchResults .list-row { padding: 10px 14px; margin: 0; border-radius: 0; }
#musicSearchResults .list-row:last-child { border-bottom: none; }

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.list-row:last-child { border-bottom: none; }
.list-row .meta { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
}

.badge.app { background: var(--badge-app-bg); color: var(--badge-app-text); }
.badge.manual { background: var(--badge-manual-bg); color: var(--muted); }
.badge.instagram { background: var(--badge-ig-bg); color: var(--badge-ig-text); }
.badge.facebook { background: var(--badge-app-bg); color: var(--badge-app-text); }

.agg-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.agg-row:last-child { border-bottom: none; }

.agg-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.agg-bar-track {
  background: var(--input-bg);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}

.agg-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--purple));
  border-radius: 8px;
}

/* Fila de "adjuntos" del generador de post: un botón + que abre un menú con
   opciones (hoy solo la foto de producto; con el tiempo se le irán sumando
   más ahí mismo, sin necesitar más espacio permanente en el formulario). */
.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 16px;
  position: relative;
}
.attach-trigger-wrap { position: relative; }
.attach-trigger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.attach-trigger:hover {
  border-color: var(--indigo);
  color: var(--indigo);
}
.attach-trigger.open { transform: rotate(45deg); }

.attach-menu {
  position: absolute;
  top: 42px;
  left: 0;
  z-index: 20;
  min-width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
}
.attach-menu-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.attach-menu-item:hover { background: var(--hover-bg, rgba(127, 127, 127, 0.1)); }
.attach-menu-icon { font-size: 18px; line-height: 1.3; }
.attach-menu-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.attach-menu-desc {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.attach-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.attach-chip img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 50%;
}
.attach-chip-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  line-height: 1;
}
.attach-chip-remove:hover { color: var(--status-error); }

.carousel-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
  flex-wrap: wrap;
}
.carousel-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}
.carousel-toggle input { accent-color: var(--indigo); }
#carouselSlideCount { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label { font-size: 13px; }

.date-range-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.date-range-custom input[type="date"] {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
}
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
.kpi-value { font-size: 28px; font-weight: 800; }
.kpi-variation {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-height: 16px;
}
.kpi-variation .inline-icon { width: 14px; height: 14px; }
.kpi-variation.positive { color: var(--status-success); }
.kpi-variation.negative { color: var(--status-error); }

.heatmap-wrap { overflow-x: auto; }
.heatmap-grid {
  display: grid;
  grid-template-columns: 56px repeat(var(--heatmap-cols, 7), minmax(44px, 1fr));
  gap: 4px;
  min-width: 480px;
}
.heatmap-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-align: center;
  padding-bottom: 4px;
}
.heatmap-time-label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: default;
}
.heatmap-cell.empty {
  background: transparent;
  border-style: dashed;
  opacity: 0.4;
}

.scatter-legend {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.scatter-legend-item { display: flex; align-items: center; gap: 6px; }
.scatter-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.scatter-legend-line {
  width: 16px;
  height: 0;
  border-top: 2px dashed var(--purple);
  flex-shrink: 0;
}

.scatter-chart-inner { position: relative; }
.scatter-tooltip {
  position: absolute;
  z-index: 10;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 260px;
  padding: 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 12px;
}
.scatter-tooltip-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.scatter-tooltip-date { color: var(--muted); margin-bottom: 3px; }
.scatter-tooltip-caption {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.scatter-tooltip-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--indigo);
  font-weight: 700;
  text-decoration: none;
}
.scatter-tooltip-link .inline-icon { width: 12px; height: 12px; }

.stats-columns {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}
/* Cada columna es su propio contenedor de cards apiladas — el margin-bottom
   que ya trae .card se encarga del espacio vertical entre ellas, así que acá
   no hace falta gap. */
.stats-column { min-width: 0; }

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

.filter-chip {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  color: white;
  border-color: transparent;
}

.boost-link {
  margin: 0 0 0 10px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.boost-link:hover { border-color: var(--purple); }

/* ---------- Tabla de "Todos los posts" (Estadísticas) ---------- */
.posts-table-wrap {
  overflow-x: auto;
  /* Wide enough (miniatura + varias columnas) para desbordar en pantallas
     angostas — se envuelve en su propio scroller para que la página nunca
     tenga que hacer scroll horizontal completo. */
}
.posts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.posts-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.posts-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.posts-table tbody tr:hover { background: var(--hover-overlay); }
.posts-table tbody tr:last-child td { border-bottom: none; }

.posts-table-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.posts-table-thumb img,
.posts-table-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.posts-table-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.posts-table-thumb-placeholder .inline-icon { width: 18px; height: 18px; }

.posts-table-content {
  max-width: 320px;
  min-width: 180px;
}
.posts-table-caption {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.posts-table-caption a { color: inherit; }
.posts-table-topic {
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#postsEmptyState { margin-top: 12px; }

textarea:focus, button:focus {
  outline: 2px solid var(--indigo);
  outline-offset: 1px;
}

button {
  margin-top: 16px;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  color: white;
}

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

/* Spinner universal para cualquier botón en curso (ver withLoading en
   utils.js) — funciona igual para un botón de solo texto que para uno con
   ícono SVG (stroke="currentColor"), porque ambos quedan invisibles con
   color:transparent y el spinner usa un color fijo, no currentColor. */
.btn-loading {
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 15px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-loading-spin 0.6s linear infinite;
}
/* Blanco funciona sobre el degradado indigo/púrpura de un botón normal, pero
   un botón "secondary"/ícono es transparente — se ve sobre el fondo de la
   página (blanco en modo claro), donde un spinner blanco desaparecería. */
button.secondary.btn-loading::after,
.icon-btn.btn-loading::after,
.cancel-link.btn-loading::after {
  border-color: rgba(79, 70, 229, 0.25);
  border-top-color: var(--indigo);
}
@keyframes btn-loading-spin {
  to { transform: rotate(360deg); }
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.status {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  white-space: pre-wrap;
}

.status.error { color: var(--status-error); }
.status.success { color: var(--status-success); }
.status.warning { color: var(--status-warning); }

/* Icono inline junto al texto de estado/botones — mismo estilo de trazo que
   la barra de navegación (ver public/js/icons.js), en vez de emojis. */
.inline-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  flex-shrink: 0;
}
.status-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 6px;
}
.status-icon svg { width: 100%; height: 100%; }

.hidden { display: none !important; }

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: 28px;
}

#previewVideo {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  aspect-ratio: 1080 / 1350;
  object-fit: cover;
}

/* ---------- Mockup de vista previa (Instagram / Facebook) ----------
   Siempre con la estética real de cada red (tarjeta blanca, tipografía y
   colores propios) independiente del tema claro/oscuro del panel — igual
   criterio que el login, para que se vea creíble como si fuera la app real. */
.post-mockup { display: flex; flex-direction: column; gap: 10px; }

.mockup-tabs { display: flex; gap: 8px; }
.mockup-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.mockup-tab.active {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  color: white;
  border-color: transparent;
}

.mockup-frame {
  background: #ffffff;
  color: #14161f;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  overflow: hidden;
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.mockup-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

/* Contenedor de la imagen — cuando es un carrusel, guarda varias <img> apiladas
   (una visible a la vez vía .active) más flechas y puntos de navegación; en un
   post normal solo tiene la única imagen ya existente, sin flechas/puntos. */
.mockup-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 1080 / 1350;
  overflow: hidden;
}
.mockup-slider img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin: 0;
  border: none;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mockup-slider img.active { opacity: 1; pointer-events: auto; cursor: zoom-in; }

/* Fondo blanco sólido + sombra en vez de negro translúcido — sobre diseños
   oscuros (el caso más común) un círculo negro semi-transparente casi no se
   distinguía del fondo de la imagen. */
.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #14161f;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.slider-arrow:hover { background: #ffffff; transform: translateY(-50%) scale(1.08); }
.slider-arrow.slider-prev { left: 10px; }
.slider-arrow.slider-next { right: 10px; }

.slider-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.slider-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  border: none;
  padding: 0;
  cursor: pointer;
}
.slider-dots .dot.active { background: #ffffff; }

/* Vista ampliada al hacer clic en la imagen del mockup — un overlay simple,
   sin nombre "modal" a secas para no repetir el choque de CSS que ya tuvimos
   con .avatar-modal vs .modal en otra parte del panel. */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}
.image-lightbox img,
.image-lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Verde de WhatsApp a propósito (no es decorativo): ayuda a reconocer de un
   vistazo que este botón lleva específicamente ahí, distinto de "Publicar". */
.lightbox-share-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: #25d366;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.lightbox-share-btn:hover { background: #1fb959; }
.lightbox-share-btn .inline-icon { width: 18px; height: 18px; }

/* Pantalla completa gris mientras se genera — un esqueleto animado con la
   forma de un post (avatar + imagen + líneas de texto) en vez de un spinner
   genérico, para que no se "pierda la idea" de qué se está armando. */
.generate-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
}
.generate-overlay-card {
  width: 100%;
  max-width: 280px;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-header { display: flex; align-items: center; gap: 10px; }
.skeleton {
  background: linear-gradient(90deg, #e4e4e8 25%, #f2f2f5 37%, #e4e4e8 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-line { height: 12px; border-radius: 6px; }
.skeleton-image { width: 100%; aspect-ratio: 1080 / 1350; border-radius: 10px; }
.skeleton-video { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; }
.avatar-generate-overlay-card { max-width: 220px; }
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.generate-overlay-text {
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  max-width: 320px;
  margin: 0;
}

/* -- Instagram -- */
.ig-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ig-header-text { flex: 1; min-width: 0; }
.ig-username { font-size: 13px; font-weight: 700; color: #14161f; }
.ig-more { color: #262626; font-weight: 700; padding: 0 4px; }
.ig-icons { display: flex; align-items: center; gap: 14px; padding: 10px 12px 4px; font-size: 20px; }
.ig-icons .ig-bookmark { margin-left: auto; font-size: 17px; }
.ig-likes { padding: 4px 12px 4px; font-size: 13px; font-weight: 700; }
.ig-caption {
  padding: 0 12px 4px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.ig-caption b { margin-right: 4px; }
.ig-comments { padding: 2px 12px 12px; font-size: 12.5px; color: #8e8e8e; }

/* -- Facebook -- */
.fb-header { display: flex; align-items: center; gap: 10px; padding: 12px; }
.fb-header-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fb-username { font-size: 14px; font-weight: 700; color: #050505; }
.fb-timestamp { font-size: 12px; color: #65676b; }
.fb-more { color: #65676b; font-weight: 700; padding: 0 4px; }
.fb-caption {
  padding: 0 12px 10px;
  font-size: 14px;
  line-height: 1.4;
  color: #050505;
  word-break: break-word;
}

/* Recorte "Ver más" — puramente visual (no despliega nada al hacer clic),
   solo para que el mockup no muestre el caption completo sin cortar. */
.caption-see-more { color: #65676b; font-weight: 700; }
.fb-reactions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #65676b;
  border-bottom: 1px solid #ced0d4;
  white-space: nowrap;
}
.fb-reaction-icons { font-size: 13px; flex-shrink: 0; }
.fb-reaction-count { flex-shrink: 0; }
.fb-comments-count { margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.fb-action-row { display: flex; }
.fb-action-row span {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #65676b;
}

.preview-side {
  display: flex;
  flex-direction: column;
}

.preview-side textarea {
  flex: 1;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

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

/* Video con presentador IA (HeyGen) — vertical 9:16, distinto del post 4:5 */
#previewAvatarVideo {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #000;
}

/* Selector de avatar en Configuración */
.avatar-picker-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.avatar-picker-current img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Prefijo avatar- para no chocar con .modal/.modal-content ya usados por el
   modal del calendario (ese usa .modal-backdrop como overlay) — esa colisión
   de nombres hacía que este modal se viera siempre, sin importar .hidden,
   porque esta regla .modal quedaba después en la cascada y ganaba el empate. */
.avatar-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.avatar-modal.hidden { display: none; }

.avatar-modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: min(900px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.avatar-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.avatar-card {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease;
}

.avatar-card:hover {
  border-color: #4F46E5;
}

.avatar-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fff;
}

.avatar-card span {
  font-size: 12px;
  color: var(--muted);
}

/* Calendario */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 18px;
  text-transform: capitalize;
}

button.small {
  margin-top: 0;
  padding: 8px 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 6px;
}

.calendar-day {
  min-height: 84px;
  min-width: 0; /* los tracks de grid con 1fr no se encogen bajo el ancho de su contenido si no se fija esto explícito — sin esto, un tema largo estiraba toda la columna */
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-day:hover { border-color: var(--indigo); }
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today { border-color: var(--purple); }
.calendar-day.past { opacity: 0.4; cursor: not-allowed; }
.calendar-day.past:hover { border-color: var(--border); }

.calendar-day-number {
  font-size: 13px;
  font-weight: 700;
}

.calendar-event {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  border-radius: 6px;
  padding: 2px 6px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0; /* mismo motivo que .calendar-day — es flex item de su columna */
}
.calendar-event-icon { width: 10px; height: 10px; flex-shrink: 0; }
.calendar-event-icon svg { width: 100%; height: 100%; }

.calendar-event.pending { background: #6366f1; }
.calendar-event.running { background: #a855f7; }
.calendar-event.done { background: #16a34a; }
.calendar-event.failed { background: #dc2626; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 { margin-top: 0; }

input[type="time"] {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.day-events {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.day-events h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); }

.day-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.cancel-link {
  color: var(--status-error);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  background: none;
  border: none;
  margin: 0;
  padding: 0;
}

/* ---------- Feed tipo Instagram de "lo que ha creado tu negocio" ---------- */
.created-feed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.created-feed-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: zoom-in;
  padding: 0;
  margin: 0;
}
.created-feed-item:hover { border-color: var(--indigo); }
.created-feed-item img,
.created-feed-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.created-feed-carousel-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 14px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.created-feed-delete-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.created-feed-item:hover .created-feed-delete-btn { opacity: 1; }
.created-feed-delete-btn:hover { background: var(--status-error); }
.created-feed-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
}
.created-feed-pager button:disabled { opacity: 0.35; cursor: default; }

@media (max-width: 560px) {
  .created-feed-grid { grid-template-columns: repeat(2, 1fr); }
}

.product-photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  max-width: 340px;
}
.product-photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.product-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(11, 15, 25, 0.7);
  color: white;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.product-photo-delete-btn .inline-icon { width: 14px; height: 14px; }
.product-photo-item:hover .product-photo-delete-btn { opacity: 1; }

/* ---------- Rediseño del popup de programar (selector de tipo + lista del día) ---------- */
.schedule-type-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 4px 0 20px;
}
.schedule-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--input-bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.schedule-type-card:hover { border-color: var(--indigo); }
.schedule-type-card.active {
  border-color: var(--indigo);
  color: var(--text);
  background: var(--badge-app-bg);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
}
.schedule-type-icon { font-size: 22px; }
.schedule-type-label { line-height: 1.2; }

.day-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.day-event-row:last-child { border-bottom: none; }
.day-event-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.day-event-info-editable { cursor: pointer; border-radius: 6px; }
.day-event-info-editable:hover { background: var(--hover-overlay); }
.day-event-icon { width: 15px; height: 15px; flex-shrink: 0; }
.day-event-icon svg { width: 100%; height: 100%; }
.day-event-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-event-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  color: white;
  flex-shrink: 0;
}
.day-event-status.pending { background: #6366f1; }
.day-event-status.running { background: #a855f7; }
.day-event-status.done { background: #16a34a; }
.day-event-status.failed { background: #dc2626; }
.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn .inline-icon { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); background: var(--hover-overlay); }

@media (max-width: 480px) {
  .schedule-type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Panel de "Generar" rediseñado (prompt + tarjetas de acción) ---------- */
.prompt-card { padding-bottom: 24px; }

.quota-line {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.avatar-hero-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 20px;
  margin-bottom: 16px;
}

.avatar-video-desc { margin-bottom: 4px; }

.script-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.script-mode-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.script-mode-btn.active {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--badge-app-bg);
}
.script-mode-hint { margin: -8px 0 16px; font-size: 12px; }

.modal-card.layout-picker-modal-card.avatar-voice-picker-card { max-width: 1040px; }

.avatar-voice-picker-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  gap: 24px;
}

.avatar-voice-picker-column label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.avatar-voice-picker-column .avatar-grid,
.avatar-voice-picker-column .voice-list {
  max-height: 360px;
}

@media (max-width: 860px) {
  .avatar-voice-picker-columns { grid-template-columns: 1fr; }
}

.avatar-bg-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--input-bg);
  margin-bottom: 8px;
}
.avatar-bg-preview-color,
.avatar-bg-preview-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-bg-preview-color { background: var(--indigo); }
.avatar-bg-preview-avatar {
  position: absolute;
  bottom: 0;
  left: 5%;
  width: 90%;
  height: auto;
  max-height: 92%;
  object-fit: contain;
  object-position: bottom;
}
.avatar-bg-hint { font-size: 11px; margin: 0 0 10px; }
.link-btn {
  background: none;
  border: none;
  color: var(--indigo);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0 0;
  text-align: left;
}

.voice-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 8px;
}

#voiceoverVoicePickerList { max-height: 360px; }
.voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.voice-row:last-child { border-bottom: none; }
.voice-row:hover { background: var(--hover-overlay); }
.voice-row.selected { background: var(--badge-app-bg); color: var(--indigo); font-weight: 700; }

.voice-preview-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.voice-preview-btn:hover { border-color: var(--indigo); color: var(--indigo); }

.avatar-card.selected { border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25); }
.avatar-card.avatar-card-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.avatar-card-default-icon { font-size: 28px; margin-bottom: 6px; }

.eyebrow {
  color: var(--indigo);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 4px;
}

.hero-heading {
  font-family: 'Graduate', serif;
  font-size: 30px;
  font-weight: 400;
  margin: 0 0 20px;
  color: var(--text);
}

.prompt-box {
  position: relative;
  border: 1px solid var(--indigo);
  border-radius: 20px;
  padding: 18px 60px 18px 20px;
  margin-bottom: 16px;
}
.prompt-box textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font: inherit;
  color: var(--text);
  padding: 0;
}
.prompt-box textarea:focus { outline: none; }
.prompt-submit {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.prompt-submit:hover { border-color: var(--indigo); color: var(--indigo); }

/* ---------- Editor de Video: mockup con adjuntos + miniaturas + formato ---------- */
.video-upload-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.video-upload-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.video-upload-trigger:hover { border-color: var(--indigo); color: var(--indigo); }
.video-upload-trigger svg { width: 18px; height: 18px; flex-shrink: 0; }

.video-clip-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  min-width: 160px;
}

.video-clip-thumb {
  position: relative;
  width: 68px;
  border: 2px solid var(--clip-color, var(--border));
  border-radius: 10px;
  overflow: hidden;
  background: var(--input-bg);
  display: flex;
  flex-direction: column;
}
.video-clip-thumb-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
}
.video-clip-thumb-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-clip-thumb-number {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-clip-thumb-name {
  font-size: 9px;
  color: var(--muted);
  padding: 3px 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-clip-thumb-controls {
  display: flex;
  justify-content: space-between;
  padding: 2px 3px 3px;
  gap: 2px;
}
.video-clip-thumb-controls button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 2px 0;
  border-radius: 4px;
}
.video-clip-thumb-controls button:hover:not(:disabled) { background: var(--hover-overlay); color: var(--text); }
.video-clip-thumb-controls button:disabled { opacity: 0.3; cursor: default; }

.video-format-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.video-format-icons { display: flex; gap: 6px; }
.format-icon-btn {
  width: 36px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.format-icon-btn svg { width: 20px; height: 20px; }
.format-icon-btn:hover { border-color: var(--indigo); }
.format-icon-btn.active { border-color: var(--text); color: var(--text); border-width: 2px; }
.video-format-label { font-size: 11px; }

.video-clips-hint { font-size: 12px; margin: 0 0 20px; }

/* ---------- Extracción de "mejores momentos" desde video crudo largo ---------- */
.highlights-gallery-list { display: flex; flex-direction: column; gap: 16px; }
.highlight-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.highlight-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.highlight-card-time { font-size: 12px; font-weight: 700; color: var(--indigo); }
.highlight-card-title { font-size: 15px; font-weight: 700; margin: 4px 0; }
.highlight-card-reason { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.highlight-card-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.highlight-card-result video { max-width: 280px; border-radius: 14px; border: 1px solid var(--border); }

.video-options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}
.video-option-col label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pill-input {
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--indigo);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.pill-input:focus { outline: none; }
.pill-input::placeholder { color: var(--muted); }

.pill-dropdown .font-picker-trigger { border-radius: 999px; border-color: var(--indigo); }

.voiceover-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--indigo); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

.prompt-generate-btn {
  padding: 12px 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--purple) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.prompt-generate-btn:hover { opacity: 0.92; }
.prompt-generate-btn:disabled { opacity: 0.6; cursor: default; }

.pill-row .pill-chip {
  padding: 8px 18px;
  border-radius: 999px;
}

/* Modal para elegir plantilla (se abre al darle a la flecha de "Generar") */
.modal-card.layout-picker-modal-card {
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
}
.layout-picker-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.layout-picker-modal-header h3 { margin: 0 0 4px; }
.layout-picker-slide-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.layout-picker-slide-count-row label { font-size: 13px; font-weight: 600; margin: 0; }
.layout-picker-slide-count-row select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.layout-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.layout-picker-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}
.layout-picker-card:hover { border-color: var(--indigo); }
.layout-picker-card.selected { border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25); }
.layout-picker-preview {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}
.layout-picker-preview iframe {
  width: 1080px;
  height: 1350px;
  border: none;
  pointer-events: none;
  transform: scale(0.139);
  transform-origin: top left;
}
.layout-picker-random {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--bg);
}
.layout-picker-label {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: var(--text);
}
.layout-picker-sublabel {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}
.layout-picker-see-more {
  display: block;
  margin: 16px 0 0 auto;
  background: none;
  border: none;
  color: var(--indigo);
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.action-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.action-card-wrap { position: relative; }
.action-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  color: #14161f;
  transition: border-color 0.15s;
}
.action-card:hover { border-color: var(--indigo); }
.action-card-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 4px;
  background: #ffffff;
}
.action-card-title {
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #14161f;
}
.action-card-desc {
  font-family: 'Graduate', serif;
  font-size: 13px;
  color: #4b4f5c;
  line-height: 1.4;
}
.action-card-wrap .attach-menu { top: calc(100% + 8px); left: 0; right: 0; }

/* Modal genérico (hoy solo lo usa el carrusel, pero sirve para cualquier otro
   flujo que necesite una decisión rápida antes de generar). */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(11, 15, 25, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.modal-card h3 { margin: 0 0 6px; }
.modal-card select {
  width: 100%;
  margin: 14px 0 20px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
