:root {
  --bg: #0f1117; --panel: #171a23; --panel2: #1e2230; --line: #2a2f40; --text: #e8eaf0; --muted: #9aa3b8;
  --accent: #ff7a1a; --accent-ink: #1a0d00; --ok: #3ecf8e; --warn: #f5b942; --bad: #ff5d6c; --info: #5aa9ff;
  --radius: 12px; --shadow: 0 8px 28px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f4f5f9; --panel: #fff; --panel2: #eef0f6; --line: #d9dde8; --text: #1b1f2b; --muted: #5d667c; --shadow: 0 8px 28px rgba(20,30,60,.12); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .hidden { display: none !important; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .gap { gap: 1rem; }
.stack > * + * { margin-top: .9rem; }

/* controles */
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .9rem; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { border-color: var(--bad); color: var(--bad); } .btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
input, select, textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
input[type=checkbox] { width: auto; } input[type=range] { padding: 0; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.field + .field { margin-top: .8rem; }
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); font-size: .8rem; cursor: default; }
button.chip { cursor: pointer; } .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge { padding: .1rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.badge.queued, .badge.running { background: #5aa9ff33; color: var(--info); } .badge.needs_review { background: #f5b94233; color: var(--warn); }
.badge.succeeded { background: #3ecf8e33; color: var(--ok); } .badge.failed, .badge.cancelled { background: #ff5d6c33; color: var(--bad); }

/* layout */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { font-weight: 800; letter-spacing: .3px; } .logo b { color: var(--accent); }
.nav { display: flex; gap: .25rem; } .nav a { padding: .35rem .8rem; border-radius: 8px; color: var(--muted); } .nav a.active, .nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.2rem 6rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: .15s; }
.tile, .tile:hover { color: var(--text); text-decoration: none; display: block; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.thumb { aspect-ratio: 16/9; background: var(--panel2); display: grid; place-items: center; color: var(--muted); font-size: 2rem; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .meta { padding: .8rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .card { width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 1rem; } .tabs button { flex: 1; background: none; border: 0; padding: .6rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.alert { padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; } .alert.err { background: #ff5d6c22; color: var(--bad); } .alert.ok { background: #3ecf8e22; color: var(--ok); } .alert.info { background: #5aa9ff22; color: var(--info); }

/* upload / progresso */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.4rem; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--accent); color: var(--text); }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* review */
.cuts { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cut { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; } .cut.off { opacity: .45; }
.cut video, .cut audio, .player video { width: 100%; border-radius: 8px; background: #000; }
.timeline { display: flex; gap: .3rem; flex-wrap: wrap; } .step { padding: .2rem .6rem; border-radius: 8px; font-size: .8rem; background: var(--panel2); color: var(--muted); }
.step.done { background: #3ecf8e22; color: var(--ok); } .step.running { background: #5aa9ff22; color: var(--info); } .step.failed { background: #ff5d6c22; color: var(--bad); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); font-size: .9rem; } th { color: var(--muted); font-weight: 500; }
.copybox { background: var(--panel2); border-radius: 8px; padding: .6rem .8rem; }

/* modal e chat */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 1rem; z-index: 20; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); } .modal.wide { max-width: 860px; }
.chat-fab { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 10; border-radius: 99px; padding: .8rem 1.2rem; box-shadow: var(--shadow); }
.chat { position: fixed; right: 1.2rem; bottom: 1.2rem; width: min(420px, calc(100vw - 2rem)); height: min(620px, calc(100vh - 6rem)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 15; }
.chat header { padding: .7rem 1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.chat .msgs { flex: 1; overflow: auto; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { max-width: 88%; padding: .5rem .75rem; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; } .msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); } .msg.assistant { align-self: flex-start; background: var(--panel2); }
.chat form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); } .chat textarea { resize: none; height: 44px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.2rem; background: var(--panel2); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 10px; z-index: 30; box-shadow: var(--shadow); }
@media (max-width: 640px) { .nav a { padding: .3rem .5rem; } main { padding: 1rem .8rem 6rem; } .topbar { flex-wrap: wrap; } }

/* ajustes pós-teste visual */
.player video { max-height: 56vh; margin: 0 auto; display: block; }
a.btn { color: var(--text); display: inline-block; text-decoration: none; } a.btn.primary { color: var(--accent-ink); } a.btn:hover { text-decoration: none; }
.cut video { max-height: 340px; }
