:root {
  --bg: #0f1115;
  --card: #181b22;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #ff4d4d;
  --accent-2: #ff8a5c;
  --ok: #4cd97b;
  --err: #ff6b6b;
  --border: #262a33;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
input, select, button { font: inherit; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; align-content: start; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px; max-width: 760px; margin: 0 auto; width: 100%; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 4px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
input, select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: #0c0e12; color: var(--text); font-size: 1rem; }
button { padding: 10px 16px; border-radius: 8px; border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: 0.5; cursor: wait; }
button.link { background: none; color: var(--muted); padding: 4px 8px; font-weight: 400; }
button.link:hover { color: var(--text); }
.row { display: flex; gap: 8px; align-items: end; }
.row label { margin: 0 0 8px; }
.row select { width: auto; min-width: 110px; }
.row input, .row select, .row button { height: 42px; }
.error { color: var(--err); margin: 8px 0 0; font-size: 0.9rem; min-height: 1.2em; }
.preview { display: flex; gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.preview img { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #000; flex-shrink: 0; }
.preview .meta { flex: 1; min-width: 0; }
.preview p { color: var(--muted); margin: 0 0 12px; font-size: 0.9rem; }
.jobs { display: grid; gap: 12px; }
.job-head, .job-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-status { font-size: 0.8rem; color: var(--muted); text-transform: capitalize; }
.job.done .job-status { color: var(--ok); }
.job.error .job-status { color: var(--err); }
.bar { height: 6px; background: #0c0e12; border-radius: 3px; margin: 10px 0; overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s; }
.job.done .fill { background: var(--ok); }
.job.error .fill { background: var(--err); }
.job-detail { font-size: 0.85rem; color: var(--muted); flex: 1; min-width: 0; overflow-wrap: anywhere; }
a.save { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 8px; background: var(--ok); color: #05210f; font-weight: 600; text-decoration: none; }
.usage { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 16px; }
.login-body { align-items: center; justify-content: center; }
.login-card { width: min(360px, calc(100% - 32px)); flex: 0 0 auto; margin: auto; }
.login-card button { width: 100%; margin-top: 8px; }
@media (max-width: 520px) {
  .preview { flex-direction: column; }
  .preview img { width: 100%; }
  .row { flex-wrap: wrap; }
  .row input { flex: 1 1 100%; }
  button, a.save { min-height: 44px; }
}
