:root {
  --side: #111112;
  --side-2: #1c1c1f;
  --side-text: #c9c9cf;
  --page: #f6f6f4;
  --card: #ffffff;
  --line: #e4e4e0;
  --text: #17171a;
  --muted: #6b6b73;
  --accent: #ff9b26;
  --accent-ink: #1a1203;
  --good: #1f9d55;
  --bad: #d43d33;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif; color: var(--text); background: var(--page); font-size: 15px; line-height: 1.45; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.btn:hover { border-color: #c9c9c4; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.96); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type=text], input[type=email], input[type=password] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--side); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; padding: 28px; }
.login-card .brand { font-weight: 800; font-size: 20px; }
.login-card .brand span { color: var(--accent); }
.login-card .btn { width: 100%; margin-top: 18px; padding: 12px; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side-w, 250px) 0 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; font-weight: 800; font-size: 18px; padding: 2px 8px 16px; }
.side .brand span { color: var(--accent); }
.side a { display: flex; align-items: center; gap: 9px; color: var(--side-text); text-decoration: none; padding: 8px 10px; border-radius: 9px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side a:hover { background: var(--side-2); color: #fff; }
.side a.on { background: var(--side-2); color: #fff; }
.side .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #7c7c85; padding: 16px 10px 6px; }
.side .list { overflow-y: auto; flex: 1; min-height: 0; }
.side .foot { border-top: 1px solid #2a2a2e; padding-top: 10px; margin-top: 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #55555c; flex: none; }
.dot.on { background: var(--good); }
.dot.busy { background: var(--accent); }
.dot.bad { background: var(--bad); }
.side .mac { display: flex; align-items: center; gap: 9px; padding: 8px 10px; font-size: 13px; }
.side button.link { background: none; border: 0; color: var(--side-text); padding: 8px 10px; width: 100%; text-align: left; border-radius: 9px; }
.side button.link:hover { background: var(--side-2); color: #fff; }

.main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.head .grow { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { text-decoration: none; color: inherit; display: block; }
.pcard:hover { border-color: #c9c9c4; }
.pcard .name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.bar { height: 6px; border-radius: 6px; background: #ecece8; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.3s; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #efefeb; color: #4a4a52; }
.pill.hdr { background: #1a1203; color: var(--accent); }
.pill.good { background: #e3f5ea; color: var(--good); }
.pill.bad { background: #fbe6e4; color: var(--bad); }
.pill.busy { background: #fff1dd; color: #a35d00; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:disabled { opacity: 0.45; cursor: default; }

.drop { border: 2px dashed #cfcfc9; border-radius: var(--radius); padding: 26px; text-align: center; background: #fbfbf9; margin-bottom: 16px; }
.drop.over { border-color: var(--accent); background: #fff6e9; }
.drop strong { display: block; font-size: 16px; margin-bottom: 4px; }
.uprow { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.uprow:last-child { border-bottom: 0; }
.uprow .bar { grid-column: 1 / -1; margin-top: 4px; }

.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.clip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.clip .thumb { aspect-ratio: 9 / 12; background: #1c1c1f center / cover no-repeat; position: relative; display: grid; place-items: center; color: #9a9aa3; font-size: 13px; text-align: center; padding: 8px; border: 0; width: 100%; }
.clip .thumb.play:hover::after { content: "▶"; position: absolute; font-size: 34px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.clip .thumb .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.clip .thumb .dur { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
.clip .info { padding: 9px 10px; font-size: 13px; }
.clip .info .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip .info .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 4px; }
.clip .x { background: none; border: 0; color: var(--muted); padding: 2px 4px; }
.clip .x:hover { color: var(--bad); }

.cols { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.job { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.job:last-child { border-bottom: 0; }
.job .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.job .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 28px; font-weight: 700; letter-spacing: 0.08em; background: #111112; color: var(--accent); padding: 14px 18px; border-radius: 12px; display: inline-block; margin: 10px 0; }
.modal { position: fixed; inset: 0; background: rgba(10,10,12,0.72); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal[hidden] { display: none; }
.modal .box { background: var(--card); border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; }
.modal .box.video { max-width: 420px; padding: 12px; background: #000; }
.modal video { width: 100%; max-height: 80vh; border-radius: 10px; display: block; background: #000; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #17171a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 92vw; }
.toast[hidden] { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 4px; }
  .side .brand { padding: 4px 8px; }
  .side .label { display: none; }
  .side .list { display: flex; flex: 1 1 100%; overflow-x: auto; order: 5; }
  .side .foot { border: 0; margin: 0 0 0 auto; padding: 0; display: flex; align-items: center; }
  .side button.link { width: auto; }
  .main { padding: 18px 16px 50px; }
  .cols { grid-template-columns: 1fr; }
}

/* chat */
.chatwrap { display: grid; grid-template-columns: minmax(280px, 1fr) 10px var(--panel-w, 400px); height: calc(100vh - 190px); min-height: 380px; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chatlog { flex: 1; overflow-y: auto; padding: 4px 4px 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; }
.msg.user { align-self: flex-end; }
.msg.agent { align-self: flex-start; }
.msg.sys { align-self: center; color: var(--muted); font-size: 13px; text-align: center; max-width: 100%; }
.msg .who { font-size: 12px; color: var(--muted); margin: 0 4px 3px; }
.msg.user .who { text-align: right; }
.bubble { padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); }
.msg.user .bubble { background: #111112; color: #fff; border-color: #111112; }
.bubble.live .status { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bubble.live .step { font-size: 12.5px; color: var(--muted); margin-top: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.bubble.live .say { margin-top: 8px; }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #f0d2a8; border-top-color: var(--accent); animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.chatbox { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.chatbox textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; background: #fff; min-height: 48px; max-height: 160px; }
.chatbox textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.textfile { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; max-height: 60vh; overflow: auto; margin: 0; }

.qr { width: 200px; height: 200px; display: block; margin: 12px 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.quick + .chatbox { border-top: 0; padding-top: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: #111112; color: #fff; }
.approve { display: flex; gap: 8px; margin-top: 8px; }
.clip .thumb { overflow: hidden; }
.clip .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.clip .thumb .blockednote { display: none; }
.clip .thumb.blocked .blockednote { display: block; }
.clip .thumb .badges, .clip .thumb .dur { z-index: 1; }

/* timeline */
.tl { display: flex; flex-direction: column; gap: 12px; }
.tl-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.tl-stage { position: relative; aspect-ratio: 9 / 16; height: min(44vh, 400px); background: #000; border-radius: 12px; overflow: hidden; }
.tl-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-stage.nopreview video { visibility: hidden; }
.tl-sticker { position: absolute; left: 0; right: 0; top: 14%; text-align: center; color: #fff; font-weight: 800; font-size: clamp(9px, 1.5vw, 14px); line-height: 1.15; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 4px #000; pointer-events: none; padding: 0 8%; }
.tl-missing { position: absolute; inset: 0; display: grid; place-items: center; color: #c9c9cf; font-size: 13px; text-align: center; padding: 16px; pointer-events: none; }
.tl-transport { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.tl-time { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.tl-side { min-height: 200px; }
.tl-side select, .tl-side input[type=number] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: #fff; font: inherit; }
.tl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tl-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tl-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.tl-check input { margin-top: 3px; }
.tl-row { display: flex; gap: 6px; margin-bottom: 6px; }
.tl-row input { flex: 1; }
.tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tl-bar .grow { flex: 1; min-width: 160px; padding: 0 6px; }
.tl-warn { background: #fff1dd; border: 1px solid #f0c987; color: #6b3d00; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.tl-scroll { overflow-x: auto; background: #17171a; border-radius: 12px; padding: 0 0 10px; }
.tl-track { position: relative; padding-left: 0; min-height: 150px; }
.tl-ruler { position: relative; height: 34px; border-bottom: 1px solid #2c2c31; cursor: pointer; }
.tl-tick { position: absolute; top: 2px; font-size: 10px; color: #8a8a93; border-left: 1px solid #3a3a40; padding-left: 3px; height: 12px; }
.tl-beat { position: absolute; top: 16px; font-size: 10px; font-weight: 700; color: var(--accent); border-left: 2px solid var(--accent); padding-left: 4px; white-space: nowrap; }
.tl-lane { position: relative; height: 58px; margin-top: 6px; }
.tl-lane.tl-cues { height: 26px; border-top: 1px dashed #2c2c31; }
.tl-lanelab { position: sticky; left: 6px; font-size: 10px; color: #6f6f78; top: 6px; display: inline-block; padding-top: 6px; pointer-events: none; }
.tl-clip { position: absolute; top: 0; height: 58px; border-radius: 7px; background: #3a3a40 center / cover no-repeat; border: 2px solid #55555c; overflow: hidden; cursor: grab; }
.tl-clip.talk { border-color: #4f9cf5; } .tl-clip.amb { border-color: #9a6bf0; } .tl-clip.broll { border-color: #6b6b73; }
.tl-clip.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,155,38,0.45); z-index: 2; }
.tl-clip.playing { filter: brightness(1.15); }
.tl-clip.dragging { opacity: 0.4; }
.tl-clip.dropl { box-shadow: -4px 0 0 var(--accent); } .tl-clip.dropr { box-shadow: 4px 0 0 var(--accent); }
.tl-lab { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #fff; background: rgba(0,0,0,0.62); padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 3; touch-action: none; }
.tl-h.l { left: 0; } .tl-h.r { right: 0; }
.tl-clip.sel .tl-h, .tl-clip:hover .tl-h { background: rgba(255,155,38,0.75); }
.tl-end { position: absolute; top: 0; height: 58px; border-radius: 7px; border: 2px dashed #6b6b73; color: #9a9aa3; font-size: 11px; display: grid; place-items: center; }
.tl-cue { position: absolute; top: 3px; height: 20px; border-radius: 10px; border: 0; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; min-width: 24px; }
.tl-cue.vo { background: #2f7d57; }
.tl-cue.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; z-index: 4; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: #fff; }
.tl-binrow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.tl-binitem { flex: none; width: 76px; height: 110px; border-radius: 8px; border: 1px solid var(--line); background: #1c1c1f center / cover no-repeat; position: relative; padding: 0; overflow: hidden; }
.tl-binitem:hover { outline: 2px solid var(--accent); }
.tl-binitem span { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,0.7); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 4px; }
.tl-binitem i { position: absolute; left: 0; right: 0; top: 0; background: rgba(31,157,85,0.9); color: #fff; font-size: 9px; font-style: normal; font-weight: 700; padding: 1px 0; }
@media (max-width: 860px) { .tl-top { grid-template-columns: 1fr; } .tl-stage { margin: 0 auto; } }

/* resizable bars */
.rz { cursor: col-resize; position: relative; touch-action: none; }
.rz::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%); background: transparent; transition: background 0.15s; }
.rz:hover::after, .rz:focus-visible::after, body.resizing .rz::after { background: var(--accent); }
.rz-side { width: 10px; margin-left: -5px; z-index: 5; position: sticky; top: 0; height: 100vh; }
body.resizing { user-select: none; cursor: col-resize; }
body.resizing video, body.resizing iframe { pointer-events: none; }

/* chat, Claude Code style: plain text for the agent, a bubble only for you */
.msg { max-width: 100%; }
.msg.user { max-width: 82%; }
.msg.agent { align-self: stretch; }
.msg.agent .who { display: none; }
.msg.agent .bubble { background: none; border: 0; padding: 2px 4px; white-space: normal; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md h4 { margin: 14px 0 6px; font-size: 15px; font-weight: 700; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } .md li { margin: 3px 0; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #ececE8; padding: 1px 5px; border-radius: 5px; }
.md pre { background: #17171a; color: #e8e8ea; padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; color: inherit; }
.md a { color: #b25e00; }
.thinking { display: flex; align-items: center; gap: 10px; padding: 4px; color: var(--muted); font-weight: 600; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bob 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.8; } }
.steps { margin: 2px 4px 0; font-size: 12.5px; color: var(--muted); }
.steps summary { cursor: pointer; width: fit-content; }
.steps .step { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.steps .say { margin-top: 6px; color: var(--text); white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 4px 0; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.chip:hover { border-color: var(--accent); }

/* panel beside the chat */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.ptabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.ptabs button { flex: 1; background: none; border: 0; padding: 10px 8px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.ptabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.pbody { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.viewer { background: #000; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.viewer video, .viewer img { display: block; width: 100%; max-height: 58vh; object-fit: contain; background: #000; }
.viewer .textfile { color: #e8e8ea; padding: 12px; width: 100%; max-height: 58vh; }
.vmeta { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.vmeta .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.beats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.beats .pill { border: 0; cursor: pointer; }
.beats .pill:hover { background: #fff1dd; }
.strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.stripitem, .filecard .ft { position: relative; background: #1c1c1f; border-radius: 8px; overflow: hidden; display: grid; place-items: center; }
.stripitem { flex: none; width: 62px; height: 96px; border: 1px solid var(--line); padding: 0; }
.stripitem video, .stripitem img, .filecard .ft video, .filecard .ft img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.playmark { position: absolute; color: #fff; font-size: 16px; text-shadow: 0 1px 6px rgba(0,0,0,0.7); }
.doc { color: #c9c9cf; font-size: 26px; }
.filegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.filecard { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 0; text-align: left; overflow: hidden; display: flex; flex-direction: column; }
.filecard:hover, .stripitem:hover { border-color: var(--accent); }
.filecard .ft { aspect-ratio: 9 / 12; border-radius: 0; }
.filecard .fn { font-size: 12.5px; font-weight: 600; padding: 6px 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard .fm { font-size: 11px; color: var(--muted); padding: 0 8px 8px; }
.editcard .head { flex-wrap: wrap; }

/* settings: short cards in columns */
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-flow: dense; gap: 14px; align-items: start; }
.sgrid .card.wide { grid-column: span 2; }
.sgrid .card h2 { margin-bottom: 4px; }
.sgrid .card > .muted { font-size: 13.5px; }
@media (max-width: 760px) { .sgrid .card.wide { grid-column: auto; } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rz { display: none; }
  .chatwrap { display: flex; flex-direction: column; height: auto; gap: 12px; }
  .chat { height: 70vh; }
  .panel { max-height: 80vh; }
}

/* editor layout (dark, like VTM Video Studio): bin, preview, inspector, then tracks */
.ed { --e-bg: #121214; --e-panel: #1b1b1f; --e-line: #2c2c31; --e-text: #ececf0; --e-muted: #8f8f99; background: var(--e-bg); color: var(--e-text); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; margin: 0 -8px; }
.ed .muted, .ed .small.muted { color: var(--e-muted); }
.ed .btn { background: #26262b; border-color: #3a3a41; color: var(--e-text); }
.ed .btn:hover { border-color: #5a5a63; }
.ed .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ed .btn.danger { color: #ff8f86; }
.ed input[type=text], .ed input[type=number], .ed select, .ed textarea { background: #101012; border: 1px solid #3a3a41; color: var(--e-text); border-radius: 8px; padding: 8px 9px; width: 100%; font: inherit; }
.ed label { color: #c9c9d1; }
.ed .seg { background: #101012; border-color: #3a3a41; } .ed .seg button { color: var(--e-muted); } .ed .seg button.on { background: var(--accent); color: var(--accent-ink); }
.ed .bubble { background: #101012; border-color: #3a3a41; color: var(--e-text); }
.ed-top, .ed-tools { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--e-line); flex-wrap: wrap; }
.ed-tools { border-top: 1px solid var(--e-line); }
.ed .grow { flex: 1; }
.ed-title { font-size: 15px; } .ed-saved, .ed-info { font-size: 12.5px; color: var(--e-muted); }
.ed-sep { width: 1px; height: 20px; background: var(--e-line); margin: 0 4px; }
.ed-zoom { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; font-weight: 500; color: var(--e-muted); }
.ed-zoom input { width: 150px; accent-color: var(--accent); }
.ed-main { display: grid; grid-template-columns: 230px minmax(0, 1fr) 320px; height: min(52vh, 520px); min-height: 300px; }
.ed-bin { border-right: 1px solid var(--e-line); display: flex; flex-direction: column; min-height: 0; background: var(--e-panel); }
.ed-bintabs { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 13px; font-weight: 700; }
.ed-bintabs .muted { font-weight: 400; }
.ed-binlist { overflow-y: auto; flex: 1; padding: 0 6px 8px; }
.ed-binrow { display: flex; gap: 10px; align-items: center; width: 100%; background: none; border: 0; color: inherit; text-align: left; padding: 5px 6px; border-radius: 8px; }
.ed-binrow:hover { background: #26262b; }
.ed-binthumb { flex: none; width: 40px; height: 54px; border-radius: 5px; background: #2a2a2f center / cover no-repeat; }
.ed-binname { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.ed-binname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-binname small { color: var(--e-muted); font-size: 11.5px; }
.ed-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #000; }
.ed-stagewrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px; }
.ed .tl-stage { height: 100%; max-height: 100%; border-radius: 4px; }
.ed .tl-transport { background: var(--e-panel); margin: 0; padding: 8px 12px; justify-content: center; border-top: 1px solid var(--e-line); }
.ed .tl-time { margin-left: 12px; color: var(--e-text); font-size: 14px; }
.ed-side { border-left: 1px solid var(--e-line); display: flex; flex-direction: column; min-height: 0; background: var(--e-panel); }
.ed-itabs { display: flex; border-bottom: 1px solid var(--e-line); flex: none; }
.ed-itabs button { flex: 1; background: none; border: 0; color: var(--e-muted); font-weight: 700; padding: 10px 6px; border-bottom: 2px solid transparent; font-size: 13px; }
.ed-itabs button.on { color: var(--e-text); border-bottom-color: var(--accent); }
.ed-ibody { overflow-y: auto; padding: 12px; flex: 1; min-height: 0; }
.ed-ibody h2 { font-size: 14px; margin-bottom: 8px; }
.tl-hint { color: var(--e-muted, #6b6b73); text-align: center; padding: 28px 12px; font-size: 13.5px; }
.tl-note { display: flex; align-items: flex-start; gap: 6px; padding: 7px 0; border-top: 1px solid var(--e-line); font-size: 13px; }
.tl-note.done .grow { text-decoration: line-through; color: var(--e-muted); }
.tl-notetime { background: none; border: 0; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; padding: 0; flex: none; }
.ed-tracks { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
.ed-labels { border-right: 1px solid var(--e-line); background: var(--e-panel); }
.ed-lab { height: 32px; margin-top: 6px; display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 600; color: #c9c9d1; border-top: 1px dashed var(--e-line); }
.ed-lab.ruler { height: 34px; margin-top: 0; border-top: 0; border-bottom: 1px solid var(--e-line); }
.ed-lab.video { height: 64px; border-top: 0; }
.ed .tl-scroll { border-radius: 0; background: var(--e-bg); padding-bottom: 12px; }
.ed .tl-lane { height: 64px; margin-top: 6px; }
.ed .tl-lane.tl-cues { height: 32px; }
.ed .tl-clip { height: 64px; background-size: auto 100%; background-repeat: repeat-x; background-position: left center; }
.ed .tl-end { height: 64px; }
.ed .tl-cue { top: 5px; height: 22px; }
.tl-name { position: absolute; left: 0; right: 0; top: 0; font-size: 10.5px; color: #fff; background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0)); padding: 2px 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-music { position: absolute; top: 5px; left: 0; height: 22px; border-radius: 6px; background: #2b4a7a; color: #dce8ff; font-size: 10.5px; font-weight: 600; padding: 3px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-pin { position: absolute; bottom: 0; width: 10px; height: 10px; margin-left: -5px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #ffd24a; }
.ed .tl-head { background: var(--accent); } .ed .tl-head::before { border-top-color: var(--accent); }
@media (max-width: 1000px) { .ed-main { grid-template-columns: 1fr; height: auto; } .ed-bin { max-height: 180px; border-right: 0; } .ed-center { height: 46vh; } .ed-side { border-left: 0; max-height: 320px; } }

/* editor: looks, overlays, sounds, chat */
.tl-stage { container-type: size; }
.tl-layers { position: absolute; inset: 0; pointer-events: none; }
.tl-text { position: absolute; left: 6%; right: 6%; transform: translateY(-50%); text-align: center; font-weight: 800; line-height: 1.1; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 2px 5px #000; white-space: pre-line; }
.tl-pic { position: absolute; height: auto; border-radius: 2px; }
.tl-slider { display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 8px; font-size: 12.5px; color: var(--e-muted); margin-top: 4px; }
.tl-slider input { width: 100%; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.tl-cue.layer { background: #7a4fd6; } .tl-cue.sound { background: #2b6f8a; }
.tl-chatlog { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: calc(100% - 78px); min-height: 80px; font-size: 13.5px; }
.tl-chat.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); padding: 6px 10px; border-radius: 12px; max-width: 90%; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-chat.agent .md code { background: #2c2c31; } .tl-chat.agent .md a { color: var(--accent); }
.tl-chat.sys { color: var(--e-muted); font-size: 12px; text-align: center; }
.ed .thinking { color: var(--e-muted); }
.tl-chatform { display: flex; gap: 6px; align-items: flex-end; margin-top: 8px; }
.tl-chatform textarea { flex: 1; resize: none; }
.picklist { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.pickrow { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 8px; text-align: left; }
.pickrow:hover { border-color: var(--accent); }
.pickrow img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; }
.pickrow .doc { width: 36px; text-align: center; color: var(--muted); }

/* the editor as its own full-screen view */
.edfull { height: 100vh; background: #121214; }
.edfull #tl-root, .edfull .ed { height: 100%; }
.edfull .ed { margin: 0; border-radius: 0; }
.edfull .ed-main { flex: 1; height: auto; min-height: 0; }
.edfull .ed-tracks { flex: none; max-height: 40vh; overflow-y: auto; }
.edfull .ed-top { padding: 8px 12px; }
.edfull .ed-title { margin-left: 4px; }
@media (max-width: 1000px) { .edfull { height: auto; min-height: 100vh; } .edfull .ed { height: auto; } .edfull .ed-tracks { max-height: none; } }

/* preview: everything that will be on screen is drawn over the video */
.tl-layers { z-index: 2; }
.tl-sticker { z-index: 2; } .tl-sticker.off { display: none; }
.tl-stage.ended video { visibility: hidden; }
.tl-pop { position: absolute; background: #E23B33; color: #fff; font-weight: 800; border: 1.5px solid #fff; border-radius: 999px; padding: 0.6cqh 1.6cqh; font-size: 1.55cqh; white-space: nowrap; box-shadow: 0 3px 8px rgba(0,0,0,0.5); display: flex; align-items: center; gap: 0.6cqh; }
.tl-pop.local { left: 9%; top: 70%; flex-direction: column; border-radius: 1.6cqh; }
.tl-pop.like { right: 12%; top: 49.5%; }
.tl-pop b { font-size: 2cqh; line-height: 1; }
.tl-cap { position: absolute; left: 9%; right: 12%; top: 63%; transform: translateY(-50%); text-align: center; color: #fff; font-weight: 800; font-size: 3.1cqh; line-height: 1.1; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 2px 5px #000; }
.tl-cap.ghost { opacity: 0.55; font-size: 2.4cqh; } .tl-cap.ghost span { color: #FF3B3B; }
.tl-endslate { position: absolute; inset: 0; background: linear-gradient(#0b0b0d, #2a2a30 55%, #0b0b0d); color: #fff; font-weight: 800; text-align: center; display: flex; flex-direction: column; justify-content: space-between; padding: 15% 8% 16%; }
.tl-endslate .top { font-size: 3.6cqh; line-height: 1.12; } .tl-endslate .hl { color: #FF3B3B; font-size: 6.2cqh; }
.tl-endslate .cta { font-size: 3.2cqh; line-height: 1.15; }
.tl-endslate .tag { font-weight: 500; font-size: 1.7cqh; color: #b9b9c2; }
.tl-fine { background: var(--e-panel); color: var(--e-muted); font-size: 11.5px; text-align: center; padding: 0 12px 7px; }
.ed-lab.first { border-top: 0; }
.ed .tl-lane.tl-clips { margin-top: 6px; }
.ed .tl-end { cursor: pointer; }

/* ===== Dark theme, in the style of the Claude Code app ===== */
:root {
  --side: #1f1e1d; --side-2: #2d2c2a; --side-text: #cfccc3;
  --page: #262624; --card: #2f2e2c; --line: #403f3b;
  --text: #f1efe8; --muted: #a09d94;
  --good: #58c891; --bad: #ff7d70;
  color-scheme: dark;
}
body { font-size: 15px; }
a { color: #ffb65c; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select { background: #1f1e1d !important; color: var(--text); border-color: var(--line) !important; }
input::placeholder, textarea::placeholder { color: #7d7a72; }
.btn { background: #363533; color: var(--text); border-color: #4b4a45; }
.btn:hover { border-color: #6d6a63; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: #ff9a8f; }
.pill { background: #3b3a37; color: #d6d3ca; }
.pill.good { background: #1e3a2c; color: #74dca8; } .pill.bad { background: #4a2420; color: #ffa399; } .pill.busy { background: #473416; color: #ffc27a; }
.drop { background: #2b2a28; border-color: #57554f; } .drop.over { background: #3a2e1a; }
.bar { background: #3b3a37; }
.login { background: #1a1918; } .login-card { background: var(--card); border: 1px solid var(--line); }
.modal .box { background: var(--card); border: 1px solid var(--line); }
.toast { background: #111110; border: 1px solid var(--line); }
.seg { background: #1f1e1d; border-color: var(--line); } .seg button { color: var(--muted); } .seg button.on { background: var(--accent); color: var(--accent-ink); }
.tl-warn { background: #473416; border-color: #6b4e1f; color: #ffd9a3; }
.clip, .filecard, .chip, .pickrow { background: var(--card); }
.md code { background: #3b3a37; } .md pre { background: #1a1918; border: 1px solid var(--line); }
.beats .pill:hover { background: #473416; }
.code { background: #1a1918; }

/* sidebar: a plain list, like Claude Code */
.side { border-right: 1px solid #2f2e2c; padding: 14px 10px; }
.side .brand { font-size: 16px; padding: 4px 10px 12px; }
.side a { font-size: 15px; padding: 9px 10px; color: var(--side-text); justify-content: space-between; }
.side a .pname { overflow: hidden; text-overflow: ellipsis; }
.side .label { color: #7d7a72; letter-spacing: 0.04em; text-transform: none; font-size: 13px; padding: 14px 10px 6px; }
.newbtn { display: block; width: 100%; text-align: left; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 10px; font-weight: 600; margin-bottom: 6px; }
.newbtn:hover { background: var(--side-2); }
.side .foot { border-top: 1px solid #2f2e2c; }
.userrow { display: flex; align-items: center; gap: 8px; padding: 6px 6px 0; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: #3b3a37; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.uname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.side .gear { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 8px; background: none; border: 0; color: var(--side-text); font-size: 16px; flex: none; justify-content: center; }
.side .gear:hover, .side .gear.on { background: var(--side-2); color: #fff; }
.dots.mini i { width: 5px; height: 5px; }

/* chat: grey bubble for you, plain text for the agent, quiet activity lines */
.chatwrap { height: calc(100vh - 170px); }
.chatlog { gap: 18px; padding: 8px 8px 16px; }
.msg .who { display: none; }
.msg.user { max-width: 78%; }
.msg.user .bubble { background: #363533; border-color: #363533; color: var(--text); border-radius: 16px; padding: 12px 16px; }
.msg.agent .bubble { font-size: 15.5px; line-height: 1.6; padding: 0 4px; }
.msg.sys { color: #8b887f; }
.worked { color: var(--muted); font-size: 14.5px; margin: 0 4px 8px; }
.worked summary { cursor: pointer; list-style: none; width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worked summary::-webkit-details-marker { display: none; }
.worked summary::after { content: " ›"; }
.worked[open] summary::after { content: " ⌄"; }
.worked summary:hover { color: var(--text); }
.wsteps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wsteps span { background: #33322f; border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; font-size: 13px; color: #cfccc3; }
.thinking { color: var(--muted); font-weight: 500; font-size: 15px; gap: 12px; padding: 2px 4px; }
.thinking .elapsed { font-variant-numeric: tabular-nums; }
.dots { display: inline-grid; grid-template-columns: 6px 6px; gap: 4px; }
.dots i { width: 6px; height: 6px; background: #e8833a; animation: blink 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.45s; } .dots i:nth-child(4) { animation-delay: 0.3s; }
.dots.mini { display: inline-flex; gap: 3px; flex: none; }
@keyframes blink { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
.quick { border-top: 0; padding-top: 6px; }
.chatbox { border: 1px solid var(--line); background: #30302e; border-radius: 16px; padding: 8px 8px 8px 14px; align-items: flex-end; margin-top: 8px; }
.quick + .chatbox { border-top: 1px solid var(--line); padding-top: 8px; }
.chatbox textarea { background: none !important; border: 0 !important; padding: 8px 0; min-height: 24px; font-size: 15.5px; line-height: 1.4; }
.chatbox textarea:focus-visible { outline: none; }
.chatbox:focus-within { border-color: #6d6a63; }
.sendbtn { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 800; flex: none; }
.sendbtn.stop { background: #f1efe8; color: #1f1e1d; font-size: 12px; }
.sendbtn[hidden] { display: none; }
.panel { background: #2a2927; }
.ptabs button.on { color: var(--text); }
.tabs button.on { color: var(--text); }
.sgrid .card, .card { background: var(--card); }

/* ===== Editor in the same warm dark theme as the rest of the app ===== */
.ed { --e-bg: #262624; --e-panel: #1f1e1d; --e-line: #403f3b; --e-text: #f1efe8; --e-muted: #a09d94; }
.edfull { background: #262624; }
.ed .btn { background: #363533; border-color: #4b4a45; color: var(--e-text); }
.ed .btn:hover { border-color: #6d6a63; }
.ed .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ed .btn.danger { color: #ff9a8f; }
.ed input[type=text], .ed input[type=number], .ed select, .ed textarea { background: #1a1918 !important; border-color: var(--e-line) !important; color: var(--e-text); }
.ed label { color: #cfccc3; }
.ed .seg { background: #1a1918; border-color: var(--e-line); }
.ed .bubble { background: #2f2e2c; border-color: var(--e-line); }
.ed-top, .ed-tools { background: #2a2927; }
.ed-binrow:hover { background: #2d2c2a; }
.ed-binthumb { background-color: #33322f; }
.ed-center { background: #141413; }
.ed .tl-transport, .tl-fine { background: #1f1e1d; }
.ed-lab { color: #cfccc3; }
.ed .tl-scroll { background: #262624; }
.tl-ruler { border-bottom-color: #403f3b; }
.tl-tick { color: #8f8c84; border-left-color: #4b4a45; }
.tl-lane.tl-cues { border-top-color: #403f3b; }
.tl-clip { background-color: #3b3a37; border-color: #5c5a54; }
.tl-clip.broll { border-color: #6d6a63; } .tl-clip.talk { border-color: #5b9df0; } .tl-clip.amb { border-color: #a580f2; }
.tl-end { border-color: #6d6a63; color: #a09d94; }
.tl-music { background: #34507c; }
.tl-chat.agent .md code { background: #3b3a37; }
.tl-note { border-top-color: var(--e-line); }
/* the "no preview" note sits low in the frame, clear of the sticker and the captions */
.tl-missing { place-items: end center; padding: 0 12% 14%; font-size: 12px; color: #a09d94; }

/* messages waiting behind the current work, and a ruler made for dragging */
.waiting { color: var(--muted); font-size: 13.5px; margin: 6px 4px 0 30px; }
.tl-ruler { cursor: ew-resize; touch-action: none; user-select: none; }
.chatbox .sendbtn + .sendbtn { margin-left: 2px; }
