/* ===========================================================
   Burnads — Motion Light design system
   light mode + Archivo (headings) + Manrope (body) + floating islands
   =========================================================== */

:root {
  --bg-app: #F1F5F9;
  --bg-content: #F8FAFC;
  --surface: #FFFFFF;
  --surface-soft: rgba(255, 255, 255, 0.85);
  --surface-elevated: #FFFFFF;

  --text: #0F172A;
  --text-muted: #475569;
  --text-soft: #64748B;
  --text-dim: #94A3B8;

  --border: #E2E8F0;
  --border-soft: #F1F5F9;
  --border-strong: #CBD5E1;

  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: rgba(37, 99, 235, 0.10);

  --indigo: #4F46E5;
  --emerald: #10B981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --pink: #EC4899;
  --pink-soft: rgba(236, 72, 153, 0.10);
  --rose: #F43F5E;
  --rose-soft: rgba(244, 63, 94, 0.10);
  --slate-900: #0F172A;

  --grad-warm: linear-gradient(135deg, #F59E0B 0%, #EC4899 100%);
  --grad-cool: linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
  --grad-fresh: linear-gradient(135deg, #10B981 0%, #06B6D4 100%);

  --shadow-island: 0 30px 60px -20px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 24px -10px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 30px -15px rgba(15, 23, 42, 0.10);
  --shadow-glow-blue: 0 8px 24px -8px rgba(37, 99, 235, 0.35);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 32px;
  --r-pill: 999px;

  --font-archivo: 'Archivo', -apple-system, sans-serif;
  --font-manrope: 'Manrope', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  font-family: var(--font-manrope);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
::selection { background: rgba(37, 99, 235, 0.18); color: #1E3A8A; }

.font-archivo { font-family: var(--font-archivo); letter-spacing: -0.01em; }

/* =============== APP SHELL =============== */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  gap: 18px;
  padding: 18px;
  height: 100vh;
  overflow: hidden;
}

/* =============== SIDEBAR =============== */
.sidebar-island {
  background: var(--surface);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-island);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow: hidden;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
}
.brand-mark {
  font-size: 28px;
  filter: drop-shadow(0 4px 8px rgba(236, 72, 153, 0.35));
  line-height: 1;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-title {
  font-family: var(--font-archivo);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--emerald);
  background: var(--emerald-soft);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-archivo);
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.5; transform: scale(0.8); } }

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s;
  width: 100%;
}
.nav-item:hover {
  background: var(--border-soft);
  color: var(--text);
}
.nav-item-active {
  background: var(--slate-900);
  color: white;
  box-shadow: var(--shadow-glow-blue);
}
.nav-item-active:hover { background: var(--slate-900); color: white; }
.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item-mini { padding: 8px 14px; font-size: 13px; font-weight: 500; }

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.conn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim);
}
.status-dot.connected { background: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }
.status-dot.error { background: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.conn-label { font-size: 11px; color: var(--text-soft); font-family: var(--font-mono); }

/* =============== MAIN ISLAND =============== */
.main-island {
  background: var(--surface);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-island);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: 84px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar-title {
  font-family: var(--font-archivo);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.topbar-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 3px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 40px;
  background: var(--bg-content);
}
.view { display: flex; flex-direction: column; gap: 22px; }

/* =============== BUTTONS =============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.16s;
  white-space: nowrap;
  background: transparent;
}
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary {
  background: var(--slate-900);
  color: white;
  box-shadow: 0 6px 14px -4px rgba(15, 23, 42, 0.3);
}
.btn-primary:hover { background: #1E293B; transform: translateY(-1px); box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.4); }
.btn-primary:disabled { background: var(--text-dim); cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border-soft); color: var(--text); border-color: var(--border-strong); }

.btn-danger {
  background: transparent;
  color: var(--rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.btn-danger:hover { background: var(--rose-soft); }

.btn-icon-only { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--r-pill); }

/* =============== ICONS (SVG via data-icon) =============== */
[data-icon] {
  display: inline-flex;
  width: 1em;
  height: 1em;
  font-size: 16px;
  vertical-align: middle;
}
.btn [data-icon] { font-size: 14px; }
.nav-icon[data-icon] { font-size: 18px; }

/* =============== STATS / DASHBOARD =============== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
  box-shadow: var(--shadow-card);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon [data-icon] { font-size: 20px; }
.stat-icon-blue { background: var(--accent-soft); color: var(--accent); }
.stat-icon-emerald { background: var(--emerald-soft); color: var(--emerald); }
.stat-icon-amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon-pink { background: var(--pink-soft); color: var(--pink); }
.stat-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-value {
  font-family: var(--font-archivo);
  font-weight: 800;
  font-size: 26px;
  color: var(--text);
  line-height: 1.1;
}
.stat-trend { font-size: 11px; color: var(--text-dim); }

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.panel-form { padding: 26px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}
.panel-title {
  font-family: var(--font-archivo);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.panel-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }

/* Bar chart */
.chart-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 8px 0;
}
.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chart-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #2563EB 0%, #4F46E5 100%);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  min-height: 3px;
  transition: height 0.4s ease;
  position: relative;
}
.chart-bar-fill::after {
  content: attr(data-value);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}
.chart-bar-label {
  font-size: 10.5px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Status list (dashboard) */
.status-list { display: flex; flex-direction: column; gap: 8px; }
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-content);
  border-radius: var(--r-md);
}
.status-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-row-label { flex: 1; font-size: 13px; font-weight: 500; }
.status-row-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pipeline-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.pipeline-step {
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pipeline-step-name {
  font-family: var(--font-archivo);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.pipeline-step-value {
  font-family: var(--font-archivo);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.pipeline-step-meta { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 1.6fr;
  gap: 12px;
}
.lib-stat {
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-stat-label {
  font-family: var(--font-archivo);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}
.lib-stat-value {
  font-family: var(--font-archivo);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}
.lib-stat-path-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  word-break: break-all;
  margin-top: 2px;
}
.lib-stat-help {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 4px;
  line-height: 1.45;
}
@media (max-width: 900px) {
  .library-grid { grid-template-columns: 1fr 1fr; }
  .lib-stat-path { grid-column: 1 / -1; }
}

/* =============== FORMS =============== */
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-archivo);
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--text-dim); }
.form-textarea {
  resize: vertical;
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}
select.form-input { cursor: pointer; }
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}
.form-actions-modal { margin-top: 8px; }

/* =============== EXPLORER =============== */
.explorer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: 12px 18px;
  box-shadow: var(--shadow-card);
}
.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.crumb:hover { background: var(--border-soft); color: var(--text); }
.crumb-active { background: var(--accent-soft); color: var(--accent); }
.crumb-sep { color: var(--text-dim); font-size: 12px; }

.explorer-actions { display: flex; align-items: center; gap: 10px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  width: 240px;
  color: var(--text-soft);
}
.search-box [data-icon] { font-size: 14px; color: var(--text-dim); }
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  width: 100%;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.folder-tile {
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.folder-tile:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.folder-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.folder-tile-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.folder-tile-icon [data-icon] { font-size: 18px; }
.folder-tile-edit {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.folder-tile:hover .folder-tile-edit { opacity: 1; }
.folder-tile-edit:hover { background: var(--border-soft); color: var(--text); }
.folder-tile-name {
  font-family: var(--font-archivo);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-tile-meta {
  font-size: 11px;
  color: var(--text-soft);
  font-family: var(--font-mono);
}

.creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.creative-grid.list-mode {
  grid-template-columns: 1fr;
  gap: 8px;
}
.creative-tile {
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  user-select: none; /* evita highlight de texto no Shift+clique de seleção */
}
.creative-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.creative-tile-thumb {
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
}
.creative-tile-thumb [data-icon] { font-size: 36px; }
.creative-tile-folder-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}
.creative-tile-folder-dot { width: 6px; height: 6px; border-radius: 50%; }
/* Círculo selecionável — SÓ no modo lista, à esquerda do thumb */
.ct-select { display: none; }
.creative-grid.list-mode .ct-select {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.creative-grid.list-mode .ct-select:hover { border-color: #2563EB; }
.creative-grid.list-mode .ct-select:disabled { opacity: 0.3; cursor: not-allowed; }
.creative-grid.list-mode .creative-tile.is-selected .ct-select {
  background: #2563EB;
  border-color: #2563EB;
}
.creative-grid.list-mode .creative-tile.is-selected .ct-select::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.creative-tile.is-selected {
  border-color: #2563EB;
  outline: 2px solid #2563EB;
  outline-offset: -1px;
  box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.35);
}
.creative-tile-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}
.creative-tile-progress-fill {
  height: 100%;
  background: var(--grad-cool);
  transition: width 0.4s;
}
.creative-tile-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.creative-tile-title {
  font-family: var(--font-archivo);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.creative-tile-meta {
  font-size: 11px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.creative-tile-actions {
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.creative-tile-actions .btn { flex: 1; justify-content: center; padding: 6px 10px; font-size: 12px; }

/* List mode */
.creative-grid.list-mode .creative-tile {
  flex-direction: row;
  align-items: center;
  padding: 8px 14px;
}
.creative-grid.list-mode .creative-tile-thumb {
  width: 48px;
  aspect-ratio: 9/16;
  flex-shrink: 0;
  border-radius: var(--r-sm);
}
.creative-grid.list-mode .creative-tile-thumb [data-icon] { font-size: 16px; }
.creative-grid.list-mode .creative-tile-folder-tag { display: none; }
.creative-grid.list-mode .creative-tile-body {
  flex: 1;
  padding: 0 14px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.creative-grid.list-mode .creative-tile-actions { border-top: none; padding: 0; }
.creative-grid.list-mode .creative-tile-actions .btn { flex: initial; }

/* View mode toggle */
.view-mode {
  display: inline-flex;
  background: var(--bg-content);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.vm-btn {
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.vm-btn:hover { color: var(--text); }
.vm-btn.vm-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }

/* Badges (status) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-archivo);
}
.badge-draft { background: var(--border-soft); color: var(--text-soft); }
.badge-queued { background: var(--amber-soft); color: var(--amber); }
.badge-tts, .badge-transcribing, .badge-matching, .badge-rendering {
  background: var(--pink-soft); color: var(--pink);
}
.badge-done { background: var(--emerald-soft); color: var(--emerald); }
.badge-failed { background: var(--rose-soft); color: var(--rose); }

/* Empty states */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-soft);
}
.empty-state [data-icon] {
  font-size: 36px;
  color: var(--text-dim);
}

/* Lists genéricas */
.list { display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.list-row-title { font-weight: 600; font-size: 13.5px; }
.list-row-meta { font-size: 11px; color: var(--text-soft); margin-top: 2px; font-family: var(--font-mono); }

/* =============== MODALS / OVERLAYS =============== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  /* Em vez de flex+align-center (que faz card grande estourar pra cima da
     viewport), usamos overflow-y:auto no overlay e padding-y pra centrar
     visualmente quando cabe e scrollar quando não cabe. */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.overlay::before,
.overlay::after {
  content: "";
  display: block;
  flex: 1 0 auto;
}
.overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-island);
  animation: slideUp 0.25s ease;
  position: relative;
}
.modal-card-lg { max-width: 720px; }

/* Modal de detalhe — scroll é do overlay agora, card só precisa de
   flex-shrink:0 pra não ser comprimido. */
#modal-creative-card {
  flex-shrink: 0;
  max-width: 720px;
  width: 100%;
}

/* Vídeo final: respeita aspect 9:16, encaixa no card sem estourar.
   max-width limitado em ~360px (aspect 9:16 → ~640px de altura, dentro do card). */
#cd-video {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  object-fit: contain;
}
@media (max-width: 520px) {
  #cd-video { max-width: 100%; max-height: 60vh; }
  .modal-card-lg { padding: 18px; }
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-content); color: var(--text); }

.creative-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}
.creative-detail-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.creative-detail-progress .progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-content);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.creative-detail-progress .progress-bar-fill {
  height: 100%;
  background: var(--grad-cool);
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 12px;
  color: var(--text-soft);
  font-family: var(--font-mono);
}

.creative-detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-content);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
}
.cd-section-label {
  font-family: var(--font-archivo);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cd-section-empty {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
}
.cd-copy {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.cd-transcript {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.cd-transcript-meta {
  font-size: 11px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  margin-top: 4px;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.modal-icon [data-icon] { font-size: 22px; }
.modal-title {
  font-family: var(--font-archivo);
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.modal-sub {
  font-size: 13.5px;
  color: var(--text-soft);
  margin-top: -8px;
  margin-bottom: 8px;
}
.modal-error {
  background: var(--rose-soft);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--rose);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-weight: 500;
}

/* Color picker */
.color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch-active { border-color: var(--text); transform: scale(1.05); }

/* Folder picker (move modal) */
.folder-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.folder-pick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  background: var(--bg-content);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.15s;
}
.folder-pick-row:hover { background: var(--surface); border-color: var(--accent); }
.folder-pick-icon { width: 22px; height: 22px; border-radius: var(--r-sm); flex-shrink: 0; }
.folder-pick-icon-empty {
  background: transparent;
  border: 1.5px dashed var(--text-dim);
}
.folder-pick-name { flex: 1; font-weight: 600; font-size: 13.5px; }
.folder-pick-count { font-size: 11px; color: var(--text-soft); font-family: var(--font-mono); }

/* =============== TOAST =============== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  max-width: 360px;
  box-shadow: var(--shadow-soft);
  animation: toast-in 0.2s ease-out;
}
.toast.success { border-left: 3px solid var(--emerald); }
.toast.error   { border-left: 3px solid var(--rose); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* =============== RESPONSIVE =============== */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar-island { display: none; }
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .pipeline-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .explorer-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .search-box { width: 100%; }
}

/* ===== Integrações ===== */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.integration-card {
  background: #fff;
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
}
.integration-card.is-connected { border-color: #10B981; box-shadow: 0 0 0 1px #10B98133; }
.integration-card.is-disabled { opacity: .55; }
.integration-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.integration-name { font-size: 16px; font-weight: 700; }
.integration-status { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #F1F5F9; color: #64748B; white-space: nowrap; }
.integration-status.is-on { background: #D1FAE5; color: #065F46; }
.integration-desc { font-size: 13px; color: #64748B; line-height: 1.4; }
.integration-key { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.integration-key input {
  flex: 1 1 160px;
  min-width: 0;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 13px;
}
.integration-key .btn { white-space: nowrap; }
.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-top: 4px;
}
.integration-actions .btn { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
.integration-actions > label { font-size: 13px; }
.integration-meta { font-size: 11px; color: #94A3B8; font-family: ui-monospace, monospace; word-break: break-all; }

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

/* ===== Scene matches no detail modal ===== */
.cd-matches { display: flex; flex-direction: column; gap: 8px; }
.cd-match-row {
  display: grid;
  grid-template-columns: 54px 60px 1fr;
  gap: 10px;
  padding: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  font-size: 13px;
  align-items: center;
}
.cd-match-thumb {
  width: 54px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  background: #1E293B;
  display: block;
}
@media (max-width: 520px) {
  .cd-match-row { grid-template-columns: 42px 50px 1fr; }
  .cd-match-thumb { width: 42px; height: 74px; }
}
.cd-match-row .ts {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: #64748B;
  font-weight: 600;
}
.cd-match-row .text { color: #1F2937; font-weight: 500; }
.cd-match-row .scene { color: #475569; font-size: 12px; margin-top: 4px; }
.cd-match-row .scene-name { color: #0F766E; font-weight: 600; }
.cd-match-row .reason { color: #94A3B8; font-size: 11px; font-style: italic; margin-top: 4px; }
.cd-matches-meta { font-size: 11px; color: #94A3B8; margin-top: 6px; text-align: right; }

/* ===== Wizard de 4 etapas ===== */
.wizard { display: flex; flex-direction: column; gap: 18px; }
.wizard-progress {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #F8FAFC;
  border-radius: 14px;
  overflow: hidden;
  font-size: 13px;
}
.wizard-step {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  color: #94A3B8;
  font-weight: 600;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-right: 1px solid #E2E8F0;
}
.wizard-step:last-child { border-right: 0; }
.wizard-step .wn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #64748B;
  font-size: 12px;
  flex-shrink: 0;
}
.wizard-step.is-active { color: #0F172A; background: #FFF; }
.wizard-step.is-active .wn { background: var(--brand, #2563EB); color: #fff; }
.wizard-step.is-done { color: #10B981; }
.wizard-step.is-done .wn { background: #10B981; color: #fff; font-size: 0; }
.wizard-step.is-done .wn::before { content: "✓"; font-size: 12px; }
@media (max-width: 640px) {
  .wizard-step { font-size: 11px; padding: 10px 6px; flex-direction: column; gap: 4px; }
  .wizard-step .wn { width: 20px; height: 20px; }
}

.wizard-pane { display: none; flex-direction: column; gap: 14px; }
.wizard-pane.is-active { display: flex; }
.wizard-pane[hidden] { display: none !important; }
.wizard-pane-title { font-family: var(--font-archivo, sans-serif); font-size: 20px; font-weight: 700; margin: 0; color: #0F172A; }
.wizard-pane-sub { font-size: 13px; color: #64748B; margin: -8px 0 4px 0; }

.wizard-nav { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.wizard-nav-spacer { flex: 1; }

/* Subtitle style cards */
.subtitle-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 6px; }
.sub-style-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 2px solid #E5E7EB;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}
.sub-style-card input { margin: 4px 0 0 0; flex-shrink: 0; }
.sub-style-card:hover { border-color: #93C5FD; }
.sub-style-card:has(input:checked) { border-color: #2563EB; background: #EFF6FF; }
.sub-style-body { display: flex; flex-direction: column; gap: 2px; }
.sub-style-name { font-weight: 600; font-size: 13px; color: #1F2937; }
.sub-style-desc { font-size: 11px; color: #64748B; line-height: 1.3; }

/* ---------- Etapa 0: Modelo do criativo (grid de cards) ---------- */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
@media (max-width: 640px) {
  .model-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
.model-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
  font-family: var(--font-manrope);
}
.model-card:hover { border-color: #93C5FD; transform: translateY(-2px); }
.model-card.is-selected {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow-blue), 0 0 0 3px var(--accent-soft);
}
.model-card-desc {
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* galerias dos 3 pilares (hook/body/cta) — reusam .model-card */
.pillar-grid {
  max-height: 440px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.pillar-card-label {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}
/* bullets técnicos do modelo */
.model-card-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10.5px;
  color: var(--text-soft);
  line-height: 1.3;
  text-align: left;
}
.model-card-bullets li {
  padding-left: 12px;
  position: relative;
}
.model-card-bullets li::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: 700;
}
/* preview-herói: o nome do modelo estilizado É a cara do card */
.model-preview {
  border-radius: var(--r-sm);
  padding: 18px 10px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.model-preview-txt {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  justify-content: flex-start;
}
.toggle-row > div { flex: 1; min-width: 0; }
.toggle-row strong { display: block; margin-bottom: 2px; }
.toggle-row .form-help { margin: 0; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch span {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  transition: 0.2s;
  border-radius: 26px;
}
.toggle-switch span:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
.toggle-switch input:checked + span { background-color: #2563EB; }
.toggle-switch input:checked + span:before { transform: translateX(20px); }

/* Radio pills */
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid #E5E7EB;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.radio-pill input { margin: 0; }
.radio-pill:hover { border-color: #93C5FD; }
.radio-pill:has(input:checked) { border-color: #2563EB; background: #EFF6FF; color: #1E40AF; font-weight: 600; }

/* ===== Form collapsible (filtro de pastas, etc) ===== */
.form-collapsible {
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 10px;
  background: #fff;
  padding: 0;
}
.form-collapsible-head {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.form-collapsible-head .cap-tag {
  font-size: 11px;
  background: #F1F5F9;
  color: #64748B;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.form-collapsible[open] .cap-tag { background: #DBEAFE; color: #1E40AF; }
.form-collapsible-body { padding: 12px 14px 16px; border-top: 1px solid #F1F5F9; }
.form-help { font-size: 12px; color: #64748B; }
.filter-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.filter-summary-row .form-help { margin: 0; }
.folders-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px 12px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 8px;
  padding-right: 8px;
}
.folder-cb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.folder-cb:hover { background: #F8FAFC; }
.folder-cb-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  overflow: hidden;
}
.folder-cb-label > span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-cb input { margin: 0; flex-shrink: 0; }
.folder-cb .count { color: #94A3B8; font-size: 10px; margin-left: auto; flex-shrink: 0; }
.folder-cb .enter-btn {
  border: 0;
  background: #DBEAFE;
  color: #1E40AF;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 600;
  white-space: nowrap;
}
.folder-cb .enter-btn:hover { background: #93C5FD; transform: translateX(2px); }

/* Grid de cenas dentro de uma pasta (drill-down do filtro) */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 130px);
  grid-auto-rows: min-content;
  align-items: start;
  gap: 10px;
  justify-content: start;
  margin-top: 8px;
  min-height: 0;
  flex-shrink: 0;
  max-height: 70vh;
  overflow-y: auto;
  padding: 2px;
}
.scene-tile {
  position: relative;
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  background: #fff;
  border: 2px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
}
.scene-tile:hover { border-color: #93C5FD; }
.scene-tile.is-selected { border-color: #2563EB; background: #EFF6FF; }
/* Thumb 9:16 vertical — aspect-ratio é mais robusto que padding-bottom
   hack, especialmente dentro de grid com align-items default. */
.scene-tile .st-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #1E293B;
  overflow: hidden;
  display: block;
}
.scene-tile .st-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scene-tile .st-name {
  font-size: 10px;
  padding: 4px 6px;
  color: #475569;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.scene-tile .st-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #2563EB;
  font-weight: bold;
}
.scene-tile.is-selected .st-check { background: #2563EB; border-color: #2563EB; color: white; }
.scenes-grid-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* ===== Library list ===== */
.lib-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
}
.lib-breadcrumb .crumb {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #475569;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
}
.lib-breadcrumb .crumb:hover { background: #E2E8F0; }
.lib-breadcrumb .crumb.crumb-active { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }
.lib-breadcrumb .crumb-sep { color: #CBD5E1; }

.lib-reindex-progress {
  margin: 12px 0;
  padding: 10px 14px;
  background: linear-gradient(90deg, #EFF6FF, #DBEAFE);
  border: 1px solid #93C5FD;
  border-radius: 10px;
}
.lrp-bar {
  height: 8px;
  background: #DBEAFE;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.lrp-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #2563EB);
  width: 0%;
  transition: width 0.4s ease;
}
.lrp-label { font-size: 12px; color: #1E40AF; font-family: ui-monospace, monospace; }

.lib-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* Card de PASTA (modo lista de pastas) */
.lib-folder-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s;
}
.lib-folder-card:hover { border-color: #2563EB; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.1); }
.lib-folder-card .lf-icon { font-size: 32px; line-height: 1; }
.lib-folder-card .lf-name { font-weight: 700; font-size: 14px; color: #1F2937; word-break: break-word; }
.lib-folder-card .lf-meta { font-size: 11px; color: #94A3B8; display: flex; gap: 8px; flex-wrap: wrap; }
.lib-folder-card .lf-meta span { padding: 2px 6px; background: #F1F5F9; border-radius: 6px; }

/* Card de CENA (modo dentro de pasta) */
.lib-scene-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s;
}
.lib-scene-card:hover { border-color: #2563EB; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.06); }
.lib-scene-card .lsc-thumb-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 177.78%;  /* 9:16 vertical */
  background: #1E293B;
  overflow: hidden;
}
.lib-scene-card .lsc-thumb-wrap img,
.lib-scene-card .lsc-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lib-scene-card .lsc-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.lib-scene-card .lsc-name {
  font-weight: 600;
  font-size: 12px;
  color: #1F2937;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.lib-scene-card .lsc-meta { font-size: 10px; color: #94A3B8; display: flex; gap: 6px; flex-wrap: wrap; }
.lib-scene-card .lsc-meta span { padding: 1px 5px; background: #F1F5F9; border-radius: 4px; }
.lib-scene-card .lsc-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(220, 38, 38, 0.85);
  color: white;
  border: 0;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: 2;
}
.lib-scene-card { position: relative; }
.lib-scene-card:hover .lsc-delete { display: flex; }

.lib-empty { padding: 40px; text-align: center; color: #94A3B8; grid-column: 1 / -1; }
.btn-danger { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
.btn-danger:hover { background: #FCA5A5; }

/* ===== AI Suggest box ===== */
.ai-suggest-box {
  background: linear-gradient(135deg, #FEF3C7 0%, #DBEAFE 100%);
  border: 1px solid #FCD34D;
  border-radius: 14px;
  padding: 14px 16px;
}
.ai-suggest-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ai-suggest-body { font-size: 13px; color: #1F2937; }
.ai-suggest-body .row { margin-bottom: 6px; }
.ai-suggest-body .label { font-weight: 600; color: #475569; margin-right: 6px; }
.ai-suggest-body .rationale { font-style: italic; color: #64748B; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #FCD34D88; }

/* ===== Biblioteca: menu superior (tabs por tipo de asset) ===== */
.lib-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 5px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  overflow-x: auto;
}
.lib-tab {
  flex: 1;
  min-width: 150px;
  padding: 11px 18px;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.lib-tab:hover:not(.lib-tab-active) {
  background: var(--bg-content);
  color: #1E293B;
}
.lib-tab-active {
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.25);
}
.lib-tab-active:hover {
  background: #1E293B;
}

/* ===== Cards de asset genérico (música/símbolo/SFX) ===== */
.lib-asset-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.lib-asset-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.lib-asset-card .lac-name {
  font-size: 13px;
  font-weight: 600;
  color: #1F2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-asset-card .lac-meta {
  font-size: 11px;
  color: #64748B;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.lib-asset-card .lac-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, 0.9);
  color: #FFF;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.lib-asset-card:hover .lac-delete { opacity: 1; }
.lib-asset-card .lac-audio {
  width: 100%;
  height: 32px;
  margin-top: 4px;
}
.lib-asset-card .lac-symbol-wrap {
  background: #0F172A;
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.lib-asset-card .lac-symbol-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* Preview de hook — vídeo vertical 9:16 (Reels/TikTok) */
.lib-asset-card .lac-video-wrap {
  background: #0F172A;
  border-radius: 8px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
}
.lib-asset-card .lac-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Grid de assets (música/símbolo/SFX) */
.lib-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.lib-asset-grid.symbols {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.lib-asset-grid.hooks {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* Galeria visual de hooks no wizard (passo Básico) — com drill-down de pastas */
.hook-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.hook-card, .hook-folder-card {
  width: 104px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: inherit;
}
.hook-picker .hk-thumb {
  width: 104px;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: #0F172A;
  border: 2px solid transparent;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.hook-picker .hk-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hook-picker .hk-thumb.hk-none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: var(--surface);
  border: 2px dashed #CBD5E1;
}
.hook-picker .hk-thumb.hk-folder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--surface);
  border: 2px solid #E2E8F0;
}
.hook-picker .hk-name {
  font-size: 11px;
  color: #475569;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 104px;
}
.hook-card:hover .hk-thumb,
.hook-folder-card:hover .hk-thumb {
  border-color: var(--accent);
}
.hook-card.hook-card-selected .hk-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hook-card.hook-card-selected .hk-name {
  color: var(--accent);
  font-weight: 600;
}
/* Breadcrumb dentro do picker (quando dentro de uma pasta) */
.hook-breadcrumb {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #475569;
  margin-bottom: 2px;
}
.hook-back {
  border: 1px solid #E2E8F0;
  background: #FFF;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
}
.hook-back:hover { border-color: var(--accent); background: var(--accent-soft); }
.hk-crumb-cur { font-weight: 600; }

/* Progress de upload (reusa lrp-bar/lrp-fill com wrapper próprio) */
.lib-upload-progress {
  margin-top: 12px;
  padding: 10px 12px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 10px;
}

/* ===== Multi-select de cenas ===== */
.lib-scenes-header {
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--bg-content);
  border-radius: 10px;
  display: flex;
  align-items: center;
}
.lib-select-all-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #475569;
  user-select: none;
}
.lib-select-all-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.lib-scenes-header { grid-column: 1 / -1; }
.scenes-grid-wrapper {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, 180px);
  gap: 14px;
  justify-content: start;
}

/* Checkbox no card de cena */
.lib-scene-card { position: relative; }
.lib-scene-card .lsc-checkbox {
  position: absolute !important;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  z-index: 10;
  accent-color: #2563EB;
  background: #FFFFFF;
  border: 2px solid #FFFFFF;
  border-radius: 4px;
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  appearance: auto;
  -webkit-appearance: checkbox;
  display: inline-block;
  margin: 0;
  padding: 0;
  transition: transform 0.1s;
}
.lib-scene-card:hover .lsc-checkbox { transform: scale(1.1); }
.lib-scene-card.is-selected {
  outline: 3px solid #2563EB;
  outline-offset: -1px;
  box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.35);
}
.lib-scene-card.is-selected .lsc-checkbox {
  transform: scale(1.1);
}

/* Barra de ação flutuante (multi-select) */
.lib-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 16px 12px 20px;
  background: #0F172A;
  color: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 100;
  animation: lab-slide-up 0.2s ease-out;
}
@keyframes lab-slide-up {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.lib-action-bar .lab-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}
.lib-action-bar .lab-info strong {
  font-size: 18px;
  color: #FACC15;
  font-weight: 700;
}
.lib-action-bar .lab-actions {
  display: flex;
  gap: 8px;
}
.lib-action-bar .btn-ghost {
  background: rgba(255,255,255,0.08);
  color: #FFFFFF;
  border-color: rgba(255,255,255,0.15);
}
.lib-action-bar .btn-ghost:hover { background: rgba(255,255,255,0.15); }
