:root {
  --bg: #0A0B0D;
  --bg-1: #0E1014;
  --bg-2: #13151A;
  --bg-3: #191C23;
  --bg-4: #1F2229;
  --border: #23262E;
  --border-2: #2C3038;
  --text: #E6E8EC;
  --text-2: #A3A8B5;
  --text-3: #6B7184;
  --text-4: #4A4F5C;
  --accent: #9AFF2E;
  --accent-dim: #9AFF2E22;
  --accent-ink: #0A0B0D;
  --red: #FF6B6B;
  --amber: #F5B454;
  --green: #4ADE80;
  --blue: #6EA8FF;
  --violet: #B48BFF;
  --w-copy: var(--accent);
  --w-copy-dim: var(--accent-dim);
  --w-twist: #6EA8FF;
  --w-twist-dim: #6EA8FF22;
  --w-repurpose: #B48BFF;
  --w-repurpose-dim: #B48BFF22;
  --radius: 6px;
  --radius-card: 10px;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; padding: 0; height: 100%; width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono { font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: transparent; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #23262E; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2C3038; }

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 100vh;
  width: 100vw;
  height: 100vh;
}

/* sidebar */
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  overflow-y: auto;
}
.brand {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-3);
  padding: 6px 10px 18px;
  text-transform: uppercase;
}
.brand .dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 10px var(--accent);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-align: left;
  font-size: 13px;
  transition: background 0.1s;
}
.nav button:hover { background: var(--bg-2); color: var(--text); }
.nav button.active { background: var(--bg-3); color: var(--text); }
.nav button .num {
  margin-left: auto;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-3);
}

/* main */
.main { display: grid; grid-template-rows: 48px 1fr; min-width: 0; min-height: 0; }
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}
.topbar h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.topbar .subtitle { color: var(--text-3); font-size: 12px; }
.topbar .spacer { flex: 1; }
.content { overflow: auto; padding: 20px 24px 80px; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--bg-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: background 0.1s, border-color 0.1s;
}
.btn:hover { background: var(--bg-4); border-color: var(--border-2); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { background: #B6FF55; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  font-family: "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chip.copy { background: var(--w-copy-dim); color: var(--w-copy); }
.chip.twist { background: var(--w-twist-dim); color: var(--w-twist); }
.chip.repurpose { background: var(--w-repurpose-dim); color: var(--w-repurpose); }
.chip.muted { background: var(--bg-3); color: var(--text-3); }
.chip.draft { background: var(--bg-3); color: var(--text-3); }
.chip.filmed { background: #6EA8FF22; color: var(--blue); }
.chip.editing { background: #F5B45422; color: var(--amber); }
.chip.ready_review { background: var(--accent-dim); color: var(--accent); }
.chip.posted { background: #4ADE8022; color: var(--green); }
.chip.skipped { background: #FF6B6B22; color: var(--red); }
.chip.needs_review { background: #FF6B6B22; color: var(--red); }

/* top-performer grid — 4-5 cards per row */
.perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.perf-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.perf-card:hover { border-color: var(--border-2); }

/* thumbnail — fixed height */
.perf-thumb {
  position: relative;
  height: 160px;
  flex-shrink: 0;
  overflow: hidden;
}
.perf-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.perf-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 2;
}
.perf-thumb-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 7px;
}
.perf-handle-chip {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  padding: 3px 7px;
  border-radius: 3px;
  max-width: 115px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.perf-badge {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  padding: 3px 7px;
  border-radius: 3px;
}
/* caption shown inside placeholder when no image */
.perf-no-thumb-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 3;
  padding: 28px 10px 10px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,0.65);
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.5));
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* stats row — 3 columns */
.perf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.perf-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  gap: 1px;
}
.perf-stat .n {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.perf-stat .lbl {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perf-caption {
  font-size: 11px;
  color: var(--text-3);
  padding: 8px 10px 6px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.perf-actions {
  display: flex;
  gap: 6px;
  padding: 8px 10px 10px;
}
.perf-adapt { flex: 1; justify-content: center; font-size: 12px; }
.perf-adapt.adapted {
  background: var(--green);
  border-color: var(--green);
  color: #0A0B0D;
}

/* script row */
.script-list { display: flex; flex-direction: column; gap: 8px; }
.script-row {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.1s;
}
.script-row:hover { border-color: var(--border-2); }
.script-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
}
.script-head .idx {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-3);
  width: 28px;
}
.script-head .hook {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.script-body {
  padding: 8px 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.script-body .full {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  padding: 16px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: "Geist", sans-serif;
  margin-bottom: 12px;
}
.script-body h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 6px;
}
.hooks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hook-variant {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.hook-variant:hover { border-color: var(--border-2); }
.hook-variant.active { border-color: var(--accent); background: var(--accent-dim); }
.hook-variant .mark {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--text-3);
  min-width: 22px;
}

/* drop zone */
.drop {
  border: 1.5px dashed var(--border-2);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  transition: all 0.15s;
  cursor: pointer;
  background: var(--bg);
}
.drop:hover { border-color: var(--accent); color: var(--text); }
.drop.over { border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.drop-note { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.footage-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.footage-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-3);
  border-radius: 4px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
}
.footage-chip .rm { color: var(--text-3); cursor: pointer; padding: 0 3px; }
.footage-chip .rm:hover { color: var(--red); }

/* script actions */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* teleprompter */
.teleprompter {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 60px;
  overflow: auto;
}
.teleprompter .close {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  background: var(--bg-2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.teleprompter .text {
  font-size: 36px;
  line-height: 1.6;
  color: var(--text);
  max-width: 1100px;
  margin: 0 auto;
  white-space: pre-wrap;
  font-weight: 500;
}

/* review card */
.review-list { display: flex; flex-direction: column; gap: 12px; }
.review-card {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  align-items: start;
}
.review-card video {
  width: 200px;
  aspect-ratio: 9/16;
  background: var(--bg-3);
  border-radius: 6px;
  object-fit: cover;
}
.review-card .meta { font-size: 11px; color: var(--text-3); margin-bottom: 6px; font-family: "Geist Mono", monospace; }
.review-card textarea {
  width: 100%;
  min-height: 100px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
}
.review-card input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.platforms { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.platform-toggle {
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: 11px;
  font-family: "Geist Mono", monospace;
  text-transform: uppercase;
  cursor: pointer;
}
.platform-toggle.on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* empty */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 60px 20px;
  font-size: 13px;
}
.empty h3 { color: var(--text-2); margin: 0 0 6px; font-weight: 600; font-size: 14px; }

/* filters bar */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.filters input, .filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
}

.topic-list { display: flex; flex-direction: column; gap: 6px; }
.topic-list textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.avoid-box {
  width: 100%;
  min-height: 180px;
  background: var(--bg-1);
  border: 1px solid #3a1e1e;
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}
.avoid-box:focus {
  outline: none;
  border-color: var(--red);
}

/* loader */
.loader {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* upload zone (Edit tab) */
.upload-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-card);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.upload-zone.over { border-color: var(--accent); background: var(--accent-dim); }
.upload-zone.loading {
  border-color: var(--amber);
  background: rgba(245,180,84,0.08);
  cursor: default;
  gap: 14px;
}
.upload-icon { font-size: 28px; color: var(--text-3); line-height: 1; }
.upload-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.upload-sub { font-size: 12px; color: var(--text-3); max-width: 420px; }

/* pipeline job list */
.section-label {
  color: var(--text-3);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin: 0 0 10px;
}
.job-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}
.job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.job-row.done { border-color: #9AFF2E55; }
.job-row.error { border-color: #FF6B6B55; }
.job-row.processing { border-color: #F5B45455; }

/* ── Ideas tab ──────────────────────────────────────────────────────── */

.idea-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.idea-topic-input {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.idea-topic-input:focus { border-color: var(--accent); }
.idea-topic-input::placeholder { color: var(--text-4); }

.idea-desc-input {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.idea-desc-input:focus { border-color: var(--accent); }
.idea-desc-input::placeholder { color: var(--text-4); }

.idea-gen-btn {
  align-self: flex-end;
  padding: 10px 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.idea-list { display: flex; flex-direction: column; gap: 8px; }

.idea-row {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color 0.1s;
}
.idea-row:hover { border-color: var(--border-2); }

.idea-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
}
.idea-topic {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.idea-body {
  padding: 8px 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.idea-body h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}
.idea-body h4:first-child { margin-top: 8px; }

.script-text-editor {
  width: 100%;
  min-height: 160px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  resize: vertical;
  font-family: "Geist", sans-serif;
  outline: none;
}
.script-text-editor:focus { border-color: var(--accent); }

/* Teleprompter topic label */
.tele-topic {
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 32px;
  opacity: 0.7;
}

/* stats banner */
.stats-row {
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
}
.stats-row .stat .n { color: var(--accent); font-size: 18px; font-weight: 500; display: block; }
.stats-row .stat .label { color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; }
