:root {
  --bg: #111316; --panel: #1a1d22; --panel2: #22262c; --line: #2e333a; --text: #e6e8eb; --muted: #8b939e;
  --accent: #4f9cff; --cut: #ff4d5e; --ok: #3ccf8e; --warn: #f5b942;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { border-color: var(--cut); color: var(--cut); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.center { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.login { width: min(360px, 100%); display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 20px; }
.err { color: var(--cut); min-height: 1.4em; }
header.top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; }
header.top .spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
a { color: var(--accent); text-decoration: none; }
.small { font-size: 12px; }
button.small { padding: 2px 8px; font-size: 12px; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); }
button.active { border-color: var(--warn); color: var(--warn); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.wrap { max-width: 980px; margin: 0 auto; }
header.top a.brand { color: var(--text); }
.ptitle { margin: 0; font-size: 16px; cursor: text; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; background: transparent; }
.badge.on { background: var(--accent); color: #fff; }
.badge.bad { background: var(--cut); color: #fff; }
.projects { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 16px; }
.card.project { display: grid; gap: 4px; color: var(--text); }
.card.project:hover { border-color: var(--accent); }

/* editor layout */
.editor { display: grid; height: calc(100vh - 49px); grid-template-columns: 250px minmax(0, 1fr) 380px;
  grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "left center right" "bottom bottom bottom"; }
.editor .left { grid-area: left; border-right: 1px solid var(--line); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.editor .left h3 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.editor .center-col { grid-area: center; display: flex; flex-direction: column; min-height: 0; padding: 10px; gap: 8px; }
.editor .right { grid-area: right; border-left: 1px solid var(--line); min-height: 0; display: flex; flex-direction: column; }
.editor .bottom { grid-area: bottom; border-top: 1px solid var(--line); }
.editor .bottom:empty, .editor .right:empty { display: none; }
@media (max-width: 1100px) {
  .editor { grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "left center" "right right" "bottom bottom";
    grid-template-rows: minmax(0, 1fr) 40vh auto; }
}
@media (max-width: 700px) {
  .editor { display: flex; flex-direction: column; height: auto; }
  .editor .right { max-height: 60vh; }
}
.empty { display: grid; place-items: center; flex: 1; border: 1px dashed var(--line); border-radius: 10px; min-height: 200px; }
.cliplist { display: flex; flex-direction: column; gap: 6px; }
.clip { display: flex; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer; }
.clip.sel { border-color: var(--accent); }
.clip.dragover { border-style: dashed; border-color: var(--warn); }
.clip .num { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); font-size: 11px; }
.clip .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.ready { color: var(--ok); } .status.failed { color: var(--cut); } .status.processing, .status.queued { color: var(--warn); }
.dropzone { border: 1.5px dashed var(--line); border-radius: 10px; padding: 16px 10px; display: grid; gap: 4px; text-align: center; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: rgba(79, 156, 255, .06); }
.upload { display: grid; gap: 4px; padding: 8px; border-radius: 8px; background: var(--panel); }
.upload.failed .name { color: var(--cut); }
.upload .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.bar { height: 4px; background: var(--panel2); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* player */
.player { display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; }
.video-wrap { flex: 1; min-height: 0; background: #000; border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.video-wrap video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.scrub { position: relative; height: 18px; background: var(--panel2); border-radius: 4px; cursor: pointer; touch-action: none; }
.scrub-fill { position: absolute; inset: 0 auto 0 0; background: rgba(79, 156, 255, .35); border-radius: 4px; pointer-events: none; }
.scrub-cuts i { position: absolute; top: 0; bottom: 0; background: rgba(255, 77, 94, .55); pointer-events: none; }
.scrub-head { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; pointer-events: none; }
.controls .play { width: 42px; }
.keys { white-space: nowrap; }
@media (max-width: 700px) { .keys { display: none; } }

/* jobs drawer */
.drawer { position: fixed; top: 49px; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel);
  border-left: 1px solid var(--line); padding: 12px; overflow: auto; z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.4); }
.joblist { display: flex; flex-direction: column; gap: 8px; }
.job { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.running { background: var(--accent); animation: pulse 1s infinite alternate; }
.dot.done { background: var(--ok); } .dot.failed { background: var(--cut); } .dot.queued { background: var(--warn); }
@keyframes pulse { to { opacity: .3; } }
.log { max-height: 240px; overflow: auto; background: #0b0c0e; padding: 8px; border-radius: 6px; font-size: 11px; white-space: pre-wrap; margin: 0; }

/* right panel tabs + transcript */
.tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.tab.sel { color: var(--text); border-bottom-color: var(--accent); }
.tabbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 8px; gap: 6px; }
.panel-head { gap: 6px; }
.transcript { flex: 1; overflow: auto; padding: 4px 6px 40px; font-size: 15px; line-height: 1.75; outline: none; }
.transcript p { margin: 0 0 12px; }
.transcript .ts { color: var(--muted); font-size: 11px; margin-right: 6px; user-select: none; font-family: ui-monospace, monospace; }
.transcript .w { cursor: pointer; border-radius: 3px; padding: 1px 0; }
.transcript .w:hover { background: var(--panel2); }
.transcript .w.now { background: rgba(79, 156, 255, .3); }
.transcript .w.cut { color: var(--cut); text-decoration: line-through; opacity: .65; }
.transcript ::selection { background: rgba(245, 185, 66, .45); }
.savestate.bad { color: var(--cut); }

/* review */
.review-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding-bottom: 40px; }
.sugg { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 4px; background: var(--panel); }
.sugg .quote { font-size: 13px; color: var(--text); }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--panel2); }
.pill.repeat, .pill.false_start, .pill.abandoned { background: rgba(255, 77, 94, .18); color: #ff8a95; }
.pill.filler { background: rgba(245, 185, 66, .18); color: var(--warn); }
.pill.silence { background: rgba(79, 156, 255, .18); color: var(--accent); }
.hint { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; background: var(--panel2); }
.hint p { margin: 0; }
[hidden] { display: none !important; }
textarea.prompt { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: 12px/1.4 ui-monospace, monospace; resize: vertical; }

/* timeline */
.timeline { padding: 6px 10px 8px; display: grid; gap: 6px; }
.tl-bar { gap: 6px; }
canvas.wave { width: 100%; display: block; border-radius: 6px; cursor: crosshair; touch-action: none; }
.transcript .w.sel { background: rgba(245, 185, 66, .35); }
.editor .bottom { min-height: 0; }

/* audio / cuts / export */
.stack { display: flex; flex-direction: column; gap: 8px; }
.panel.scroll { overflow: auto; }
.panel h4 { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.radio { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.radio.muted { cursor: default; }
.grid2 { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 13px; }
.row.wrap { flex-wrap: wrap; }
a.btn { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--text); font-size: 12px; }
a.btn:hover { border-color: var(--accent); }
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
dialog.watch { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: min(960px, 95vw); }
dialog.watch video { width: 100%; max-height: 75vh; background: #000; border-radius: 6px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.tabs { overflow-x: auto; }
