/* =====================================================================
   Camilo Marketing IA — sistema de diseño
   Copia del de El Ruso AI Studio con otra paleta (pedido del 2026-10-08):
   el dorado pasa a VERDE y el crema/pastel a BLANCO. Oscuro: negro, grises
   neutros y verde. Las variables conservan el nombre --gold* para no tocar
   cada regla: hoy valen verde.
   Oscuro por defecto; claro con [data-theme="light"] en <html>.
   ===================================================================== */

:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --surface: #171717;
  --surface-2: #1f1f1f;
  --surface-3: #282828;
  --border: #2a2a2a;
  --border-strong: #3d3d3d;
  --text: #f5f5f5;
  --text-muted: #a8a8a8;
  --text-faint: #8a8a8a;
  --gold: #4ade80;
  --gold-strong: #86efac;
  --gold-soft: rgba(74, 222, 128, 0.12);
  --gold-line: rgba(74, 222, 128, 0.35);
  --cta-bg: #22c55e;
  --cta-bg-hover: #4ade80;
  --cta-text: #04210f;
  --emerald: #2dd4bf;
  --emerald-soft: rgba(45, 212, 191, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --info: #93c5fd;
  --info-soft: rgba(147, 197, 253, 0.12);
  --overlay: rgba(0, 0, 0, 0.78);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --glow: 0 0 0 1px var(--gold-line), 0 8px 32px rgba(74, 222, 128, 0.12);

  --font-display: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --font-ui: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Escala de z-index */
  --z-sticky: 10;
  --z-nav: 20;
  --z-dropdown: 30;
  --z-modal: 50;
  --z-toast: 60;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f6f5;
  --surface-3: #eaecea;
  --border: #e4e6e4;
  --border-strong: #cfd3d0;
  --text: #111312;
  --text-muted: #4a514d;
  --text-faint: #69716c;
  /* Verde OSCURO para texto sobre blanco (5,0:1); el verde vivo, solo de relleno. */
  --gold: #15803d;
  --gold-strong: #166534;
  --gold-soft: rgba(22, 163, 74, 0.1);
  --gold-line: rgba(21, 128, 61, 0.35);
  --cta-bg: #22c55e;
  --cta-bg-hover: #16a34a;
  --cta-text: #04210f;
  --emerald: #0f766e;
  --emerald-soft: rgba(15, 118, 110, 0.1);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --warning: #a16207;
  --warning-soft: rgba(202, 138, 4, 0.12);
  --info: #1d4ed8;
  --info-soft: rgba(29, 78, 216, 0.08);
  --overlay: rgba(17, 19, 18, 0.55);
  --shadow-sm: 0 1px 2px rgba(17, 19, 18, 0.06);
  --shadow-md: 0 8px 24px rgba(17, 19, 18, 0.08);
  --shadow-lg: 0 24px 64px rgba(17, 19, 18, 0.16);
  --glow: 0 0 0 1px var(--gold-line), 0 8px 28px rgba(22, 163, 74, 0.1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
img, video { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--gold-soft); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
[hidden] { display: none !important; }

.icon {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 32px; height: 32px; stroke-width: 1.5; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }

/* ---------- Shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  z-index: var(--z-nav);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, #86efac, #22c55e 55%, #15803d);
  color: #04210f; box-shadow: 0 6px 18px rgba(34, 197, 94, 0.25);
}
.brand-mark .icon { stroke-width: 2; }
.brand-name { font-family: var(--font-display); font-size: 21px; font-weight: 600; line-height: 1; }
.brand-sub { font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin-top: 4px; }

.nav-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; min-height: 42px; border-radius: 10px;
  color: var(--text-muted); font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--gold-soft); color: var(--gold); }
.nav-link[aria-current="page"] .icon { color: var(--gold); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--gold); font-weight: 600; font-size: 13px;
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 11px; color: var(--text-faint); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.page { padding: 24px 28px 48px; max-width: 1600px; }
.mobile-only { display: none !important; }

.mock-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--warning-soft); color: var(--warning); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--gold-line); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--cta-bg); border-color: transparent; color: var(--cta-text); }
.btn-primary:hover { background: var(--cta-bg-hover); border-color: transparent; box-shadow: 0 8px 24px rgba(34, 197, 94, 0.22); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.active { color: var(--gold); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 16px; }
.label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.label .req { color: var(--gold); }
.label .hint-icon { color: var(--text-faint); cursor: help; }
.help { font-size: 12px; color: var(--text-faint); line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 13px;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text); font-size: 14px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.textarea.prompt { min-height: 132px; font-size: 15px; }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { display: flex; gap: 8px; align-items: center; }

/* Chips de opciones (enums cortos) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  color: var(--text-muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.18s var(--ease);
}
.chip:hover { border-color: var(--gold-line); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.ratio-box { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }

/* Interruptor */
.switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; right: 0; top: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; } /* dentro del switch: al enfocarse no arrastra el scroll del panel */
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; flex: none; position: relative;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}
.switch input:checked + .track { background: var(--gold-soft); border-color: var(--gold); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--gold); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Rango */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row .input { width: 92px; flex: none; text-align: center; padding: 8px; }
input[type="range"] { flex: 1; accent-color: var(--gold); min-height: 32px; cursor: pointer; }

/* Carga de medios */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 112px; padding: 16px; border-radius: 12px; text-align: center;
  border: 1.5px dashed var(--border-strong); background: var(--bg-elev);
  color: var(--text-muted); cursor: pointer; transition: all 0.2s var(--ease);
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); color: var(--text); background: var(--gold-soft); }
.dropzone .icon { color: var(--gold); }
.dropzone small { color: var(--text-faint); font-size: 11.5px; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 8px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer;
  background: rgba(10, 10, 10, 0.75); color: #fff;
}
.thumb .thumb-x .icon { width: 14px; height: 14px; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.thumb .thumb-kind { position: absolute; left: 6px; bottom: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
.media-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); padding: 3px; background: var(--bg-elev); cursor: pointer; }

/* Acordeón de opciones avanzadas */
.disclosure { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 6px; }
.disclosure > summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-muted);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { color: var(--text); }
.disclosure > summary .icon { transition: transform 0.2s var(--ease); }
.disclosure[open] > summary .icon { transform: rotate(180deg); }
.disclosure .disclosure-body { padding: 6px 0 4px; }

/* ---------- Tarjetas y paneles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.card-pad { padding: 20px; }
.card-title { font-family: var(--font-display); font-size: 22px; }
.section-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.callout .icon { margin-top: 1px; }
.callout-info { background: var(--info-soft); color: var(--text); }
.callout-info .icon { color: var(--info); }
.callout-warn { background: var(--warning-soft); color: var(--text); }
.callout-warn .icon { color: var(--warning); }
.callout-error { background: var(--danger-soft); color: var(--text); }
.callout-error .icon { color: var(--danger); }
.callout-ok { background: var(--emerald-soft); color: var(--text); }
.callout-ok .icon { color: var(--emerald); }
.callout ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Estudio ---------- */
.studio { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 24px; align-items: start; }
.composer { position: sticky; top: 88px; max-height: calc(100vh - 108px); display: flex; flex-direction: column; overflow: hidden; overflow: clip; } /* clip: el foco no puede desplazar el panel por dentro */
.composer-scroll { overflow-y: auto; padding: 20px; flex: 1; overscroll-behavior: contain; }
.composer-foot { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.cost-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-muted); min-height: 20px; }
.cost-line strong { color: var(--gold); font-weight: 700; }
.repeat-select { display: flex; align-items: center; gap: 8px; }
.repeat-select .select { min-height: 36px; padding: 6px 30px 6px 10px; width: auto; font-size: 12.5px; }

.model-trigger {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--gold-line); background: linear-gradient(135deg, var(--gold-soft), transparent 70%);
  transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.model-trigger:hover { box-shadow: var(--glow); border-color: var(--gold); }
.model-trigger .m-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); flex: none; }
.model-trigger .m-text { flex: 1; min-width: 0; }
.model-trigger .m-family { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.1; }
.model-trigger .m-workflow { font-size: 12.5px; color: var(--text-muted); }
.model-notes { margin-top: 12px; }

.feed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.feed-head h2 { font-family: var(--font-display); font-size: 24px; }
.feed-head .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.seg button {
  min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text-muted); font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* Grilla de generaciones */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gen-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.gen-card:hover { border-color: var(--gold-line); box-shadow: var(--shadow-md); }
.gen-media {
  position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; cursor: pointer;
  display: grid; place-items: center; border: 0; padding: 0; width: 100%;
}
.gen-media img, .gen-media video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.gen-card:hover .gen-media img { transform: scale(1.03); }
.gen-media .count-badge {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(12,10,9,0.72); color: #fff;
}
.gen-media .play-badge { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(12,10,9,0.6); color: #fff; }
.gen-media .play-badge .icon { fill: currentColor; }
.gen-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.gen-model { font-size: 11.5px; font-weight: 600; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-prompt { font-size: 12.5px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.gen-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); }
.gen-meta .spacer { flex: 1; }
.gen-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s var(--ease); }
.gen-card:hover .gen-actions, .gen-card:focus-within .gen-actions { opacity: 1; }
.gen-actions .icon-btn { width: 34px; height: 34px; background: rgba(12,10,9,0.72); color: #fff; }
.gen-actions .icon-btn:hover { background: rgba(12,10,9,0.9); color: var(--gold-strong); }
.gen-actions .icon-btn.active { color: var(--gold-strong); }
.gen-actions .icon-btn.active .icon { fill: currentColor; }

/* Estado en progreso */
.gen-progress { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-align: center; padding: 16px; }
.gen-progress::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, var(--gold-soft) 45%, transparent 70%);
  background-size: 220% 100%; animation: shimmer 1.8s ease-in-out infinite;
}
.gen-progress > * { position: relative; }
.gen-progress .icon { color: var(--gold); width: 26px; height: 26px; }
.gen-failed { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; text-align: center; color: var(--text-muted); font-size: 12.5px; }
.gen-failed .icon { color: var(--danger); width: 26px; height: 26px; }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }

/* Insignias de estado */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending, .badge-queued { background: var(--info-soft); color: var(--info); }
.badge-in_progress { background: var(--gold-soft); color: var(--gold); }
.badge-completed { background: var(--emerald-soft); color: var(--emerald); }
.badge-failed, .badge-nsfw, .badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-canceled { background: var(--surface-3); color: var(--text-faint); }
.badge-in_progress .dot, .badge-queued .dot, .badge-pending .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* Vacío */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 64px 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 18px; color: var(--text-muted); }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.empty h3 { font-family: var(--font-display); font-size: 24px; color: var(--text); }
.empty p { max-width: 420px; }

/* Esqueleto */
.skeleton { background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadeIn 0.2s var(--ease);
}
.modal {
  width: 100%; max-width: 960px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: rise 0.28s var(--ease); overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-family: var(--font-display); font-size: 24px; flex: 1; }
.modal-body { overflow-y: auto; padding: 20px; flex: 1; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Selector de modelos */
.picker-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.picker-tools .search { flex: 1; min-width: 200px; position: relative; }
.picker-tools .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.picker-tools .search .input { padding-left: 38px; }
.family-block + .family-block { margin-top: 20px; }
.family-name { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.family-name h3 { font-family: var(--font-display); font-size: 20px; }
.model-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.model-option {
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 14px; min-height: 76px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); cursor: pointer;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.model-option:hover { border-color: var(--gold-line); background: var(--surface-2); }
.model-option[aria-selected="true"] { border-color: var(--gold); background: var(--gold-soft); }
.model-option .wf { font-weight: 600; font-size: 13px; }
.model-option .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 600; background: var(--surface-3); color: var(--text-muted); }
.tag .icon { width: 11px; height: 11px; }
.tag-gold { background: var(--gold-soft); color: var(--gold); }

/* Detalle de generación */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 0; min-height: 0; flex: 1; overflow: hidden; }
.detail-stage { background: #050505; display: flex; flex-direction: column; min-height: 0; }
.detail-main { flex: 1; display: grid; place-items: center; min-height: 320px; padding: 16px; overflow: hidden; }
.detail-main img, .detail-main video { max-height: calc(100vh - 220px); width: auto; max-width: 100%; object-fit: contain; border-radius: 8px; }
.detail-main audio { width: 100%; max-width: 480px; }
.detail-strip { display: flex; gap: 8px; padding: 10px 16px 16px; overflow-x: auto; }
.detail-strip button { width: 64px; height: 64px; flex: none; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #171717; }
.detail-strip button[aria-current="true"] { border-color: var(--gold); }
.detail-strip img { width: 100%; height: 100%; object-fit: cover; }
.detail-side { padding: 20px; overflow-y: auto; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.prompt-box { padding: 12px 14px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--border); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Biblioteca ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.filters .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.filters .search .input { padding-left: 38px; }
.filters .select { width: auto; min-width: 160px; }
.load-more { display: flex; justify-content: center; margin-top: 24px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }

/* ---------- Ajustes ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat { padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.stat .stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .stat-value { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin-top: 4px; line-height: 1.1; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-top: 18px; }
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.check-item:last-child { border-bottom: 0; }
.check-item .state { margin-left: auto; }
.ok-dot, .warn-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ok-dot { background: var(--emerald-soft); color: var(--emerald); }
.warn-dot { background: var(--warning-soft); color: var(--warning); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 13px; animation: rise 0.25s var(--ease);
}
.toast .icon { margin-top: 1px; }
.toast-ok .icon { color: var(--emerald); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--gold); }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(34,197,94,0.20), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(163,163,163,0.08), transparent 60%),
    #0a0a0a;
  color: #f5f5f5;
}
.auth-art::before {
  content: ""; position: absolute; inset: -20%;
  background: conic-gradient(from 210deg at 60% 40%, transparent 0deg, rgba(74,222,128,0.10) 40deg, transparent 90deg, rgba(74,222,128,0.06) 200deg, transparent 260deg);
  animation: slowspin 40s linear infinite;
}
@keyframes slowspin { to { transform: rotate(360deg); } }
.auth-art > * { position: relative; }
.auth-art .big { font-family: var(--font-display); font-size: clamp(40px, 5vw, 68px); line-height: 1; font-weight: 600; max-width: 560px; }
.auth-art .big em { font-style: italic; color: #4ade80; }
.auth-art p { color: #a8a8a8; max-width: 440px; margin-top: 16px; font-size: 15px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-family: var(--font-display); font-size: 36px; margin: 28px 0 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .studio { grid-template-columns: 1fr; }
  .composer { position: static; max-height: none; overflow: visible; }
  .composer-foot { position: sticky; bottom: 0; z-index: var(--z-sticky); border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: 0 -8px 24px rgba(0,0,0,0.18); }
  .detail { grid-template-columns: 1fr; overflow-y: auto; }
  .detail-side { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.28s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: calc(var(--z-nav) - 1); }
  .main { margin-left: 0; }
  .mobile-only { display: inline-grid !important; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 24px; }
  .page { padding: 16px 16px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 220px; padding: 28px 20px; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { max-height: 100vh; border-radius: 0; max-width: none; }
  .gen-actions { opacity: 1; }
}
@media (max-width: 520px) {
  .gen-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gen-body { padding: 10px; }
  .filters .select { flex: 1; min-width: 0; }
  .detail-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Ícono del conmutador de tema: muestra el destino */
:root[data-theme="dark"] .theme-icon-dark,
:root:not([data-theme]) .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-icon-light { display: none; }

/* Enlaces con aspecto de botón: que a:hover no les cambie el color */
a.btn, a.btn:hover { color: var(--text); }
a.btn-primary, a.btn-primary:hover { color: var(--cta-text); }
a.btn-ghost { color: var(--text-muted); }
a.icon-btn:hover { color: var(--text); }
.gen-actions a.icon-btn, .gen-actions a.icon-btn:hover { color: #fff; }

/* Panel lateral del detalle: sin desbordes */
.detail-side { min-width: 0; overflow-x: hidden; }
.detail-actions .btn { min-width: 0; white-space: normal; text-align: center; line-height: 1.2; padding: 8px 10px; font-size: 12.5px; }
.kv dd.mono { font-size: 11px; }

/* Contador en la navegación */
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--cta-bg); color: var(--cta-text); font-size: 11px; font-weight: 700; }
.tag-kie { background: var(--emerald-soft); color: var(--emerald); }
.tag-higgsfield { background: var(--info-soft); color: var(--info); }

/* ---------- Productos ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.prod-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.prod-card:hover { color: var(--text); border-color: var(--gold-line); box-shadow: var(--shadow-md); }
.prod-media { position: relative; aspect-ratio: 1; background: #fff; display: grid; place-items: center; overflow: hidden; }
.prod-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.prod-card:hover .prod-media img { transform: scale(1.03); }
.prod-media .count-badge { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(12,10,9,.72); color: #fff; }
.prod-nophoto { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #a3a3a3; }
.prod-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.prod-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod-meta { font-size: 11.5px; color: var(--text-faint); }
.prod-body .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; min-height: 20px; }

.product-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(340px, 1.15fr); gap: 20px; align-items: start; }
.ref-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.ref-photo { position: relative; aspect-ratio: 1; padding: 0; border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; border: 2px solid var(--border); transition: border-color .2s var(--ease), opacity .2s var(--ease); }
.ref-photo img { width: 100%; height: 100%; object-fit: cover; }
.ref-photo[aria-pressed="false"] { opacity: .5; }
.ref-photo[aria-pressed="true"] { border-color: var(--gold); opacity: 1; }
.ref-order { position: absolute; top: 6px; left: 6px; min-width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--cta-bg); color: var(--cta-text); font-weight: 700; font-size: 12px; }
.ref-order:empty { display: none; }
.ref-main { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: rgba(12,10,9,.72); color: #fff; text-align: center; }

.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px 14px; min-height: 92px; border-radius: 12px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-elev); transition: border-color .18s var(--ease), background-color .18s var(--ease); }
.preset:hover { border-color: var(--gold-line); }
.preset[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); }
.preset-name { font-weight: 600; font-size: 13px; }
.preset-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.review-card { display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.review-card[data-review="approved"] { border-color: color-mix(in srgb, var(--emerald) 45%, transparent); }
.review-card[data-review="rejected"] { opacity: .6; }
.review-media { position: relative; aspect-ratio: 1; padding: 0; border: 0; cursor: zoom-in; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; width: 100%; }
.review-media img { width: 100%; height: 100%; object-fit: cover; }
.review-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.review-meta { font-size: 11.5px; color: var(--text-faint); }
.review-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.review-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tab-count { color: var(--text-faint); font-weight: 600; }

@media (max-width: 1000px) {
  .product-layout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .prod-grid, .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .review-actions .btn { flex: 1 1 100%; }
}

/* Filtros en pantallas angostas: buscador a lo ancho, listas de a dos */
@media (max-width: 640px) {
  .filters .search { flex: 1 1 100%; max-width: none; }
  .filters .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters .seg { flex: 1 1 100%; }
  .filters .seg button { flex: 1; justify-content: center; }
}

/* Grupos segmentados largos: que bajen de línea en vez de desbordar */
.seg { flex-wrap: wrap; max-width: 100%; }

/* ---------- Galería de 5 (ficha de la joya) ---------- */
.g5 { margin-bottom: 20px; }
.g5-head { display: flex; gap: 18px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.g5-title { font-size: 28px; margin: 2px 0 0; }
.g5-controls { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.g5-cost { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.g5-progress { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.g5-progress strong { color: var(--gold); }
.g5 .callout { margin-bottom: 12px; }
.g5-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.g5-slot { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.g5-slot.is-hero { border-color: var(--gold-line); box-shadow: var(--glow); }
.g5-media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-3); }
.g5-zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.g5-zoom img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g5-num { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 10, 10, 0.72); color: #4ade80; font-size: 12px; font-weight: 700; }
.g5-hero { position: absolute; top: 8px; right: 8px; padding: 3px 8px; border-radius: 999px; background: var(--cta-bg); color: var(--cta-text); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.g5-slot-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.g5-slot-name { font-size: 12.5px; font-weight: 600; }
.g5-options { display: flex; gap: 6px; flex-wrap: wrap; }
.g5-opt { width: 40px; height: 40px; padding: 0; border-radius: 6px; overflow: hidden; border: 2px solid transparent; background: var(--surface-3); cursor: pointer; }
.g5-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g5-opt[aria-pressed="true"] { border-color: var(--gold); }
/* Versiones de cada casilla (2026-10-07): número, la que está en la tienda y marcas. */
.g5-opt { position: relative; }
.g5-ver { position: absolute; left: 2px; bottom: 2px; font-size: 9px; font-weight: 700; line-height: 1; padding: 2px 3px; border-radius: 3px; background: rgba(8, 7, 6, .72); color: #fff; }
.g5-store-dot { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 2px rgba(8, 7, 6, .6); }
.g5-history { font-size: 11px; }
.g5-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.badge-regen { background: var(--gold-soft); color: var(--gold); }
.badge-store { background: var(--emerald-soft); color: var(--emerald); }
.badge-unsent { background: var(--warning-soft); color: var(--warning); }
.g5-opt:focus-visible, .g5-zoom:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.g5-slot .btn { align-self: flex-start; margin-top: auto; }
.g5-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.g5-empty { display: flex; gap: 12px; align-items: center; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); font-size: 13px; }
.g5-empty .icon { color: var(--gold); flex: none; }
@media (max-width: 1180px) { .g5-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g5-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g5-controls { width: 100%; } }

/* ---------- Carruseles de Instagram (Fase 3) ---------- */
.car-h2 { font-size: 30px; margin: 4px 0 6px; }
.car-angles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.car-angle { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); }
.car-angle:hover { border-color: var(--gold-line); }
.car-angle input { position: absolute; opacity: 0; pointer-events: none; }
.car-angle:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.car-angle:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.car-angle-name { font-weight: 700; font-size: 14px; }
.car-angle-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.car-search { position: relative; max-width: 520px; }
.car-search > .icon { position: absolute; left: 12px; top: 13px; color: var(--text-faint); }
.car-search .input { padding-left: 38px; }
.car-results { position: absolute; z-index: var(--z-dropdown); left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 360px; overflow: auto; }
.car-result { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; }
.car-result:hover, .car-result:focus-visible { background: var(--surface-2); outline: none; }
.car-result img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.car-result span { display: flex; flex-direction: column; font-size: 13px; }
.car-items { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.car-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.car-item-media img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.car-item-body { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.car-callout-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.car-callout-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-muted); }
.car-callout-fields .input { width: 130px; padding: 8px 10px; }
/* Carrusel comercial: fotos subidas, joya sin inventario, precio y peso (2026-10-07). */
.car-com { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 16px; background: var(--surface-2); }
.car-com-fotos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.car-com-foto { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); }
.car-com-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-com-foto button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(8, 7, 6, .7); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.car-com-foto.is-loading { display: grid; place-items: center; }
.car-com-subir { cursor: pointer; align-self: flex-start; }
.car-com-manual, .car-com-precio { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 14px; align-items: end; }
.car-com-manual .field, .car-com-precio .field { margin-top: 12px; }
.car-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 18px; }
.car-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.car-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .2s var(--ease); }
.car-card:hover { border-color: var(--gold-line); }
.car-card-media { aspect-ratio: 4 / 5; background: var(--surface-2); }
.car-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.car-card-title { font-weight: 600; font-size: 13.5px; }
.car-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.car-head-actions { display: flex; gap: 8px; align-items: center; }
.car-editor { display: grid; grid-template-columns: 112px minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.car-strip { display: flex; flex-direction: column; gap: 8px; padding: 8px; max-height: calc(100vh - 160px); overflow: auto; position: sticky; top: 84px; }
.car-thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; aspect-ratio: 4 / 5; flex: none; }
.car-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-thumb[aria-current="true"] { border-color: var(--gold); }
.car-thumb-n { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.car-thumb-badge { position: absolute; right: 4px; top: 4px; background: rgba(0,0,0,.7); color: var(--gold); border-radius: 6px; padding: 2px; display: grid; }
.car-thumb-add { display: grid; place-items: center; color: var(--text-muted); border: 1px dashed var(--border-strong); aspect-ratio: auto; height: 56px; }
.car-stage { position: sticky; top: 84px; }
.car-preview { position: relative; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-md); }
.car-preview img { width: 100%; height: 100%; display: block; }
.car-preview.is-callout { cursor: crosshair; }
.car-anchor { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px dashed #fff; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.car-stage .help { text-align: center; margin-top: 8px; }
.car-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.car-panel-tools { display: flex; gap: 4px; }
.car-rot { transform: rotate(180deg); }
.car-pool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.car-pool-item { position: relative; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: pointer; color: var(--text-muted); }
.car-pool-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-pool-item span { position: absolute; left: 3px; bottom: 3px; font-size: 10px; font-weight: 700; background: rgba(0,0,0,.7); color: #fff; padding: 0 5px; border-radius: 4px; }
.car-pool-item:hover, .car-pool-item:focus-visible { border-color: var(--gold); outline: none; }
.car-pool-none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
.car-pool-none span { position: static; background: none; color: inherit; }
.car-meta { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
.car-meta-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
@media (max-width: 1180px) {
  .car-editor { grid-template-columns: 96px minmax(0, 1fr); }
  .car-panel { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .car-editor { grid-template-columns: 1fr; }
  .car-strip { position: static; flex-direction: row; max-height: none; overflow-x: auto; }
  .car-thumb { width: 72px; }
  .car-thumb-add { width: 56px; height: auto; }
  .car-stage { position: static; }
  .car-meta { grid-template-columns: 1fr; }
}
.car-stage-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.car-stage-tools .seg:empty { display: none; }
.car-preview.is-square { aspect-ratio: 1 / 1; }
.car-anchor { opacity: .55; }
.car-anchor.is-active { opacity: 1; border-color: var(--gold); }
.car-anchor::after { content: attr(data-label); position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); font-size: 10px; font-weight: 700; color: #fff; background: rgba(0,0,0,.65); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }

/* ---------- Videos (Kling 3.0, Veo 3.1, Seedance 2.0 por Kie.ai) ---------- */
.vid-h2 { font-size: 28px; margin: 2px 0 14px; }
.vid-mock { display: flex; gap: 6px; align-items: flex-start; margin: -6px 0 14px; }
.vid .field + .field { margin-top: 20px; }
.vid-tabs { flex-wrap: wrap; }
.vid-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.vid-panel { margin-top: 10px; }
.vid-search { position: relative; }
.vid-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.vid-search .input { padding-left: 38px; width: 100%; }
.vid-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 280px; overflow-y: auto; }
.vid-result { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.vid-result:hover, .vid-result:focus-visible { border-color: var(--gold); outline: none; }
.vid-result img, .vid-result-ph { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--text-faint); }
.vid-result span { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.vid-result strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-result .faint { font-size: 11.5px; }
.vid-jewel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.vid-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.vid-grid > .help { grid-column: 1 / -1; }
.vid-pick { position: relative; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.vid-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-pick:hover, .vid-pick:focus-visible { border-color: var(--gold-line); outline: none; }
.vid-pick[aria-pressed="true"] { border-color: var(--gold); }
.vid-pick-n:empty { display: none; }
.vid-pick-n { position: absolute; left: 3px; top: 3px; font-size: 10px; font-weight: 700; background: var(--gold); color: #04210f; padding: 1px 5px; border-radius: 4px; }
.vid-pick-tag { position: absolute; left: 3px; bottom: 3px; right: 3px; font-size: 9.5px; font-weight: 600; background: rgba(0,0,0,.65); color: #fff; padding: 0 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vid-frames { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.vid-frame { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; }
.vid-frame-box { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--text-faint); }
.vid-frame.is-set .vid-frame-box { border-style: solid; border-color: var(--gold-line); }
.vid-frame-box img { width: 100%; height: 100%; object-fit: cover; }
.vid-frame-box .thumb-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; background: rgba(10, 10, 10, 0.75); color: #fff; }
.vid-frame-box .thumb-x .icon { width: 14px; height: 14px; }
#vid-prompt { margin-top: 8px; }
.vid-families { display: grid; gap: 8px; }
.vid-family { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.vid-family:hover { border-color: var(--gold-line); }
.vid-family:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.vid-family:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.vid-family input { position: absolute; opacity: 0; pointer-events: none; }
.vid-family-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.vid-family-price { grid-row: 1; grid-column: 2; align-self: center; font-size: 11.5px; color: var(--gold); font-weight: 600; white-space: nowrap; }
.vid-family-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }
.chip .faint { font-weight: 500; margin-left: 2px; }
@media (max-width: 760px) {
  .vid-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vid-family-price { grid-row: auto; grid-column: 1 / -1; }
}
/* Videos: primer/último cuadro o imágenes de referencia (0.7.1) */
.vid-use { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.vid-use .seg { align-self: flex-start; flex-wrap: wrap; }
#vid-frames-box .vid-frames { margin-top: 10px; }
#vid-refs-box { margin-top: 10px; }
.vid-refs-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.vid-refs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.vid-ref { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; border: 1px solid var(--gold-line); background: var(--surface-2); }
.vid-ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-ref .thumb-x { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; background: rgba(10, 10, 10, 0.75); color: #fff; }
.vid-ref .thumb-x .icon { width: 13px; height: 13px; }
.vid-ref-empty { display: grid; place-items: center; color: var(--text-faint); border: 1px dashed var(--border-strong); }
.vid-family.is-off { opacity: .5; cursor: not-allowed; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 760px) { .vid-refs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.vid-count { margin-top: 4px; font-size: 11.5px; color: var(--text-faint); text-align: right; }
.vid-count.is-over { color: var(--danger, #dc2626); font-weight: 600; }
#vid-prompt[aria-invalid="true"] { border-color: var(--danger, #dc2626); }
/* Sección «Imágenes» (2026-10-07) */
.img-prompt-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.img-sub { display: block; margin-top: 12px; }
.img-refs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.img-refs:empty { display: none; }
@media (max-width: 760px) { .img-refs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Personas (Soul ID) ---------- */
.tag-error { background: var(--danger-soft); color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--cta-bg); }
.persona-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.persona-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 14px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.persona-chip img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; }
.persona-chip:hover { border-color: var(--gold-line); }
.persona-chip[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 1px var(--gold) inset; }
.persona-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.persona-card.is-off { opacity: .6; }
.persona-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.persona-name { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin: 0; }
input.persona-name { padding: 6px 10px; max-width: 260px; }
.persona-refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.persona-ref { position: relative; margin: 0; aspect-ratio: 1 / 1; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border); background: var(--surface-2); }
.persona-ref.is-sent { border-color: var(--gold); }
.persona-ref-img { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.persona-ref-img img { width: 100%; height: 100%; object-fit: cover; }
.persona-ref-n { position: absolute; top: 4px; left: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: rgba(10, 10, 10, 0.75); color: #f5f5f5; }
.persona-ref.is-sent .persona-ref-n { background: var(--cta-bg); color: var(--cta-text); }
.persona-ref-tools { position: absolute; right: 2px; bottom: 2px; display: flex; gap: 2px; }
.persona-ref-tools .icon-btn { width: 28px; height: 28px; background: rgba(10, 10, 10, 0.75); color: #f5f5f5; }
.persona-add {
  aspect-ratio: 1 / 1; border-radius: var(--radius-sm); border: 2px dashed var(--border-strong);
  display: grid; place-items: center; align-content: center; gap: 4px; color: var(--text-muted); cursor: pointer; font-size: 12px; font-weight: 600;
}
.persona-add:hover, .persona-add:focus-within { border-color: var(--gold); color: var(--gold); }
.persona-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.persona-foot .spacer { flex: 1; }
.persona-new textarea { margin-top: 8px; }
/* Avatar: zoom a la primera cara de la hoja de primeros planos (cuadrante superior izquierdo). */
.persona-face { width: 36px; height: 36px; border-radius: 50%; flex: none; background-color: var(--surface-3); background-size: 230%; background-position: 14% 6%; background-repeat: no-repeat; }
