* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #14120f;
  --panel: #1e1b16;
  --panel2: #262219;
  --border: #3a342a;
  --text: #e8e2d5;
  --muted: #9a917f;
  --accent: #d9a441;
  --accent-dark: #b3832c;
  --danger: #c0564a;
  --ok: #7fb069;
}
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", sans-serif;
}
#app { display: flex; height: 100vh; }
#sidebar {
  width: 320px; min-width: 320px; background: var(--panel);
  border-right: 1px solid var(--border); padding: 16px;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
}
#sidebar h1 { font-size: 17px; }
#main { flex: 1; overflow-y: auto; padding: 20px 28px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button, select, textarea, input {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font: inherit;
}
textarea { width: 100%; resize: vertical; }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1a1206; font-weight: 600; border-color: var(--accent-dark); }
button.primary:hover { background: #e6b453; }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }

.new-project { display: flex; flex-direction: column; gap: 8px; }

#ideas-panel { display: flex; flex-direction: column; gap: 6px; }
.idea {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px;
}
.idea:hover { border-color: var(--accent); }
.idea .muted { display: block; margin-top: 2px; }

#project-list { display: flex; flex-direction: column; gap: 6px; }
.project-item {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; cursor: pointer;
}
.project-item:hover, .project-item.active { border-color: var(--accent); }
.project-item .topic { font-size: 13px; font-weight: 600; }
.badges { margin-top: 4px; display: flex; gap: 4px; }
.badge {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: var(--border); color: var(--muted);
}
.badge.on { background: var(--ok); color: #10240c; }
.badge.archived { background: var(--accent); color: #1a1206; }

#voice-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.voice-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
}
.voice-chip:hover { border-color: var(--accent); color: var(--text); }
.voice-chip.active { background: var(--accent); color: #1a1206; }
.voice-chip .x { margin-left: 4px; opacity: 0.6; }

#project-view header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
#project-view h2 { font-size: 18px; max-width: 60%; }

#job-bar {
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
#job-message { font-size: 13px; margin-bottom: 6px; }
.progress { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
#job-progress { height: 100%; width: 0; background: var(--accent); transition: width 0.4s; }

#tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
#tabs button.active { background: var(--accent); color: #1a1206; font-weight: 600; }

.section-block { margin-bottom: 14px; }
.section-block .label { font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.section-block textarea { min-height: 110px; font-size: 13px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }

.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.scene-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
}
.scene-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--panel2); }
.scene-card .noimg { width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--panel2); }
.scene-card .body { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.scene-card .text { font-size: 12px; color: var(--muted); }
.scene-card textarea { font-size: 12px; min-height: 60px; }
.scene-card .overlay-tag { color: var(--accent); font-size: 11px; font-weight: 700; }
.scene-card .num { font-size: 11px; color: var(--muted); }

.audio-list { display: flex; flex-direction: column; gap: 8px; }
.audio-item { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; gap: 10px; align-items: center; }
.audio-item audio { height: 32px; }

video.preview { width: 100%; max-width: 900px; border-radius: 10px; border: 1px solid var(--border); }

.meta-box { display: flex; flex-direction: column; gap: 10px; max-width: 800px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }

.scene-ops { display: flex; gap: 3px; flex-wrap: wrap; }
.scene-ops button { padding: 2px 7px; font-size: 12px; line-height: 1.4; }
.scene-card .scene-text { font-size: 12px; min-height: 48px; color: var(--text); }
#preset-panel header { margin-bottom: 12px; }

.cost-table { border-collapse: collapse; width: 100%; max-width: 620px; font-size: 13px; }
.cost-table th, .cost-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.cost-table th { color: var(--muted); font-weight: 500; font-size: 12px; text-align: left; }
.cost-table tr.total td { font-weight: 700; color: var(--accent); border-bottom: none; }
