:root {
  --purple: #6C3CE6;
  --purple-dark: #4d27b0;
  --purple-soft: #f0ebfd;
  --ink: #1a1526;
  --muted: #7a7490;
  --line: #e7e3f2;
  --bg: #f6f4fb;
  --white: #ffffff;
  --ok: #1aa06d;
  --err: #d8403a;
  --warn: #d98a1a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(76, 39, 176, 0.10);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; }
.brand span { color: var(--purple); }
.brand em { font-style: normal; font-weight: 600; color: var(--muted); font-size: 15px; }

.muted { color: var(--muted); }

/* ---------- login ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #efeafd 0%, var(--bg) 60%);
}
.login-card {
  background: var(--white); width: 340px; max-width: 92vw; padding: 36px 30px;
  border-radius: var(--radius); box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card .brand { font-size: 26px; margin-bottom: 4px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 6px; }
.login-card input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.login-card button { padding: 12px; border: 0; border-radius: 10px; background: var(--purple); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.login-card button:hover { background: var(--purple-dark); }
.err { color: var(--err); font-size: 13px; }

/* ---------- app ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--white); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.ghost:hover { border-color: var(--purple); color: var(--purple); }

.wrap {
  max-width: 1040px; margin: 24px auto; padding: 0 16px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
}
@media (max-width: 880px) { .wrap { grid-template-columns: 1fr; } }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }

form label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 14px; }
form textarea, form input[type=text], form input[type=number], form input[type=password], form select {
  width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: #fcfbff; color: var(--ink);
}
form textarea { resize: vertical; }
form select { cursor: pointer; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }
.row.between { align-items: center; justify-content: space-between; margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 0 !important; }
.check input { width: auto; margin: 0; }

#submitBtn {
  margin-top: 18px; width: 100%; padding: 13px; border: 0; border-radius: 11px;
  background: var(--purple); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
}
#submitBtn:hover { background: var(--purple-dark); }
#submitBtn:disabled { opacity: 0.6; cursor: default; }
.formmsg { font-size: 13px; margin: 10px 0 0; min-height: 16px; }
.formmsg.ok { color: var(--ok); }
.formmsg.bad { color: var(--err); }

/* ---------- job cards ---------- */
.jobs { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.empty { color: var(--muted); font-size: 14px; padding: 20px 0; text-align: center; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfbff; }
.card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card .by { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge.queued { background: #eceafc; color: var(--purple-dark); }
.badge.running { background: #fff3e0; color: var(--warn); }
.badge.done { background: #e4f6ee; color: var(--ok); }
.badge.error { background: #fde8e7; color: var(--err); }

.stage { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--purple); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card video { width: 100%; border-radius: 10px; margin-top: 12px; background: #000; max-height: 420px; }
.card .caption { margin-top: 10px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card .actions a, .card .actions button {
  font-size: 12px; font-weight: 600; text-decoration: none; padding: 7px 12px;
  border-radius: 8px; border: 1px solid var(--line); color: var(--purple-dark);
  background: #fff; cursor: pointer;
}
.card .actions a:hover, .card .actions button:hover { border-color: var(--purple); }
.card .errmsg { margin-top: 10px; font-size: 12px; color: var(--err); background: #fde8e7; padding: 9px; border-radius: 8px; }
