/* Layout no estilo "estúdio": topo com menu em pílulas, título grande com contagem, cards com foto inteira e nome
   por cima. A marca (cor de destaque e fonte do nome) fica nas variáveis --brand-* e --accent*. */
:root {
  /* marca: troque aqui */
  --accent: #fdd13f;           /* amarelo do logo InfluencIA */
  --accent-ink: #101114;
  --accent-soft: rgba(253, 209, 63, 0.12);
  --accent-line: rgba(253, 209, 63, 0.4);

  --bg: #0b0b0d;
  --bg-2: #0f1012;
  --surface: #16171a;
  --surface-2: #1d1f23;
  --surface-3: #26282d;
  --line: #2a2c31;
  --line-2: #363940;
  --text: #f3efe6;
  --muted: #9a9da5;
  --dim: #6b6e77;
  --yellow: #eacd78; /* fundo dos cards de personagem */
  --ok: #7fdcb5;
  --warn: #f2b33d;
  --danger: #ff5f57;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 650; }
p { margin: 0; }

.dim { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.hint { color: var(--muted); font-size: 14px; }
.warn { color: var(--warn); }
.no-scroll { overflow: hidden; }

/* ------------------------------------------------------------------ botões e campos */
.btn {
  --b-bg: var(--surface-2); --b-fg: var(--text); --b-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font-weight: 650; font-size: 14px; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: filter .15s, transform .1s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
.btn--primary { --b-bg: var(--accent); --b-fg: var(--accent-ink); --b-bd: transparent; }
.btn--primary:hover { filter: brightness(1.05); box-shadow: 0 6px 24px -8px var(--accent); }
.btn--soft { --b-bg: var(--accent-soft); --b-fg: var(--accent); --b-bd: var(--accent-line); }
.btn--quiet { --b-bg: transparent; --b-fg: var(--muted); --b-bd: transparent; }
.btn--quiet:hover { --b-fg: var(--text); background: var(--surface-2); filter: none; }
.btn--danger { --b-fg: #ff8f89; }
.btn--danger-solid { --b-bg: var(--danger); --b-fg: #fff; --b-bd: transparent; }
.btn--sm { min-height: 32px; padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn--lg { min-height: 48px; padding: 12px 20px; font-size: 15px; border-radius: 14px; }

.input {
  min-height: 42px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font-size: 14px; min-width: 0; flex: 1;
}
.input:focus { outline: none; border-color: var(--accent); }
.input--area { height: auto; padding: 12px 14px; line-height: 1.45; resize: vertical; width: 100%; }
.input--mono { font: 12px/1.5 var(--mono); }
.input--sm { min-height: 32px; flex: none; width: auto; padding: 0 8px; }
.input--num { min-height: 32px; width: 70px; flex: none; }
.input--code { font: 600 22px var(--mono); letter-spacing: 0.4em; text-align: center; max-width: 220px; min-height: 52px; }
.search { position: relative; display: flex; flex: 1; max-width: 360px; }
.search::before { content: '⌕'; position: absolute; left: 13px; top: 50%; transform: translateY(-54%); color: var(--dim); font-size: 18px; pointer-events: none; }
.search .input { padding-left: 36px; }
.field { display: grid; gap: 6px; }
.label { font-size: 13px; font-weight: 650; }

.spinner { width: 16px; height: 16px; border-radius: 50%; display: inline-block; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 7px;
  font: 600 11px/1 var(--mono); background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); white-space: nowrap;
}
.badge--active { color: var(--ok); }
.badge--out_of_credits, .badge--error, .badge--auth_error { color: var(--danger); }
.badge--role { background: rgba(127, 220, 181, .92); color: #04210f; border-color: transparent; }
.badge--anchor { background: var(--warn); color: #241600; border-color: transparent; }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-2); justify-self: start; }
.seg button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 650; font-size: 13px; cursor: pointer; }
.seg button.is-on { background: var(--surface-3); color: var(--text); }

/* ------------------------------------------------------------------ topo */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  min-height: 64px; padding: 0 20px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; color: inherit; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand__logo { height: 30px; width: auto; display: block; }
.nav { display: flex; gap: 6px; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid transparent;
  color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a.is-active { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.nav .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; }
.topbar__right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.spend { color: var(--muted); font-size: 13px; }
.spend b { color: var(--text); font: 500 13px var(--mono); margin-left: 4px; }
.chip {
  display: inline-flex; gap: 8px; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); font-weight: 650; font-size: 14px;
}
.chip b { font-family: var(--mono); font-weight: 600; }
.chip:hover { text-decoration: none; filter: brightness(1.1); }
.chip--warn { background: rgba(242, 179, 61, .12); border-color: rgba(242, 179, 61, .45); color: var(--warn); }

.band { padding: 10px 20px; font-size: 14px; background: rgba(242, 179, 61, .1); border-bottom: 1px solid rgba(242, 179, 61, .35); }
.band--auth, .band--no_credits, .band--error { background: rgba(255, 95, 87, .1); border-color: rgba(255, 95, 87, .35); }

.main { padding: 22px 24px 60px; }
.page { max-width: 1440px; margin: 0 auto; display: grid; gap: 16px; }
.page--narrow { max-width: 760px; }
.page__head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page__title { font-size: 34px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.05; }
.page__title em { font-style: normal; color: var(--dim); font-weight: 500; margin-left: 8px; }

/* ------------------------------------------------------------------ painéis e avisos */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel__body { padding: 18px; display: grid; gap: 14px; }
.soon { padding: 28px; display: grid; gap: 6px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notice { padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; }
.notice--plan, .notice--trial { border-color: rgba(242, 179, 61, .5); }
.notice--auth, .notice--no_credits, .notice--error { border-color: rgba(255, 95, 87, .5); }
.empty {
  grid-column: 1 / -1; display: grid; place-items: center; text-align: center; gap: 8px; padding: 40px 18px;
  color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--r-md);
}

/* passos do login */
.steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 18px; counter-reset: step; }
.steps > li { position: relative; padding-left: 40px; display: grid; gap: 6px; justify-items: start; counter-increment: step; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
.paste { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.paste .input { flex: 1 1 100%; }

/* tela de entrada */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 16px;
  background: radial-gradient(ellipse 70% 45% at 50% 0%, rgba(253, 209, 63, 0.13), transparent 70%), var(--bg);
}
.login__card { width: min(560px, 100%); display: grid; gap: 22px; }
.login__brand { display: grid; gap: 14px; justify-items: center; text-align: center; }
.login__brand h1 { width: 100%; }
.login__logo { width: min(400px, 100%); height: auto; margin: 0 auto; }
.login__tagline { margin: 0; font-size: 17px; color: var(--text); opacity: .85; }
.login__perks { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.login__perks li {
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent);
}
.login__section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; display: grid; gap: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login__title { margin: 0; font-size: 20px; }
.login__section .steps p { margin: 0; }
.login__go { width: 100%; justify-content: center; margin-top: 4px; }
.login__section .steps > li:last-child { justify-items: stretch; }
.login__safe { margin: 0; text-align: center; }
/* página de obrigado (depois do pagamento) */
.thanks { justify-items: center; text-align: center; gap: 14px; }
.thanks__check {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 32px; font-weight: 800;
  box-shadow: 0 10px 40px -10px var(--accent);
}
.thanks__title { margin: 0; font-size: 26px; }
.thanks__text { margin: 0; color: var(--text); opacity: .85; }
.thanks__status { margin: 0; font-size: 14px; color: var(--muted); }
.thanks__status .spinner { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.thanks__status--ok { color: var(--ok); }
.thanks__status--warn { color: var(--warn); }
.thanks__help { display: grid; gap: 4px; padding: 16px 18px; border: 1px dashed var(--line-2); border-radius: var(--r-md); font-size: 14px; color: var(--muted); }
.thanks__help b { color: var(--text); }
.paid { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 6px 0; }
.paid__title { margin: 0; font-size: 22px; }
.paid p { margin: 0; color: var(--muted); max-width: 380px; }
/* nota da hospedagem no Gerar (vídeos grátis; acabaram: galeria cheia + pagar) */
.paywall-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.paywall-note span { flex: 1 1 200px; }
.paywall-note--out { color: var(--text); background: var(--accent-soft); border-color: var(--accent-line); }
.char__barred { display: block; width: fit-content; margin-bottom: 3px; padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: var(--danger); color: #fff; white-space: normal; }
/* vídeo barrado ou com erro (detalhe do vídeo) */
.fail { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; overflow: auto; }
.fail__bg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(22px) brightness(.28); }
.fail__card { position: relative; width: min(600px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; padding: 28px 26px; background: rgba(16, 17, 20, .82); border: 1px solid var(--line-2); border-radius: var(--r-lg); backdrop-filter: blur(6px); }
.fail__icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; background: var(--surface-3); color: var(--text); }
.fail__icon.is-barred { background: rgba(255, 95, 87, .15); color: #ff8f89; border: 1.5px solid rgba(255, 95, 87, .5); }
.fail__icon.is-canceled { font-size: 20px; }
.fail__title { margin: 0; font-size: 22px; }
.fail__lead { margin: 0; color: var(--muted); }
.fail__steps { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.fail__steps li { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line-2); color: var(--dim); }
.fail__steps li.is-done { color: var(--ok); border-color: rgba(127, 220, 181, .35); }
.fail__steps li.is-failed { color: #ff8f89; border-color: rgba(255, 95, 87, .5); background: rgba(255, 95, 87, .08); }
.fail__cols { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.fail__cols > div { display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.fail__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fail__tags span { padding: 3px 9px; border-radius: 999px; font-size: 12.5px; background: var(--surface-3); color: var(--text); }
.fail__todo { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.fail__todo li { position: relative; padding-left: 20px; }
.fail__todo li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }
.fail__clue { width: 100%; display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px; }
.fail__clue b { color: var(--accent); }
.fail__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
@media (max-width: 700px) { .fail__cols { grid-template-columns: 1fr; } }
/* vídeo na fila ou sendo feito (mesmo cartão do erro) */
.wait__ring { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.wait__ring.is-queued { border-top-color: var(--muted); animation-duration: 2.2s; }
.wait__bar { width: min(380px, 100%); height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.wait__bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s; }
.fail__steps li.is-running { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

.toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); font-size: 14px; }
.toast--ok { border-color: rgba(127, 220, 181, .6); }
.toast--error { border-color: rgba(255, 95, 87, .6); }

/* ------------------------------------------------------------------ personagens */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font-weight: 650; font-size: 14px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
}
.chip-btn span { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 500; }
.chip-btn:hover { border-color: var(--dim); }
.chip-btn.is-on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip-btn.is-on span { color: var(--accent-ink); opacity: .7; }
.chip-btn--add { border-style: dashed; color: var(--muted); background: transparent; }

.folder-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.folder-head__name .input { font-weight: 700; font-size: 16px; width: 240px; flex: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card {
  position: relative; display: block; padding: 0; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  background: var(--yellow); border: 2px solid #000; box-shadow: 0 4px 0 #000; text-align: left; color: #fff; font: inherit;
  transition: transform .15s var(--spring), box-shadow .15s;
}
.card:hover { transform: translateY(-2px) rotate(-.5deg); box-shadow: 0 6px 0 #000; }
.card--chosen { outline: 3px solid var(--accent); outline-offset: 2px; }
.card__img { position: absolute; inset: 0; display: grid; place-items: center; color: #3a3016; }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 12px 10px; display: grid; gap: 2px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
}
.card__meta b { font-size: 15px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__meta .dim { color: rgba(255, 255, 255, .65); }
.card__fav { position: absolute; top: 8px; left: 10px; font-size: 16px; color: #fff; filter: drop-shadow(0 1px 0 #000); }
.card__check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 2px solid #000; font-weight: 900; }
.card__busy { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 1px #000); }
.card--slot { background: var(--bg); border: 2px dashed var(--line-2); box-shadow: none; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.card--slot:hover { color: var(--text); border-color: var(--accent-line); box-shadow: none; }
.card--slot span::before { content: '+'; display: block; text-align: center; font-size: 36px; line-height: 1; color: var(--accent); margin-bottom: 4px; }

/* ------------------------------------------------------------------ janelas */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); display: grid; place-items: center; padding: 20px; }
.modal__box { width: min(560px, 100%); max-height: calc(100vh - 40px); display: grid; grid-template-rows: auto 1fr auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .8); }
.modal__box--wide { width: min(1180px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-size: 20px; font-weight: 750; }
.modal__body { padding: 20px; overflow: auto; }
.modal__foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* criador */
.creator { display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }
.creator__results { display: grid; gap: 14px; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.ref { position: relative; width: 78px; height: 104px; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; place-items: center; }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref__x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; font-size: 11px; }
.ref--add { cursor: pointer; color: var(--muted); font-weight: 650; font-size: 12px; border-style: dashed; }
.prompt-box summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); }
.prompt-box[open] { display: grid; gap: 8px; }
.opts { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-2); }
.opts__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.opt { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; align-content: center; gap: 8px; border: 2px solid #000; }
.opt img { width: 100%; height: 100%; object-fit: cover; }
.opt a { position: absolute; inset: 0; }
.opt__actions { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.opt__actions .btn { flex: 1; }
.opt__saved { position: absolute; left: 8px; bottom: 8px; padding: 4px 9px; border-radius: 999px; background: var(--ok); color: #04210f; font-weight: 750; font-size: 12px; }
.opt--failed { border-style: dashed; border-color: var(--line-2); }

/* ficha */
.detail { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.img { position: relative; margin: 0; border-radius: var(--r-md); overflow: hidden; background: var(--yellow); aspect-ratio: 3 / 4; border: 2px solid #000; box-shadow: 0 4px 0 #000; }
.img--cover { outline: 3px solid var(--accent); outline-offset: 2px; }
.img img { width: 100%; height: 100%; object-fit: cover; }
.img figcaption { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.img__actions { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; justify-content: center; opacity: 0; transition: opacity .15s; }
.img:hover .img__actions, .img:focus-within .img__actions { opacity: 1; }
.round { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: 13px; }
.round.is-on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.round--danger:hover { background: var(--danger); }

/* ------------------------------------------------------------------ telas menores */
@media (max-width: 900px) {
  .creator, .detail { grid-template-columns: 1fr; }
  .detail__imgs { order: -1; }
  .img__actions { opacity: 1; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px 0; gap: 10px 12px; min-height: 0; }
  .brand__logo { height: 26px; }
  .spend { display: none; }
  .nav { order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 4px 12px 12px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .main { padding: 18px 16px 40px; }
  .page__title { font-size: 30px; }
  .search { max-width: none; flex: 1 1 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip-btn { flex: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .modal { padding: 0; }
  .modal__box, .modal__box--wide { width: 100%; height: 100%; max-height: 100dvh; border-radius: 0; border: 0; }
  .modal__foot { border-radius: 0; }
  .imgs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .folder-head__name .input { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}

/* ficha no estilo do Character + painel da âncora */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow .dim { text-transform: none; letter-spacing: 0; }
.btn--outline { --b-bd: rgba(255, 95, 87, .45); --b-bg: rgba(255, 95, 87, .06); }
.detail { grid-template-columns: 1fr 460px; }
.detail__imgs .imgs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.img--off img { opacity: .45; }
.opt__actions { flex-direction: column; }
.anchor { display: flex; gap: 16px; align-items: center; }
.anchor__img { width: 96px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sm); border: 2px solid #000; box-shadow: 0 3px 0 #000; background: var(--yellow); }
.anchor__img--empty { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 12px; box-shadow: none; border: 1.5px dashed var(--line-2); }
.anchor__pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.anchor__opt { padding: 0; border: 2px solid #000; border-radius: var(--r-sm); overflow: hidden; background: var(--yellow); cursor: pointer; position: relative; aspect-ratio: 3 / 4; }
.anchor__opt img { width: 100%; height: 100%; object-fit: cover; }
.anchor__opt span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); text-align: left; }
.anchor__opt.is-on { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Estúdio (Fase 3) */
.main--studio { padding: 14px; }
.studio {
  display: grid; gap: 14px; height: calc(100vh - 64px - 28px);
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 1fr) minmax(320px, 380px) minmax(300px, 360px);
}
.step { display: flex; flex-direction: column; min-height: 0; }
.step__head { padding: 12px 16px; }
.step__head h2 { font-size: 16px; }
.step__body { flex: 1; min-height: 0; overflow: auto; align-content: start; }
.step-num { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbd { font: 600 11px var(--mono); opacity: .6; margin-left: 6px; }
.chips--sm .chip-btn { min-height: 30px; padding: 0 11px; font-size: 13px; }

.sel-refs { display: grid; gap: 8px; padding: 10px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); }
.sel-refs__row { display: flex; gap: 6px; overflow-x: auto; }
.sel-refs figure { margin: 0; position: relative; flex: none; width: 58px; }
.sel-refs img { width: 58px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1.5px solid #000; }
.sel-refs figcaption { font-size: 10px; color: var(--muted); text-align: center; margin-top: 2px; }

.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.char {
  position: relative; border-radius: 14px; overflow: hidden; cursor: pointer; padding: 0; text-align: left;
  background: var(--yellow); border: 2px solid #000; box-shadow: 0 3px 0 #000; aspect-ratio: 3 / 4; color: #fff; font: inherit;
  transition: transform .15s var(--spring), box-shadow .15s;
}
.char:hover { transform: translateY(-2px) rotate(-.6deg); box-shadow: 0 5px 0 #000; }
.char img { width: 100%; height: 100%; object-fit: cover; }
.char__name { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0, 0, 0, .82)); font-weight: 700; font-size: 12.5px; line-height: 1.15; }
.char.is-on { outline: 3px solid var(--accent); outline-offset: 2px; }
.char__check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; background: var(--accent); color: var(--accent-ink); border: 2px solid #000; transform: scale(0); transition: transform .2s var(--spring); }
.char.is-on .char__check { transform: scale(1); }
.char__fav { position: absolute; top: 6px; left: 7px; font-size: 14px; filter: drop-shadow(0 1px 0 #000); }
.char--new { background: var(--bg); border: 2px dashed var(--line-2); box-shadow: none; display: grid; place-items: center; align-content: center; color: var(--muted); font-weight: 700; text-align: center; gap: 2px; }
.char--new span { font-size: 32px; line-height: 1; color: var(--accent); }
.char--new:hover { color: var(--text); box-shadow: none; }

.drop { display: grid; justify-items: center; gap: 4px; padding: 18px; border: 2px dashed var(--line-2); border-radius: var(--r-md); background: transparent; color: var(--text); cursor: pointer; text-align: center; font: inherit; }
.drop > b { font-size: 26px; line-height: 1; color: var(--accent); }
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.upload-bar, .dl { position: relative; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.upload-bar i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .2s; }
.dl--failed { border: 1px solid rgba(255, 95, 87, .4); }

.clips { display: grid; gap: 8px; }
.clip { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; }
.clip:hover { border-color: var(--line-2); }
.clip.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.clip__thumb { width: 54px; height: 72px; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.clip__body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.clip__name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip__meta { display: flex; gap: 4px; flex-wrap: wrap; }
.clip__actions { display: flex; gap: 2px; }
.badge--soft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.badge--warn { color: var(--warn); border-color: rgba(242, 179, 61, .4); }
.badge--red { background: rgba(255, 95, 87, .12); color: var(--danger); border-color: rgba(255, 95, 87, .35); }

.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .15s; }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--spring); }
.toggle input:checked + i { background: var(--accent); border-color: transparent; }
.toggle input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }

.summary { display: grid; gap: 6px; padding: 14px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); }
.summary__big { font: 750 30px/1 var(--font); letter-spacing: -0.02em; }
.gen-btn { width: 100%; }

.res { display: flex; gap: 10px; width: 100%; padding: 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.res:hover { border-color: var(--line-2); }
.res--failed { border-color: rgba(255, 95, 87, .35); }
.res__thumb { position: relative; width: 54px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--yellow); flex: none; }
.res__thumb img { width: 100%; height: 100%; object-fit: cover; }
.res__thumb img.is-dim { opacity: .5; }
.res__spin { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.res__body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.bar { display: block; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.player { width: 100%; max-height: 70vh; border-radius: var(--r-md); background: #000; }
.job-steps { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.job-steps .is-done { color: var(--ok); }
.job-steps .is-running { color: var(--text); font-weight: 650; }
.job-steps .is-failed { color: var(--danger); }

@media (max-width: 1400px) {
  .studio { height: auto; grid-template-columns: 1fr 1fr; }
  .step { max-height: 720px; }
}
@media (max-width: 760px) {
  .studio { grid-template-columns: 1fr; }
  .step { max-height: none; }
  .step__body { overflow: visible; }
}

/* importar da Higgsfield */
.hfimp { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.hfimp__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.hfimg { position: relative; padding: 0; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 2px solid #000; box-shadow: 0 3px 0 #000; background: var(--surface-2); cursor: pointer; }
.hfimg img { width: 100%; height: 100%; object-fit: cover; }
.hfimg__role { position: absolute; top: 6px; left: 6px; padding: 3px 7px; border-radius: 6px; font: 600 10px var(--mono); background: rgba(0, 0, 0, .7); color: #fff; }
.hfimg__date { position: absolute; left: 6px; bottom: 6px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; }
.hfimg__check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 2px solid #000; font-weight: 900; transform: scale(0); transition: transform .2s var(--spring); }
.hfimg.is-on { outline: 3px solid var(--accent); outline-offset: 2px; }
.hfimg.is-on .hfimg__check { transform: scale(1); }
.hfpick { display: flex; gap: 8px; align-items: center; }
.hfpick img { width: 42px; height: 56px; object-fit: cover; border-radius: 6px; border: 1.5px solid #000; }
.hfpick .input { flex: 1; }
@media (max-width: 900px) { .hfimp { grid-template-columns: 1fr; } .hfimp__side { order: -1; } }

/* janela do resultado (no estilo do Character) */
.gencard { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: stretch; }
.gencard__stage { position: relative; min-height: 420px; max-height: 72vh; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.gencard__video { width: 100%; height: 100%; max-height: 72vh; object-fit: contain; background: #000; }
.gencard__res { position: absolute; top: 12px; left: 12px; z-index: 1; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .7); color: var(--accent); font-weight: 700; font-size: 13px; }
.gencard__wait { display: grid; gap: 12px; padding: 30px; width: min(420px, 100%); }
.gencard__side { display: grid; gap: 14px; align-content: start; padding: 16px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.model-chip { display: inline-flex; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 650; font-size: 13px; }
.is-fav { color: var(--accent) !important; }
.gencard__name { font-size: 18px; }
.gencard__prompt { color: var(--muted); font-size: 14px; line-height: 1.5; max-height: 150px; overflow: auto; white-space: pre-wrap; }
.gencard__refs { display: flex; gap: 6px; flex-wrap: wrap; }
.gencard__refs img { width: 52px; height: 52px; object-fit: cover; border-radius: 10px; border: 1.5px solid #000; background: var(--yellow); }
.gencard__refs img.is-clip { outline: 2px solid var(--line-2); }
@media (max-width: 900px) { .gencard { grid-template-columns: 1fr; } .gencard__stage { min-height: 260px; } }

/* ---------------------------------------------------------------- Fila e Galeria (Fase 4) */
.badge--ok { color: var(--ok); border-color: rgba(127, 220, 181, .4); }
.qlist { display: grid; gap: 10px; }
.qrow { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.qrow--failed { border-color: rgba(255, 95, 87, .35); }
.qrow__thumb { position: relative; width: 64px; height: 84px; padding: 0; border: 1.5px solid #000; border-radius: 10px; overflow: hidden; background: var(--yellow); cursor: pointer; }
.qrow__thumb img { width: 100%; height: 100%; object-fit: cover; }
.qrow__body { display: grid; gap: 6px; min-width: 0; }
.qrow__err { color: #ff8f89; }
.qrow__side { display: grid; gap: 8px; justify-items: end; }
.parts { display: flex; gap: 6px; flex-wrap: wrap; }
.part { font: 600 11px var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.part--running { color: var(--accent); }
.part--done { color: var(--ok); }
.part--failed { color: var(--danger); }

.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.vcard { position: relative; display: grid; border-radius: var(--r-md); overflow: hidden; border: 2px solid #000; box-shadow: 0 4px 0 #000; background: var(--surface); }
.vcard.is-on { outline: 3px solid var(--accent); outline-offset: 2px; }
.vcard__media { position: relative; padding: 0; border: 0; aspect-ratio: 9 / 16; background: #000; cursor: pointer; }
.vcard__media img, .vcard__media video { width: 100%; height: 100%; object-fit: cover; }
.vcard__res { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, .7); color: var(--accent); font-weight: 700; font-size: 12px; }
.vcard__pick, .vcard__fav { position: absolute; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #000; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-weight: 800; }
.vcard__pick { right: 8px; }
.vcard__fav { right: 44px; }
.vcard__pick.is-on { background: var(--accent); color: var(--accent-ink); }
.vcard__fav.is-on { color: var(--accent); }
.vcard__meta { display: grid; gap: 6px; padding: 10px 12px 12px; min-width: 0; }
.seg--pill { border-radius: 999px; }
.seg--pill button { border-radius: 999px; }
.empty b { color: var(--text); font-size: 16px; }
.cmp { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.cmp--2 { grid-template-columns: repeat(2, 1fr); }
.cmp--4 { grid-template-columns: repeat(2, 1fr); }
.cmp__item { margin: 0; display: grid; gap: 6px; }
.cmp__item video { width: 100%; max-height: 60vh; border-radius: var(--r-sm); background: #000; }
.cmp__item.has-audio video { outline: 2px solid var(--accent); }
.cmp__item figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; font-weight: 650; }
.cmp__seek { flex: 1; accent-color: var(--accent); }
@media (max-width: 720px) {
  .qrow { grid-template-columns: 56px 1fr; }
  .qrow__side { grid-column: 1 / -1; justify-items: start; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cmp, .cmp--2, .cmp--4 { grid-template-columns: repeat(2, 1fr); }
}

/* janela grande do vídeo (como no Character: quase a tela toda) */
.modal__box--xl { width: min(1760px, 100%); height: calc(100vh - 40px); }
.modal__box--xl .modal__body { display: flex; min-height: 0; }
.modal__box--xl .gencard { flex: 1; min-height: 0; grid-template-columns: 1fr 380px; }
.modal__box--xl .gencard__stage { min-height: 0; max-height: none; height: 100%; }
.modal__box--xl .gencard__video { max-height: none; height: 100%; }
@media (max-width: 900px) {
  .modal__box--xl { height: 100%; }
  .modal__box--xl .modal__body { display: block; }
  .modal__box--xl .gencard { grid-template-columns: 1fr; }
  .modal__box--xl .gencard__stage { height: 62vh; }
  /* erro: o painel cresce com o conteúdo em vez de ficar preso na altura do player */
  .modal__box--xl .gencard__stage:has(.fail) { height: auto; }
  .fail { position: relative; padding: 14px; }
  .fail__card { padding: 22px 16px; }
}
/* o vídeo sempre cabe inteiro na área do player (quadrado, deitado ou em pé) */
.gencard__video { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; }

/* hospedagem paga */
.paywall-band { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px; }
.vcard--locked img { filter: blur(6px) brightness(.5); }
.vcard__lock { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }

/* formulários e tabelas do admin */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field--wide { grid-column: 1 / -1; }
.field--row { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; }
.table { display: grid; gap: 6px; }
.table__row { display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } .table__row { grid-template-columns: 1fr auto; } }
