/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #0f1117;
  --bg-1: #181a22;
  --bg-2: #22252f;
  --bg-3: #2c303c;
  --bg-hover: #323643;
  --border: #363a48;
  --text-0: #f0f1f5;
  --text-1: #b0b4c4;
  --text-2: #787e94;
  --accent: #6c8dfa;
  --accent-hover: #8aa4fb;
  --accent-dim: #6c8dfa30;
  --success: #4ade80;
  --success-dim: #4ade8020;
  --danger: #f87171;
  --danger-dim: #f8717120;
  --warning: #fbbf24;
  --radius: 8px;
  --radius-sm: 4px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text-0);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* ── Top Bar ──────────────────────────────────────────────────── */
#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  height: 56px;
  gap: 16px;
}

.top-left { display: flex; align-items: center; gap: 16px; }
.top-left h1 { font-size: 16px; font-weight: 600; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 12px; }

.label {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-2);
  padding: 4px 10px;
  border-radius: 20px;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-group label {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

select, input[type="password"] {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}


/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-0);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger-dim);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.btn-icon:hover { color: var(--text-0); }

/* ── Layout ───────────────────────────────────────────────────── */
#app {
  display: flex;
  height: calc(100vh - 56px);
}

#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

#project-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ── Config Panel (sidebar bottom) ───────────────────────────── */
#config-section {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

#config-details > summary {
  list-style: none;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

#config-details > summary::before {
  content: "▸";
  font-size: 9px;
  transition: transform 0.15s;
}

#config-details[open] > summary::before { transform: rotate(90deg); }
#config-details > summary::-webkit-details-marker { display: none; }

.config-body {
  padding: 6px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-row label {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  width: 76px;
  flex-shrink: 0;
}

.config-row select,
.config-row input[type="password"] {
  flex: 1;
  width: 0;
  font-size: 12px;
  padding: 4px 8px;
}

.sidebar-section { padding: 16px; }
.sidebar-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 10px;
}

#main-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Project Info Panel (persistent right sidebar) */
#project-info-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Asset Panel (overlay on top of project info panel) */
#asset-panel {
  width: 360px;
  min-width: 360px;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.asset-panel-overlay {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  z-index: 40;
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
}

.panel-header h3 {
  font-size: 13px;
  font-weight: 600;
}

/* ── Chat Panel ──────────────────────────────────────────────── */
#chat-panel {
  width: 340px;
  min-width: 340px;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg {
  display: flex;
}

.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }

.chat-msg-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.user .chat-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-msg.assistant .chat-msg-bubble {
  background: var(--bg-2);
  color: var(--text-0);
  border-bottom-left-radius: 2px;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
}

/* ── Launcher ────────────────────────────────────────────────── */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-2);
  text-align: center;
  gap: 8px;
}

.launcher { max-width: 600px; }
.launcher h2 { font-size: 22px; color: var(--text-0); margin-bottom: 4px; }
.launcher-sub { font-size: 14px; color: var(--text-2); margin-bottom: 24px; }

.launcher-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.launcher-card {
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.launcher-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.launcher-icon { font-size: 32px; margin-bottom: 10px; }
.launcher-card h3 { font-size: 16px; color: var(--text-0); margin-bottom: 6px; }
.launcher-card p { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.launcher-hint { font-size: 12px; color: var(--text-2); }

/* ── Type badges in sidebar ──────────────────────────────────── */
.type-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: auto;
  flex-shrink: 0;
}

.img-tag { background: var(--accent-dim); color: var(--accent); }
.video-tag { background: rgba(251,191,36,0.15); color: var(--warning); }

/* ── Project List ─────────────────────────────────────────────── */
.project-client {
  margin-bottom: 12px;
}

.client-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  text-transform: capitalize;
}

.brief-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-1);
  transition: all 0.1s;
}

.brief-item:hover { background: var(--bg-hover); color: var(--text-0); }
.brief-item.active { background: var(--accent-dim); color: var(--accent); }

.brief-item .icon {
  font-size: 16px;
  opacity: 0.6;
}

.brief-item-name { flex: 1; }

.brief-delete-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: all 0.15s;
  line-height: 1;
}

.brief-item:hover .brief-delete-btn { opacity: 1; }
.brief-delete-btn:hover { color: var(--danger); }

/* ── Position Tabs ────────────────────────────────────────────── */
#position-tabs-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  position: sticky;
  top: 0;
  z-index: 5;
}

#position-tabs {
  display: flex;
  overflow-x: auto;
  flex: 1;
}

.pos-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}

.pos-tab:hover { color: var(--text-0); background: var(--bg-2); }
.pos-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.pos-tab .status-dot { margin-left: 6px; }

.status-dot.done { background: var(--success); }
.status-dot.error { background: var(--danger); }
.status-dot.generating { background: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Position Content ─────────────────────────────────────────── */
.position-view {
  padding: 24px;
  max-width: 1000px;
}

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

.position-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.position-actions {
  display: flex;
  gap: 8px;
}

/* Prompt editor */
.prompt-section { margin-bottom: 24px; }

.prompt-section label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

textarea.prompt-input {
  width: 100%;
  min-height: 160px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--mono);
  line-height: 1.6;
  resize: vertical;
}

.prompt-meta {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-2);
}

/* Reference images */
.ref-images-section { margin-bottom: 24px; }

.ref-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ref-image-card {
  width: 120px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.ref-image-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  cursor: pointer;
}

.ref-image-card .ref-name {
  font-size: 10px;
  color: var(--text-2);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-image-card .btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: var(--danger);
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.ref-image-card:hover .btn-remove { opacity: 1; }

.ref-add-btn {
  width: 120px;
  height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  gap: 4px;
  transition: all 0.15s;
}

.ref-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ref-add-btn .plus { font-size: 24px; }

/* Output preview */
.output-section { margin-bottom: 24px; }

.output-preview {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.output-preview img {
  max-width: 100%;
  max-height: 500px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.output-preview .empty {
  color: var(--text-2);
  padding: 60px 0;
  font-size: 13px;
}

/* ── Refine section ───────────────────────────────────────────── */
.refine-section {
  margin-bottom: 24px;
}

.refine-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.refine-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
}

.refine-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.refine-input::placeholder {
  color: var(--text-2);
  font-style: italic;
}

.refine-status {
  margin-top: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.refine-loading {
  color: var(--warning);
  background: rgba(251,191,36,0.1);
}

.refine-success {
  color: var(--success);
  background: var(--success-dim);
}

.refine-error {
  color: var(--danger);
  background: var(--danger-dim);
}

/* ── Output versions ──────────────────────────────────────────── */
.output-all-versions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.version-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.version-block.latest {
  border-color: var(--accent);
}

.version-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.version-label {
  font-weight: 700;
  color: var(--text-0);
  font-size: 11px;
}

.version-block.latest .version-label {
  color: var(--accent);
}

.version-date { color: var(--text-2); }
.version-size { color: var(--text-2); margin-left: auto; }

.version-img-wrap {
  cursor: pointer;
  text-align: center;
  padding: 8px;
  background: var(--bg-1);
  position: relative;
}

.version-img-wrap img {
  max-width: 100%;
  max-height: 340px;
  border-radius: var(--radius-sm);
}

.version-img-wrap::after {
  content: "Click to view full resolution";
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.version-img-wrap:hover::after {
  opacity: 1;
}

/* Older versions — small grid */
.version-older-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.version-thumb {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.version-thumb:hover { border-color: var(--accent); }

.version-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.regen-row {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}

.regen-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font);
}

.regen-input::placeholder { color: var(--text-2); font-style: italic; }

.version-thumb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  font-size: 10px;
  color: var(--text-2);
}

/* ── Draft star toggle ───────────────────────────────────────── */
.draft-star {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-2);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: all 0.15s;
  opacity: 0.4;
}

.draft-star:hover { opacity: 1; color: var(--warning); }
.draft-star.active { opacity: 1; color: var(--warning); }

.draft-star-sm {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}

.draft-star-sm:hover { color: var(--warning); }
.draft-star-sm.active { color: var(--warning); background: rgba(0,0,0,0.7); }

.version-thumb { position: relative; }

.version-block.draft-selected { border-color: var(--warning); }
.version-thumb.draft-selected { border-color: var(--warning); }

/* ── Asset Gallery ────────────────────────────────────────────── */
.asset-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-1);
  z-index: 1;
}

.asset-search-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.asset-count {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

#asset-gallery {
  padding: 8px;
}

.asset-folder-section {
  margin-bottom: 4px;
}

.folder-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.folder-toggle:hover { background: var(--bg-hover); color: var(--text-0); }
.folder-toggle .arrow { transition: transform 0.15s; font-size: 9px; color: var(--text-2); }
.folder-toggle .arrow.open { transform: rotate(90deg); }
.folder-count { font-size: 10px; color: var(--text-2); font-weight: 400; margin-left: auto; }

.folder-gallery-children { display: none; padding-left: 4px; }
.folder-gallery-children.open { display: block; }

.asset-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px 0 8px;
}

.asset-card {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  background: var(--bg-2);
}

.asset-card:hover { border-color: var(--accent); }
.asset-card.assigned { border-color: var(--success); }

.asset-card-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.asset-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-card-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--text-2);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.15s;
}

.asset-card.assigned .asset-card-check {
  background: var(--success);
  color: #000;
}

.asset-card-name {
  font-size: 10px;
  color: var(--text-2);
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--bg-2);
}

/* ── Output Gallery (sidebar) ─────────────────────────────────── */
.output-thumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.output-thumb-item:hover { background: var(--bg-hover); }

.output-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
}

.output-info {
  flex: 1;
  min-width: 0;
}

.output-info .pos-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
}

.output-info .file-size {
  font-size: 11px;
  color: var(--text-2);
}

/* ── Lightbox ─────────────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.lightbox-content img {
  max-width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}

.lightbox-info {
  font-size: 12px;
  color: var(--text-2);
  background: rgba(0,0,0,0.6);
  padding: 4px 10px;
  border-radius: 10px;
}

#lightbox-close {
  background: var(--bg-2);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 48px;
  width: 56px;
  height: 80px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.15s;
  user-select: none;
}

.lightbox-arrow:hover { background: rgba(0,0,0,0.8); }
.lightbox-arrow-left { left: 12px; }
.lightbox-arrow-right { right: 12px; }

.lightbox-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-0);
  flex: 1 1 180px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  #lightbox { padding: 8px; }
  .lightbox-content { gap: 6px; }
  .lightbox-toolbar { padding: 6px 8px; gap: 6px; }
  .lightbox-name { flex: 1 1 100%; order: -1; }
  .lightbox-arrow {
    width: 38px;
    height: 56px;
    font-size: 30px;
  }
  .lightbox-arrow-left { left: 4px; }
  .lightbox-arrow-right { right: 4px; }
}

@media (max-height: 480px) {
  #lightbox { padding: 6px; }
  .lightbox-content { gap: 4px; }
  .lightbox-toolbar { padding: 4px 8px; gap: 6px; }
}

/* ── Progress Overlay ─────────────────────────────────────────── */
#progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.progress-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  min-width: 600px;
  max-width: 900px;
  width: 92vw;
}

.progress-card h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.gen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gen-count {
  font-size: 13px;
  color: var(--text-2);
}

.gen-count strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

#gen-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
  max-height: 55vh;
  overflow-y: auto;
}

.gen-slot {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  transition: border-color 0.25s;
}

.gen-slot.active { border-color: var(--accent, #7c6af7); }
.gen-slot.done   { border-color: var(--success, #2ecc71); }
.gen-slot.error  { border-color: var(--danger,  #e74c3c); }

.gen-slot-img {
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-3);
}

.gen-slot-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: genShimmer 1.8s infinite linear;
}

@keyframes genShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gen-slot-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gen-slot-info {
  padding: 5px 8px 7px;
}

.gen-slot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-slot-stage {
  font-size: 10px;
  color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s;
}

.gen-slot.active .gen-slot-stage { color: var(--accent, #7c6af7); }
.gen-slot.done   .gen-slot-stage { color: var(--success, #2ecc71); }
.gen-slot.error  .gen-slot-stage { color: var(--danger,  #e74c3c); }

#progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.progress-item.active { color: var(--text-0); }
.progress-item.done { color: var(--success); }
.progress-item.error { color: var(--danger); }

.progress-item .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  margin-bottom: 12px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
}

#progress-status {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 16px;
}

.progress-card .btn { width: 100%; }

/* ── Utilities ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ── History panel ────────────────────────────────────────────── */
.history-section { margin-top: 24px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
}

.history-item .timestamp {
  color: var(--text-2);
  white-space: nowrap;
}

.history-item .model-badge {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text-1);
  font-size: 11px;
}

.history-item .result-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

.result-badge.success { background: var(--success-dim); color: var(--success); }
.result-badge.error { background: var(--danger-dim); color: var(--danger); }

.history-item .btn-reuse {
  font-size: 11px;
  padding: 2px 8px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ── Project Info Panel ────────────────────────────────────────── */
.brief-card {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.brief-product-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 8px;
  line-height: 1.3;
}

.brief-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.brief-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.brief-badge.type-image   { background: var(--accent-dim); color: var(--accent); }
.brief-badge.type-video   { background: rgba(251,191,36,0.15); color: var(--warning); }
.brief-badge.region       { background: var(--bg-3); color: var(--text-1); }
.brief-badge.count        { background: var(--success-dim); color: var(--success); }

.brief-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.brief-meta-row span { display: flex; gap: 6px; }
.brief-meta-row b { color: var(--text-1); font-weight: 500; }

.brief-downloads {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.brief-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.brief-dl-btn:hover { opacity: 0.8; }
.brief-dl-btn--full { background: var(--accent-dim); color: var(--accent); }
.brief-dl-btn--draft { background: var(--bg-3); color: var(--text-1); }
.brief-dl-btn--share { background: rgba(16,185,129,.15); color: var(--success); border: none; cursor: pointer; }

/* What the client needs */
.brief-needs {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}

.brief-needs-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 6px;
}

.brief-needs-text {
  font-size: 13px;
  color: var(--text-0);
  line-height: 1.5;
}

/* Deliverables checklist */
.brief-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.brief-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 10px;
}

.deliverable-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.deliverable-item:hover { background: var(--bg-hover); }
.deliverable-item.current { background: var(--accent-dim); }

.deliverable-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bg-3);
  border: 2px solid var(--border);
}

.deliverable-status.done    { background: var(--success); border-color: var(--success); }
.deliverable-status.current { background: var(--accent); border-color: var(--accent); }

.deliverable-info { flex: 1; min-width: 0; }

.deliverable-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
}

.deliverable-sub {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deliverable-check {
  font-size: 12px;
  color: var(--success);
  font-weight: 700;
}

/* Brand section */
.brief-brand {
  padding: 12px 16px;
}

.brief-brand summary {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.brief-brand summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.15s;
}

.brief-brand details[open] summary::before {
  transform: rotate(90deg);
}

.brief-color-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.brief-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: help;
}

.brief-brand-field {
  font-size: 12px;
  color: var(--text-2);
  margin: 4px 0;
}

.brief-brand-field b { color: var(--text-1); }

/* ── Shot Grid Layouts ───────────────────────────────────────── */
.shot-images-section {
  margin-bottom: 14px;
}

.shot-grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.shot-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shot-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.shot-grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.shot-image-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.shot-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.shot-panel-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.shot-panel-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

.shot-panel-refs-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.shot-ref-thumb {
  position: relative;
  width: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color 0.15s;
}

.shot-ref-thumb:hover { border-color: var(--accent); }

.shot-ref-thumb img {
  width: 100%;
  height: 50px;
  object-fit: cover;
  display: block;
}

.shot-ref-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.shot-ref-thumb:hover .shot-ref-remove { opacity: 1; }
.shot-ref-remove:hover { background: var(--danger); }

.shot-ref-name {
  font-size: 8px;
  color: var(--text-2);
  padding: 2px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot-ref-add {
  width: 50px;
  height: 50px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}

.shot-ref-add:hover { border-color: var(--accent); color: var(--accent); }

.shot-video-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.shot-video-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warning);
  font-weight: 700;
  margin-bottom: 8px;
}

.shot-video-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.shot-video-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shot-video-label {
  font-size: 10px;
  color: var(--text-2);
  min-width: 50px;
}

.shot-video-clip {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.layout-pill {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
}

/* ── Setup Progress Modal ────────────────────────────────────── */
#setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-modal {
  position: relative;
  z-index: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  min-width: 420px;
  max-width: 500px;
}

.setup-modal h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.setup-step.active { color: var(--text-0); font-weight: 500; }
.setup-step.done { color: var(--success); }
.setup-step.error { color: var(--danger); }

.setup-step .setup-icon { font-size: 14px; }

/* ── Asset Stats ─────────────────────────────────────────────── */
.asset-stats { font-size: 12px; }

.asset-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  color: var(--text-1);
}

.asset-stat-ok { color: var(--success); font-weight: 600; }
.asset-stat-pending { color: var(--warning); }

.asset-group-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
  border-top: 1px solid var(--bg-3);
}

.asset-group-name {
  color: var(--text-0);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-group-meta {
  color: var(--text-2);
  text-align: right;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Shot Idea Box ────────────────────────────────────────────── */
.shot-idea-box {
  background: var(--bg-2);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.shot-idea-box h4 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ── Brand Intelligence ───────────────────────────────────────── */
.brand-intel-row {
  font-size: 12px;
  color: var(--text-1);
  padding: 3px 0;
  line-height: 1.5;
}

.brand-intel-row b {
  color: var(--text-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 1px;
}

.brand-intel-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

.brand-intel-swatch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-2);
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: 10px;
}

.brand-intel-swatch .swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}

.brand-intel-list {
  margin: 2px 0 0 16px;
  padding: 0;
  font-size: 11px;
}

.brand-intel-list li {
  margin-bottom: 2px;
  color: var(--text-1);
}

.brand-intel-brief {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.5;
  padding: 6px 0;
  white-space: pre-wrap;
}

/* ── Storyboard Card ─────────────────────────────────────────── */
.storyboard-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.storyboard-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.storyboard-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.storyboard-note {
  font-size: 13px;
  color: var(--text-0);
  line-height: 1.5;
  margin-bottom: 6px;
}

.storyboard-goal {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
  line-height: 1.4;
}

.storyboard-goal b, .storyboard-order b {
  color: var(--text-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.storyboard-order {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
  line-height: 1.4;
}

.selling-point-pill {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  font-weight: 700;
}

.storyboard-text-overlay {
  font-size: 13px;
  color: var(--warning);
  font-weight: 600;
  font-style: italic;
  padding: 6px 10px;
  background: rgba(251,191,36,0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
}

/* ── Global Direction Panel ───────────────────────────────────── */
.global-direction-panel {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.global-direction-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.global-direction-header h3 { font-size: 14px; }

.global-direction-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.global-meta-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-3);
  color: var(--text-1);
  white-space: nowrap;
}

.text-pill {
  color: var(--warning);
  font-style: italic;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-meta-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* ── Quick Video Panel ────────────────────────────────────────── */
.quick-video-panel {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.quick-video-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-video-header h3 { font-size: 14px; }

.quick-video-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-video-refs label {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quick-video-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Video Concept Panel ─────────────────────────────────────── */
.concept-empty {
  padding: 24px;
  text-align: center;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}

.concept-empty-inner {
  max-width: 500px;
  margin: 0 auto;
}

.concept-empty h3 { font-size: 16px; margin-bottom: 6px; }
.concept-empty p { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }

.concept-options-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.concept-card {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.concept-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.concept-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.concept-meta {
  font-size: 12px;
  color: var(--text-2);
}

.concept-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.concept-desc {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  margin-bottom: 14px;
}

.concept-scenes-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.concept-scene-card {
  flex: 0 0 180px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  gap: 8px;
}

.concept-scene-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
  width: 24px;
}

.concept-scene-body { flex: 1; min-width: 0; }

.concept-scene-text {
  font-size: 12px;
  color: var(--text-0);
  line-height: 1.4;
  margin-bottom: 4px;
}

.concept-scene-overlay {
  font-size: 11px;
  color: var(--warning);
  font-style: italic;
  margin-bottom: 4px;
}

.concept-scene-meta {
  font-size: 10px;
  color: var(--text-2);
}

/* ── Video Scene Card ────────────────────────────────────────── */
.scene-section {
  margin-bottom: 14px;
}

.scene-section label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 5px;
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-2);
}

.method-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.method-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.method-btn:first-child { border-right: 1px solid var(--border); }
.method-btn:hover { color: var(--text-0); background: var(--bg-hover); }
.method-btn.active { background: var(--accent-dim); color: var(--accent); }

.scene-method { margin-top: 4px; }

.scene-gen-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.scene-frames-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 10px;
}

.scene-frame-col label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 4px;
  display: block;
}

.scene-video-output {
  margin-top: 10px;
}

.video-clip-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 11px;
}

/* ── Filmstrip (video timeline) ───────────────────────────────── */
.filmstrip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 12px;
  overflow-x: auto;
}

.filmstrip-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 90px;
  user-select: none;
}

.filmstrip-scene:hover { background: var(--bg-hover); }
.filmstrip-scene.active {
  background: var(--accent-dim);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.filmstrip-scene[draggable="true"] { cursor: grab; }
.filmstrip-scene[draggable="true"]:active { cursor: grabbing; }

.filmstrip-thumb {
  width: 120px;
  height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
}

.filmstrip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.filmstrip-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 18px;
  font-weight: 700;
}

.filmstrip-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-0);
  white-space: nowrap;
}

.filmstrip-duration {
  font-size: 10px;
  color: var(--text-2);
}

.filmstrip-transition {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
}

.filmstrip-transition:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ── Scene metadata bar ──────────────────────────────────────── */
.scene-meta-bar {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.scene-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scene-meta-item label {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-bottom: 0;
}

.duration-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.duration-control input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
}

.duration-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.duration-total {
  font-size: 11px;
  color: var(--text-2);
}

.scene-meta-item select {
  padding: 4px 8px;
  font-size: 12px;
}

textarea.audio-notes-input {
  min-height: 60px;
}

/* ── Inline frame previews (video) ───────────────────────────── */
.frame-section {
  margin-bottom: 16px;
}

.frame-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.frame-section-header label {
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0;
}

.inline-frame-preview {
  margin-top: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
  max-width: 480px;
}

.inline-frame-preview:hover { border-color: var(--accent); }

.inline-frame-preview img {
  width: 100%;
  display: block;
}

.inline-frame-block {
  margin-top: 8px;
}

.inline-frame-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.inline-frame-label {
  font-size: 10px;
  color: var(--text-2);
  flex: 1;
}

.inline-frame-older {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.inline-frame-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}

.inline-frame-thumb:hover { border-color: var(--accent); }

.inline-frame-preview.selected-for-video { border: 2px solid var(--success); }

.selected-badge {
  position: absolute;
  bottom: 12px;
  right: 8px;
  background: var(--success);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
}

.inline-frame-thumb-wrap {
  position: relative;
  display: inline-block;
}

.inline-frame-thumb-wrap.selected-for-video .inline-frame-thumb {
  border-color: var(--success);
}

.thumb-actions {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 2px;
}

.inline-frame-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.thumb-action-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
}

.thumb-action-btn.active { background: var(--success); color: #000; border-color: var(--success); }
.thumb-action-btn:hover { background: var(--accent); color: #fff; }
.thumb-action-btn.del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.dual-frame-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.dual-frame-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 600;
}

/* ── Video frame pair layout (main panel) ────────────────────── */
.output-frames-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.frame-column-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  font-weight: 700;
  margin-bottom: 8px;
  padding-left: 2px;
}

/* ── Video sidebar scene pair ────────────────────────────────── */
.output-sidebar-scene {
  padding: 8px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.output-sidebar-scene:hover { background: var(--bg-hover); }

.output-sidebar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-0);
  margin-bottom: 6px;
}

.output-sidebar-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.output-thumb-sm {
  width: 80px;
  height: 45px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-3);
  border: 1px solid var(--border);
}

.output-thumb-sm.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-2);
}

.output-arrow {
  color: var(--text-2);
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Video clips ─────────────────────────────────────────────── */
.video-clip-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.video-clip-block.latest {
  border-color: var(--warning);
}

.video-player {
  width: 100%;
  max-height: 400px;
  background: #000;
  display: block;
}

/* ── Ideas panel ─────────────────────────────────────────────── */
.ideas-panel {
  margin-bottom: 20px;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
}

.ideas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.idea-card {
  padding: 14px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idea-card:last-child { border-right: none; }

.idea-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-0);
}

.idea-desc {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.5;
  flex: 1;
}

.idea-refs {
  font-size: 11px;
  color: var(--text-2);
}

.idea-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ── New Project button in sidebar ────────────────────────────── */
.sidebar-new-btn {
  margin: 0 16px 12px;
}
.sidebar-new-btn button {
  width: 100%;
}

/* ── Wizard Overlay ───────────────────────────────────────────── */
#wizard-overlay,
#video-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wizard-modal {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 640px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wizard-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.wizard-header h2 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  margin-right: auto;
}

.wizard-step-indicators {
  display: flex;
  align-items: center;
  gap: 0;
}

.wiz-step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
}

.wiz-step-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wiz-step-dot.done {
  background: var(--success-dim);
  border-color: var(--success);
  color: var(--success);
}

.wiz-step-line {
  width: 20px;
  height: 2px;
  background: var(--border);
}

.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.wiz-panel { display: none; }
.wiz-panel.active { display: block; }

.wiz-panel h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.wiz-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.5;
}

.wiz-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
}

.upload-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-2);
}

.upload-drop-zone:hover, .upload-drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-zone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-1);
  font-size: 13px;
}

.drop-zone-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.wiz-upload-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
}

.wiz-upload-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0.2s;
}

#wiz-upload-msg {
  font-size: 12px;
  color: var(--text-1);
}

.folder-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.folder-input-row input {
  flex: 1;
  width: auto;
}

.brief-upload-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input[type="file"] {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  margin-right: 10px;
}

.brief-upload-status {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.brief-upload-status.loading { color: var(--warning); background: rgba(251,191,36,0.1); }
.brief-upload-status.ok      { color: var(--success); background: var(--success-dim); }
.brief-upload-status.error   { color: var(--danger);  background: var(--danger-dim); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Asset summary table */
.wiz-asset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.wiz-asset-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.wiz-asset-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--bg-3);
  color: var(--text-1);
}

.wiz-asset-table tr:last-child td { border-bottom: none; }

.wiz-asset-count {
  font-weight: 600;
  color: var(--accent);
}

.wiz-asset-names {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}

/* Type selector */
.type-selector {
  display: flex;
  gap: 12px;
}

.type-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  background: var(--bg-2);
}

.type-option input[type="radio"] { display: none; }

.type-option:hover { border-color: var(--accent); }
.type-option.active { border-color: var(--accent); background: var(--accent-dim); }

.type-icon { font-size: 24px; }
.type-label { font-size: 13px; font-weight: 600; }
.type-sub { font-size: 11px; color: var(--text-2); }

/* Wizard progress (step 4) */
.wiz-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0 10px;
}

.wiz-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s;
}

.wiz-progress-msg {
  font-size: 12px;
  color: var(--text-2);
  min-height: 20px;
}

/* Brand profile display */
#wiz-brand-profile {
  margin-top: 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

#wiz-brand-profile h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 12px;
}

#wiz-brand-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.brand-color-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
}

.swatch-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.swatch-label {
  color: var(--text-2);
  margin-right: 4px;
}

.brand-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.brand-field {
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
}

.brand-field .bf-label {
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.brand-field .bf-value {
  color: var(--text-0);
}

/* Wizard prompts review (step 5) */
.wiz-prompt-item {
  margin-bottom: 20px;
}

.wiz-prompt-item label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.wiz-prompt-item textarea {
  width: 100%;
  min-height: 100px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.5;
  resize: vertical;
}

.wiz-prompt-refs {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-2);
}

/* Wizard footer */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

.wizard-footer .btn-primary {
  min-width: 140px;
}

/* ── Save Indicator ──────────────────────────────────────────────── */
.save-indicator {
  font-size: 11px;
  color: var(--success);
  background: var(--success-dim);
  padding: 2px 8px;
  border-radius: 10px;
  transition: opacity 0.3s;
}

/* ── Idea Preview Modal ──────────────────────────────────────────── */
#idea-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
}

.idea-preview-content {
  position: relative;
  z-index: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 600px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

.idea-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.idea-preview-header h3 { font-size: 15px; font-weight: 600; }

#idea-preview-body { padding: 18px; }
#idea-preview-body label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin: 12px 0 6px;
}

.idea-preview-desc {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  margin-bottom: 8px;
}

.idea-preview-prompt {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  font-family: var(--mono);
  line-height: 1.5;
  color: var(--text-0);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.idea-preview-refs {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 10px;
}

.idea-preview-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

@keyframes cs-spin { to { transform: rotate(360deg); } }
@keyframes cs-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }
