/* ══════════════════════════════════════════════════════════════
   Infinity Ads — tema dark + verde (estilo Higgsfield)
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:        #080b09;
  --bg-2:      #0c110e;
  --surface:   rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border:    rgba(255, 255, 255, 0.08);
  --border-2:  rgba(255, 255, 255, 0.14);
  --text:      #eaf2ec;
  --muted:     #93a399;
  --muted-2:   #5f6f66;

  --accent:    #1fe08a;
  --accent-2:  #0bd07f;
  --accent-3:  #9bff5b;
  --grad:      linear-gradient(135deg, #0bd07f 0%, #2ee68f 48%, #9bff5b 100%);
  --grad-soft: linear-gradient(135deg, rgba(11,208,127,0.18), rgba(155,255,91,0.14));
  --accent-glow: rgba(31, 224, 138, 0.45);
  --ring:      rgba(31, 224, 138, 0.22);

  --ok:    #2ee68f;
  --warn:  #ffcb5e;
  --err:   #ff6b7d;

  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 10px 40px rgba(0, 0, 0, 0.5);
  --sidebar-w: 264px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display:   'Space Grotesk', var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* glows de fundo (verdes) */
body::before, body::after {
  content: ''; position: fixed; z-index: 0; pointer-events: none;
  width: 60vw; height: 60vw; border-radius: 50%; filter: blur(120px); opacity: 0.18;
}
body::before { background: #0bd07f; top: -22vw; right: -10vw; }
body::after  { background: #9bff5b; bottom: -26vw; left: -16vw; opacity: 0.12; }

.app { position: relative; z-index: 1; }

/* ── SIDEBAR (fixa; a página rola normalmente ao lado) ──────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  display: flex; flex-direction: column;
  padding: 22px 16px; gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.012));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center;
  background: radial-gradient(120% 120% at 30% 20%, rgba(155,255,91,0.18), rgba(11,208,127,0.05));
  border: 1px solid rgba(46,230,143,0.35);
  box-shadow: 0 6px 22px rgba(11,208,127,0.28), inset 0 0 18px rgba(46,230,143,0.12);
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.2px; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-family: var(--font); font-size: 14.5px; font-weight: 500;
  text-align: left; width: 100%; transition: all .18s ease; position: relative;
}
.nav-item .ico { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--grad-soft); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: var(--grad);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 8px; }
.key-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.key-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.key-pill.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.key-pill.bad .dot { background: var(--err); box-shadow: 0 0 8px var(--err); }
.key-pill.ok { color: #c7f6e0; }
.foot-credit { font-size: 10.5px; color: var(--muted-2); padding: 0 4px; line-height: 1.4; }

/* ── MAIN ──────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 22px 32px 14px; }
.topbar-title h1 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-title p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.hamb { display: none; background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.hamb svg { width: 20px; height: 20px; margin: auto; }

.content { flex: 1; padding: 8px 32px 48px; }

.view { animation: fade .35s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── HERO + STATS ──────────────────────────────────────────── */
.hero { padding: 14px 0 26px; }
.hero h2 { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -0.8px; line-height: 1.1; }
.hero p { color: var(--muted); font-size: 15px; margin-top: 10px; max-width: 560px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .v { font-family: var(--display); font-size: 30px; font-weight: 700; }
.stat-card .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat-card .v.grad { font-size: 26px; }

.cta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 34px; }
.cta-card {
  display: flex; align-items: center; gap: 18px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; color: var(--text); font-family: var(--font); transition: all .2s ease;
}
.cta-card:hover { border-color: rgba(46,230,143,0.4); transform: translateY(-2px); box-shadow: var(--shadow); }
.cta-ico { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.cta-ico svg { width: 26px; height: 26px; color: #04130c; }
.cta-ico.img { background: linear-gradient(135deg, #0bd07f, #9bff5b); }
.cta-ico.vid { background: linear-gradient(135deg, #14c8b0, #2ee68f); }
.cta-card h3 { font-size: 17px; font-weight: 600; }
.cta-card p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.cta-arrow { margin-left: auto; font-size: 22px; color: var(--muted); transition: transform .2s; }
.cta-card:hover .cta-arrow { transform: translateX(4px); color: var(--text); }

.recent-block { margin-top: 6px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.block-head h3 { font-size: 17px; font-weight: 600; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13.5px; font-family: var(--font); }
.recent-strip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.recent-strip .empty-inline { color: var(--muted-2); font-size: 13.5px; }
.recent-thumb { height: 230px; flex: 0 0 auto; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); cursor: pointer; position: relative; background: var(--bg-2); transition: border-color .15s, transform .15s; }
.recent-thumb:hover { border-color: rgba(46,230,143,0.4); transform: translateY(-2px); }
.recent-thumb img, .recent-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.studio-recent { margin-top: 26px; }
.studio-recent .recent-thumb { height: 150px; }
.type-badge { position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; border-radius: 7px; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); display: grid; place-items: center; color: #fff; }
.type-badge svg { width: 15px; height: 15px; }
.type-badge.vid { background: rgba(46,230,143,0.92); color: #04130c; }
.type-badge.vid svg { stroke: none; }
/* ações no hover das miniaturas recentes */
.recent-thumb .ov { position: absolute; inset: 0; background: none; opacity: 0; transition: opacity .18s; display: flex; align-items: flex-end; justify-content: flex-end; gap: 6px; padding: 10px; pointer-events: none; }
.recent-thumb:hover .ov { opacity: 1; }
.recent-thumb .ov .icon-btn { width: 30px; height: 30px; }

/* ── SELETOR DE MÍDIA (biblioteca/personagens/enviar/gerar) ── */
.picker-card { width: 100%; max-width: 720px; }
.picker-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.picker-body { min-height: 300px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.picker-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; background: var(--bg); transition: border-color .15s, transform .12s; }
.picker-item:hover { transform: translateY(-2px); border-color: var(--border-2); }
.picker-item img, .picker-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-item.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.picker-item .chk { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--grad); color: #04130c; display: none; place-items: center; font-size: 13px; font-weight: 700; }
.picker-item.sel .chk { display: grid; }
.picker-item .pcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 10px; background: rgba(0,0,0,0.6); color: #fff; }
.picker-empty { min-height: 240px; display: grid; place-items: center; color: var(--muted-2); font-size: 13.5px; text-align: center; }
.picker-gen { display: flex; flex-direction: column; gap: 12px; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }

/* ── STUDIO ────────────────────────────────────────────────── */
.studio { display: grid; grid-template-columns: 430px 1fr; gap: 22px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.form-panel { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .opt { color: var(--muted-2); font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }

textarea, select, input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 14px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
textarea::placeholder, input::placeholder { color: var(--muted-2); }

/* mata o fundo branco/amarelo do autofill do Chrome (mantém o tema escuro) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
  box-shadow: 0 0 0 1000px var(--bg-2) inset;
  transition: background-color 9999s ease-out 0s;
}

.select-wrap { position: relative; }
.select-wrap::after { content: '▾'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 12px; }
select { appearance: none; cursor: pointer; padding-right: 34px; }
select option { background: #11161300; color: var(--text); background-color: #121613; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* chip de modelo (imagem) */
.model-chip { display: flex; align-items: center; gap: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.model-chip .mc-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; flex-shrink: 0; }
.model-chip .mc-ic svg { width: 18px; height: 18px; color: #04130c; }
.model-chip .mc-name { font-size: 13.5px; font-weight: 600; }
.model-chip .mc-id { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--muted); }
.model-chip .mc-price { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.model-id { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--accent-3); }

/* seletor de formato */
.ratio-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ratio-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 6px 7px; min-width: 58px; transition: all .15s; color: var(--muted); font-family: var(--font);
}
.ratio-btn:hover { border-color: var(--border-2); color: var(--text); }
.ratio-btn.active { border-color: var(--accent); background: var(--grad-soft); color: #fff; }
.ratio-shape { border: 1.6px solid currentColor; border-radius: 3px; }
.ratio-btn span { font-size: 10.5px; font-weight: 500; white-space: nowrap; }

/* contador */
.counter { display: flex; align-items: center; justify-content: space-between; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.counter button { width: 34px; height: 34px; border-radius: 8px; border: none; background: var(--surface-2); color: var(--text); font-size: 20px; cursor: pointer; transition: background .15s; }
.counter button:hover { background: var(--border-2); }
.counter span { font-size: 16px; font-weight: 600; min-width: 24px; text-align: center; }

/* prompt + menções */
.prompt-wrap { position: relative; }
.prompt-input {
  width: 100%; min-height: 96px; max-height: 260px; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.6;
  padding: 12px 14px; white-space: pre-wrap; word-break: break-word; cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.prompt-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.prompt-input.is-empty::before { content: attr(data-placeholder); color: var(--muted-2); pointer-events: none; }
.mention-tag {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  background: var(--grad-soft); border: 1px solid rgba(46,230,143,0.4); border-radius: 999px;
  padding: 1px 9px 1px 3px; margin: 0 1px; font-size: 0.9em; font-weight: 600; color: var(--accent-3);
  white-space: nowrap; user-select: none; line-height: 1.5;
}
.mention-tag img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; display: block; }
.mention-pop {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; z-index: 30;
  background: #11161300; background-color: #121814; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.mention-pop.hidden { display: none; }
.mention-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.mention-item:hover, .mention-item.active { background: var(--grad-soft); }
.mention-item .av { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: var(--bg-2); flex-shrink: 0; }
.mention-item .nm { font-size: 13.5px; font-weight: 600; }
.mention-item .hd { font-size: 11.5px; color: var(--accent); font-family: ui-monospace, monospace; }
.mention-empty { padding: 12px; font-size: 12.5px; color: var(--muted-2); }
.mention-blocked { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--muted); }
.mention-fix { align-self: flex-start; background: var(--grad); color: #04130c; border: none; border-radius: 999px; padding: 7px 14px; font-family: var(--font); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip { display: inline-flex; align-items: center; gap: 6px; background: var(--grad-soft); border: 1px solid rgba(46,230,143,0.3); border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 12px; }
.mchip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.mchip b { color: var(--accent); font-family: ui-monospace, monospace; font-weight: 600; }

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius-sm); padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; cursor: pointer;
  color: var(--muted); transition: all .15s; background: var(--bg-2);
}
.dropzone svg { width: 26px; height: 26px; color: var(--muted); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--text); background: rgba(31,224,138,0.05); }
.dropzone span { font-size: 13px; }
.dropzone b { color: var(--text); font-weight: 600; }
.dropzone small { font-size: 11px; color: var(--muted-2); }
.dropzone.small { flex-direction: row; padding: 14px; justify-content: center; }
.dropzone.small.has-img { border-style: solid; border-color: var(--accent); color: var(--text); }

.ref-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-thumb { position: relative; width: 58px; height: 58px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,0.7); color: #fff; font-size: 11px; cursor: pointer; display: grid; place-items: center; line-height: 1; }

.callout { display: flex; gap: 10px; align-items: flex-start; background: rgba(255,203,94,0.08); border: 1px solid rgba(255,203,94,0.25); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: #f3dcab; line-height: 1.45; }
.callout svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--warn); margin-top: 1px; }

.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 4px; }
.cost { font-size: 13px; color: var(--muted); }
.cost b { color: var(--text); font-weight: 600; }

.btn-primary {
  background: var(--grad); color: #04130c; border: none; border-radius: 999px;
  padding: 13px 26px; font-family: var(--font); font-size: 14.5px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-glow); transition: transform .15s, box-shadow .15s, opacity .15s;
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary .spin { width: 16px; height: 16px; border: 2.5px solid rgba(4,19,12,0.35); border-top-color: #04130c; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULT PANEL ──────────────────────────────────────────── */
.result-panel { min-height: 480px; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.result-head h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); font-size: 12.5px; }
.result-body { min-height: 220px; }
.empty { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted-2); }
.empty-ico { font-size: 44px; opacity: 0.5; line-height: 0; }
.empty-ico svg { width: 46px; height: 46px; stroke-width: 1.5; color: var(--muted); }
.empty .spin.lg { width: 32px; height: 32px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty p { font-size: 14px; text-align: center; max-width: 320px; }

/* grid de mídia — cards em tamanho controlado (vídeo NÃO ocupa tudo) */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 210px)); gap: 14px; justify-content: flex-start; }
.media-card { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: #000; animation: fade .4s ease; }
.media-card img, .media-card video { width: 100%; display: block; max-height: 380px; object-fit: contain; }
.media-card .ov { position: absolute; inset: 0; background: none; opacity: 0; transition: opacity .2s; display: flex; align-items: flex-start; justify-content: flex-end; padding: 10px; gap: 8px; pointer-events: none; }
.media-card:hover .ov { opacity: 1; }
.media-card .ov.top { align-items: flex-start; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: none; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s; pointer-events: auto; }
.icon-btn:hover { background: rgba(31,224,138,0.85); color: #04130c; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--err); color: #fff; }

/* célula pendente (imagem/vídeo gerando) */
.media-card.pending { background: var(--bg-2); display: grid; place-items: center; padding: 14px; text-align: center; gap: 10px; }
.media-card.pending .spin { width: 30px; height: 30px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.media-card.pending .ps { font-size: 12px; color: var(--muted); }
.media-card.pending .pp { font-size: 11px; color: var(--muted-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-card.error-cell { background: var(--bg-2); display: grid; place-items: center; padding: 16px; text-align: center; gap: 8px; border-color: rgba(255,107,125,0.4); }
.media-card.error-cell .ps { font-size: 11.5px; color: var(--err); }
.cell-alert { width: 26px; height: 26px; color: var(--err); }
.cell-alert svg { width: 26px; height: 26px; }

/* skeleton */
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(100deg, var(--bg-2) 30%, var(--surface-2) 50%, var(--bg-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── GALERIA ───────────────────────────────────────────────── */
.gallery-tabs { display: flex; gap: 8px; margin: 6px 0 22px; flex-wrap: wrap; }
.tab { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 9px 18px; border-radius: 999px; cursor: pointer; font-family: var(--font); font-size: 13.5px; font-weight: 500; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--grad-soft); border-color: var(--accent); color: #fff; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.g-card { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-2); cursor: pointer; transition: transform .18s, border-color .18s; }
.g-card:hover { transform: translateY(-3px); border-color: rgba(46,230,143,0.4); }
.g-card .media { aspect-ratio: 1; overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.g-card img, .g-card video { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-card .meta { padding: 10px 12px; }
.g-card .meta p { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.g-card .corner { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.g-card .fav-star { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); cursor: pointer; display: grid; place-items: center; font-size: 15px; color: #fff; }
.badge { font-size: 10px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.badge-vid { background: rgba(46,230,143,0.92); color: #04130c; }
.badge-vid svg { stroke: none; }
.badge.pending { background: rgba(255,203,94,0.92); color: #1a1205; }
.badge.error { background: rgba(255,107,125,0.92); }
.gallery-grid .empty { grid-column: 1 / -1; }

/* ── PERSONAGENS ───────────────────────────────────────────── */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 6px 0 22px; flex-wrap: wrap; }
.view-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.char-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .18s, transform .18s; }
.char-card:hover { border-color: rgba(46,230,143,0.4); transform: translateY(-2px); }
.char-cover { height: 150px; display: grid; grid-auto-flow: column; gap: 2px; background: var(--bg); overflow: hidden; }
.char-cover img { width: 100%; height: 150px; object-fit: cover; }
.char-cover.n1 { grid-template-columns: 1fr; }
.char-cover.n2 { grid-template-columns: 1fr 1fr; }
.char-cover.n3 { grid-template-columns: 1fr 1fr 1fr; }
.char-body { padding: 14px 16px; }
.char-body .nm { font-size: 15px; font-weight: 600; }
.char-body .hd { font-size: 12px; color: var(--accent); font-family: ui-monospace, monospace; margin-top: 2px; }
.char-body .ds { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.char-foot { display: flex; gap: 8px; padding: 0 16px 14px; }
.char-foot .lbtn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; font-family: var(--font); font-size: 12.5px; }
.char-foot .lbtn:hover { background: var(--surface-2); }
.char-foot .lbtn svg { width: 14px; height: 14px; }
.char-foot .lbtn.danger { color: var(--err); border-color: rgba(255,107,125,0.3); flex: 0 0 auto; }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(4,7,5,0.82); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 24px; animation: fade .2s; }
.modal.open { display: flex; }
.modal-card { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 24px; position: relative; }
.modal-card h3 { font-family: var(--display); font-size: 19px; margin-bottom: 18px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; }
.modal-card .field { margin-bottom: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-ghost { background: var(--surface); border: 1px solid var(--border-2); color: var(--text); border-radius: 999px; padding: 12px 22px; cursor: pointer; font-family: var(--font); font-size: 14px; font-weight: 500; }
.btn-ghost:hover { background: var(--surface-2); }
.handle-input { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding-left: 12px; }
.handle-input span { color: var(--accent); font-family: ui-monospace, monospace; font-weight: 600; }
.handle-input input { border: none; background: none; box-shadow: none !important; padding-left: 4px; }

/* ── LIGHTBOX ──────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(4,7,5,0.88); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 30px; animation: fade .2s; }
.lightbox.open { display: flex; }
.lb-inner { display: grid; grid-template-columns: 1fr 320px; max-width: 1100px; max-height: 88vh; width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; position: relative; }
.lb-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(0,0,0,0.5); color: #fff; font-size: 16px; cursor: pointer; }
.lb-media { background: #000; display: grid; place-items: center; min-height: 300px; }
.lb-media img, .lb-media video { max-width: 100%; max-height: 88vh; display: block; }
.lb-side { padding: 26px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.lb-side h4 { font-family: var(--display); font-size: 16px; }
.lb-prompt { font-size: 13.5px; color: var(--text); line-height: 1.5; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; max-height: 180px; overflow-y: auto; white-space: pre-wrap; }
.lb-meta { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--muted); }
.lb-meta .r { display: flex; justify-content: space-between; gap: 10px; }
.lb-meta .r b { color: var(--text); font-weight: 500; text-align: right; word-break: break-all; }
.lb-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.lb-actions .btn-line { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; font-family: var(--font); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: background .15s; }
.lb-actions .btn-line:hover { background: var(--surface-2); }
.lb-actions .btn-line svg { width: 16px; height: 16px; }
.lb-actions .btn-line.danger { color: var(--err); border-color: rgba(255,107,125,0.3); }

/* ── AJUSTES ───────────────────────────────────────────────── */
.settings-panel { max-width: 720px; display: flex; flex-direction: column; gap: 26px; }
.set-block h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.set-block h3 svg { width: 18px; height: 18px; color: var(--accent); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 16px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.set-row .k { font-size: 13.5px; color: var(--muted); }
.set-row .v { font-size: 13.5px; font-weight: 500; }
.set-row .v.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.tag-ok { color: var(--ok); }
.tag-bad { color: var(--err); }
.explain { font-size: 13px; color: var(--muted); line-height: 1.6; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; }
.explain code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--accent-3); }
.explain b { color: var(--text); }

/* ── TOASTS ────────────────────────────────────────────────── */
.toasts { position: fixed; top: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: #141a16; border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 13px 16px; min-width: 260px; max-width: 380px; box-shadow: var(--shadow); animation: toastIn .3s ease; font-size: 13.5px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 13px; font-weight: 700; }
.toast.ok .ic { background: rgba(46,230,143,0.2); color: var(--ok); }
.toast.err .ic { background: rgba(255,107,125,0.2); color: var(--err); }
.toast.info .ic { background: rgba(31,224,138,0.2); color: var(--accent); }
.toast .msg { line-height: 1.4; }

/* ── BACKDROP (mobile) ─────────────────────────────────────── */
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40; backdrop-filter: blur(2px); }
.backdrop.open { display: block; }

/* ── RESPONSIVO ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .studio { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .lb-inner { grid-template-columns: 1fr; max-height: 92vh; }
  .lb-side { max-height: 40vh; }
}
@media (max-width: 820px) {
  .main { margin-left: 0; }
  .sidebar { width: 280px; transform: translateX(-100%); transition: transform .28s ease; }
  .sidebar.open { transform: none; }
  .hamb { display: grid; place-items: center; }
  .content { padding: 8px 18px 40px; }
  .topbar { padding: 18px 18px 12px; }
  .hero h2 { font-size: 27px; }
  .cta-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .toasts { left: 12px; right: 12px; }
  .toast { min-width: 0; max-width: none; }
}

/* ═══════════════════════════════════════════════════════════
   LIQUID GLASS + POLIMENTO (estilo Apple)
   ═══════════════════════════════════════════════════════════ */
:root {
  --ease: cubic-bezier(.4, 0, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --glass-bg: rgba(13, 18, 15, 0.6);
  --glass-bg-2: rgba(16, 22, 18, 0.72);
  --glass-brd: rgba(255, 255, 255, 0.14);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

/* superfícies de vidro fosco (funciona em todos os navegadores) */
.sidebar, .panel, .stat-card, .cta-card, .model-chip,
.modal-card, .lb-inner, .toast, .picker-card, .g-card, .char-card {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(185%);
  backdrop-filter: blur(18px) saturate(185%);
  border-color: var(--glass-brd);
  box-shadow: var(--shadow), var(--glass-hi);
}
.modal-card, .lb-inner, .picker-card { background: var(--glass-bg-2); }

/* refração líquida de verdade (Chromium) — só nos OVERLAYS transitórios
   (modais/lightbox/seletor). Em superfícies sempre-visíveis o displacement
   pesa e causa jank; lá usamos vidro fosco (blur), que é leve e suave. */
@supports (backdrop-filter: url(#liquidGlass)) {
  .modal-card, .lb-inner, .picker-card { backdrop-filter: url(#liquidGlass) saturate(180%); }
}

/* ── animações ── */
@keyframes fade { from { opacity: 0; transform: translateY(10px) scale(.992); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes sheen { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(220%) skewX(-18deg); } }

.modal.open .modal-card, .modal.open .picker-card { animation: modalIn .34s var(--spring); }
.lightbox.open .lb-inner { animation: modalIn .34s var(--spring); }
.media-card, .g-card, .char-card { animation: popIn .35s var(--ease) both; }

/* transições com easing refinado */
.nav-item, .cta-card, .stat-card, .g-card, .char-card, .ratio-btn, .tab,
.icon-btn, .btn-primary, .btn-ghost, .lb-actions .btn-line, .char-foot .lbtn,
.recent-thumb, .picker-item, .media-card, .key-pill, .fav-star { transition: all .22s var(--ease); }

/* lift no hover (spring) */
.stat-card:hover, .cta-card:hover { transform: translateY(-4px); transition: transform .35s var(--spring), box-shadow .35s var(--spring), border-color .2s; border-color: rgba(46, 230, 143, 0.4); }
.g-card:hover, .char-card:hover, .recent-thumb:hover, .picker-item:hover { transform: translateY(-4px); transition: transform .35s var(--spring); }

/* press */
.btn-primary:active, .btn-ghost:active, .icon-btn:active, .ratio-btn:active, .tab:active, .nav-item:active, .lbtn:active { transform: scale(.96); }

/* botão primário: leve brilho que passa no hover */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  opacity: 0; transform: translateX(-120%) skewX(-18deg);
}
.btn-primary:hover::after { opacity: 1; animation: sheen .9s var(--ease); }

/* nav: indicador animado mais suave */
.nav-item.active::before { transition: all .3s var(--spring); }

/* ── TELA DE LOGIN ── */
.login-screen {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 28%, rgba(11, 208, 127, 0.12), transparent 58%), rgba(6, 9, 7, 0.9);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: fade .3s var(--ease);
}
.login-card {
  width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--glass-bg-2); border: 1px solid var(--glass-brd); border-radius: 24px; padding: 38px 30px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), var(--glass-hi);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  animation: modalIn .42s var(--spring);
}
.login-logo { width: 60px; height: 60px; border-radius: 16px; box-shadow: 0 8px 28px rgba(11, 208, 127, 0.35); }
.login-card h2 { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.login-card p { color: var(--muted); font-size: 12.5px; margin-top: -10px; }
.login-card input { text-align: center; font-size: 15px; margin-top: 6px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 2px; }
.login-err { color: var(--err); font-size: 12.5px; min-height: 16px; text-align: center; }
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(4px)} 30%,50%,70%{transform:translateX(-9px)} 40%,60%{transform:translateX(9px)} }
.login-card.shake { animation: shake .5s var(--ease); }

/* respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .05ms !important; }
}
