:root {
  --bg: #f4f5f2; --panel: #fff; --text: #1f2328; --muted: #6a6f76; --line: #e2e4e0;
  --accent: #1f6feb; --accent-text: #fff; --ok: #1a7f37; --ok-bg: #e6f4ea; --warn: #9a6700; --warn-bg: #fff4d6;
  --no: #b42318; --no-bg: #fdecea; --shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 13px; }
.err { color: var(--no); }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 24px; background: #15202b; }
.top .brand { color: #fff; font-weight: 600; font-size: 17px; }
.top nav { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.top nav a { color: #c9d1d9; }
.top nav a.active { color: #fff; font-weight: 600; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 120px; }

.panel { background: var(--panel); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row input[name=name] { flex: 1; min-width: 0; }
.spacer { flex: 1; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #c9ccc6; border-radius: 6px; background: #fff; color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; padding: 8px 14px; border-radius: 6px;
  border: 1px solid #c9ccc6; background: #fff; color: var(--text); cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #f0f1ee; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.ok { border-color: var(--ok); color: var(--ok); }
.btn.ok:hover { background: var(--ok-bg); }
.btn.no { border-color: var(--no); color: var(--no); }
.btn.no:hover { background: var(--no-bg); }
.btn.ghost { color: var(--muted); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link.danger { color: var(--no); }
.link.sm { font-size: 13px; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-weight: 600; color: var(--muted); font-size: 13px; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f7f8f6; }
.tbl td.name { word-break: break-all; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #eceeea; color: var(--muted); }
.st-queued { background: #e8f0fe; color: #1a56c4; }
.st-running { background: #e8f0fe; color: #1a56c4; }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-error { background: var(--no-bg); color: var(--no); }
.st-stopped { background: var(--warn-bg); color: var(--warn); }

.back { font-size: 14px; }
.c-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 4px 0 16px; }
.steps { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.steps .panel { margin-bottom: 16px; }
.drop { border: 2px dashed #c3c7c0; border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); background: #fafbf9; }
.drop.big { padding: 26px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.drop.over { border-color: var(--accent); background: #eef4ff; }
.lib-add { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
ul.esk { list-style: none; padding: 0; margin: 0 0 12px; }
ul.esk li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
ul.esk li .link:first-child { word-break: break-all; text-align: left; }

.run-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.progress { margin-bottom: 12px; }
.bar { height: 6px; background: #e6e8e3; border-radius: 99px; overflow: hidden; }
.bar.big { height: 12px; margin-bottom: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.res-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 12px; }
.res-head h2 { margin: 0; }
details.pending { background: var(--panel); border-radius: 10px; padding: 10px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
details.pending summary { cursor: pointer; font-weight: 600; }
details.pending ul { margin: 8px 0 0; padding-left: 18px; columns: 2; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.col { background: #ebedea; border-radius: 10px; padding: 12px; min-height: 120px; }
.col h3 { display: flex; justify-content: space-between; }
.col .cnt { background: #fff; border-radius: 99px; padding: 0 10px; font-size: 14px; }
.c-found { background: #e3f1e6; }
.c-review { background: #fbf1d5; }
.c-none { background: #eeeeec; }
.col .empty { text-align: center; margin: 24px 0; }
.vc { background: #fff; border-radius: 8px; padding: 8px; margin-bottom: 10px; box-shadow: var(--shadow); font-size: 13px; }
.vc img { width: 100%; border-radius: 5px; display: block; cursor: zoom-in; background: #ddd; aspect-ratio: 16 / 9; object-fit: contain; }
.vc .noimg { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; background: #f1f1ef; color: var(--muted); border-radius: 5px; }
.vc .vn { font-weight: 600; margin-top: 6px; word-break: break-all; }
.vc .vm { color: var(--muted); margin: 2px 0 8px; }
.vc .vb { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.uploads { position: fixed; right: 16px; bottom: 16px; width: 380px; max-width: calc(100vw - 32px); max-height: 50vh; overflow: auto;
  background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: 12px 14px; z-index: 20; }
.uploads-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.up-row { padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row .bar { margin: 4px 0 2px; }
.up-row.ok .bar i { background: var(--ok); }
.up-row.ok .up-st { color: var(--ok); }
.up-row.error .bar i { background: var(--no); }
.up-row.error .up-st { color: var(--no); }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.modal-box { background: #fff; border-radius: 10px; padding: 16px; max-width: min(1100px, 100%); max-height: 100%; overflow: auto; position: relative; }
.modal-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 20px; cursor: pointer; }
.modal-title { margin: 0 32px 10px 0; word-break: break-all; }
.modal video, .modal img.full { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; background: #000; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2328; color: #fff; padding: 10px 18px;
  border-radius: 8px; z-index: 40; max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.toast.err { background: var(--no); }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { background: #fff; padding: 28px; border-radius: 12px; box-shadow: var(--shadow); width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-box h1 { font-size: 21px; }
.login-box p { margin: -8px 0 4px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

@media (max-width: 1000px) {
  .steps, .cols { grid-template-columns: 1fr; }
  details.pending ul { columns: 1; }
}
@media (max-width: 600px) {
  main { padding: 14px 16px 120px; }
  .top { padding: 10px 16px; }
  .top nav { margin-left: 0; }
}
