:root {
  --bg: #0f1115;
  --card: #171a21;
  --card2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaef;
  --muted: #8b93a3;
  --accent: #ff5a36;
  --accent2: #ff7a5c;
  --ok: #3ccf8e;
  --err: #ff5d6c;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error-text { color: var(--err); white-space: pre-wrap; }

header { display: flex; align-items: center; justify-content: space-between;
  max-width: 1100px; margin: 0 auto; padding: 18px 20px 6px; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.logo::first-letter { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 10px 20px 60px; display: grid; gap: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 260px; min-width: 0; }

input[type=text], input[type=url], input[type=password], input[type=number], select {
  background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
input[type=number] { width: 110px; }

.btn { background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #3a4150; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn:disabled { opacity: .5; cursor: default; }

.tabs { display: inline-flex; background: var(--card2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 7px 14px; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.active { background: var(--line); color: var(--text); }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--muted); cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--accent); color: var(--text); background: #ff5a3610; }

.progress { height: 6px; background: var(--card2); border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.job { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; }
.job .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job.done .progress > div { background: var(--ok); }
.job.error .progress > div { background: var(--err); }

/* редактор */
.editor { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }
video { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; display: block; }

.timeline { position: relative; height: 44px; margin: 14px 8px 6px; touch-action: none; cursor: pointer; }
.timeline .track { position: absolute; top: 18px; left: 0; right: 0; height: 8px; background: var(--card2); border-radius: 4px; }
.timeline .sel { position: absolute; top: 18px; height: 8px; background: var(--accent); border-radius: 4px; opacity: .85; }
.timeline .head { position: absolute; top: 10px; width: 2px; height: 24px; background: #fff; margin-left: -1px; pointer-events: none; }
.timeline .handle { position: absolute; top: 8px; width: 16px; height: 28px; margin-left: -8px; background: #fff;
  border-radius: 5px; cursor: ew-resize; box-shadow: 0 1px 4px #0008; }
.timeline .handle::after { content: ""; position: absolute; left: 6px; top: 8px; width: 4px; height: 12px;
  border-left: 1px solid #999; border-right: 1px solid #999; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.radio-list { display: grid; gap: 6px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; background: var(--card2); }
.radio-list label:has(input:checked) { border-color: var(--accent); }
.radio-list input { margin-top: 3px; accent-color: var(--accent); }
.radio-list b { display: block; font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--card2); border: 1px solid var(--line); color: var(--text); border-radius: 20px;
  padding: 4px 10px; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.stat { background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.stat .v { font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); }

/* список файлов */
.files { display: grid; gap: 8px; }
.file { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--card2);
  border-radius: 10px; border: 1px solid transparent; }
.file.active { border-color: var(--accent); }
.file .info { flex: 1; min-width: 0; }
.file .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--line); color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.badge.processed { background: #3ccf8e22; color: var(--ok); }
.badge.download { background: #4f8cff22; color: #7da8ff; }
.file .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .file { flex-wrap: wrap; } .file .actions { width: 100%; justify-content: flex-start; } }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--card2); border: 1px solid var(--line);
  border-left: 4px solid var(--ok); padding: 12px 16px; border-radius: 10px; max-width: 380px; z-index: 10;
  box-shadow: 0 8px 30px #0008; }
.toast.err { border-left-color: var(--err); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; }
.login-card p { margin: 0; }
