:root {
  --bg: #121315; --panel: #1b1c1f; --panel2: #232428; --line: #2e3035; --text: #e8e6e1; --muted: #8d8b86;
  --accent: #e0b062; --accent-ink: #1a1408; --ok: #7fbf8a; --bad: #e07a6a; --info: #7aa7d9;
  --r: 8px; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, "Segoe UI", Roboto, sans-serif; line-height: 1.45; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .err { color: var(--bad); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 600; } h2 { font-size: 18px; } h3 { font-size: 15px; }
button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px; padding: 7px 12px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(1.08); } button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
button.ghost:hover { border-color: var(--muted); }
button.sm { padding: 3px 8px; font-size: 12px; }
button.on { background: var(--info); color: #0c1520; }
input, select, textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; }
textarea { resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 12px; color: var(--muted); } label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; } .row > label { flex: 1; min-width: 110px; } .row.end { justify-content: flex-end; }

.login { position: fixed; inset: 0; display: grid; place-items: center; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }

.app { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: 52px 1fr; height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 600; } .stats { flex: 1; display: flex; gap: 18px; font-size: 13px; color: var(--muted); } .stats b { color: var(--text); font-weight: 600; }
.top-actions { display: flex; gap: 8px; }
.side { overflow: auto; border-right: 1px solid var(--line); padding: 8px 0 40px; }
.side .part { padding: 14px 16px 4px; font-size: 11px; color: var(--muted); text-transform: none; letter-spacing: .02em; }
.side a { display: flex; gap: 8px; padding: 6px 16px; color: var(--text); text-decoration: none; cursor: pointer; }
.side a .code { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 42px; font-size: 12px; padding-top: 1px; }
.side a:hover { background: var(--panel); } .side a.active { background: var(--panel2); box-shadow: inset 3px 0 0 var(--accent); }
.side .count { margin-left: auto; color: var(--muted); font-size: 12px; }

.main { overflow: auto; padding: 20px 24px 80px; display: grid; gap: 18px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.scene-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scene-head .full { grid-column: 1 / -1; }
.notes { font-size: 13px; color: var(--muted); }

.gen { display: grid; gap: 12px; }
.tabs { display: flex; gap: 6px; } .tabs button { background: var(--panel2); color: var(--text); font-weight: 500; } .tabs button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.picks { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.pick { display: flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px dashed var(--line); border-radius: 6px; padding: 4px 8px 4px 4px; min-height: 44px; }
.pick img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; }
.pick .x { cursor: pointer; color: var(--muted); padding: 0 4px; }
.cost { font-size: 13px; color: var(--muted); } .cost b { color: var(--accent); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.item { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.item.starred { border-color: var(--accent); }
.media { position: relative; background: #000; aspect-ratio: 16 / 9; display: grid; place-items: center; }
.media img, .media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.media .state { color: var(--muted); font-size: 13px; text-align: center; padding: 10px; }
.overlay { position: absolute; pointer-events: none; }
.overlay .band { position: absolute; left: 0; right: 0; border: 2px solid #e0b062; box-shadow: 0 0 0 999px rgba(0,0,0,.62); }
.overlay .wing { position: absolute; top: 0; bottom: 0; border-left: 2px dashed #e0b062; }
.meta { padding: 8px 10px; font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.meta .p { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acts { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel); border: 1px solid var(--line); }
.badge.first { border-color: var(--ok); color: var(--ok); } .badge.last { border-color: var(--bad); color: var(--bad); } .badge.ref { border-color: var(--info); color: var(--info); }

.tl { display: grid; gap: 8px; }
.tl-row { display: grid; grid-template-columns: 28px 96px 1fr 80px 80px auto; gap: 8px; align-items: center; background: var(--panel2); border-radius: 6px; padding: 6px 8px; font-size: 13px; }
.tl-row video { width: 96px; height: 54px; object-fit: cover; border-radius: 4px; background: #000; }
.tl-row input { padding: 4px 6px; }
.progress { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; } .progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.cmd { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(720px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg { padding: 20px; display: grid; gap: 14px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 10; }
.toast.show { opacity: 1; } .toast.bad { border-color: var(--bad); }
