:root {
  --bg: #1f1f1f;
  --card: #2c2c2c;
  --line: #3d3d3d;
  --text: #ececec;
  --muted: #a0a0a0;
  --accent: #e67e22;
  --accent-text: #1f1f1f;
  --pitch: #2d6a4f;
  --ok: #2ecc71;
  --busy: #f1c40f;
  --bad: #e74c3c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.04em; }
.top-right { display: flex; gap: 12px; align-items: center; }
.accent { color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
main:has(.layout:not([hidden])) { max-width: 1760px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.col-main, .col-side { min-width: 0; }
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
  .col-side { position: sticky; top: 16px; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }

label { display: block; margin: 12px 0 4px; font-weight: 600; }
input[type="password"], textarea, select {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #232323;
  color: var(--text);
  font: inherit;
}
textarea { resize: vertical; min-height: 110px; }
input[type="file"] { max-width: 100%; color: var(--muted); }

button, .button {
  display: inline-block;
  padding: 10px 16px;
  margin-top: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #383838;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.link { background: none; border: none; color: var(--muted); padding: 0; margin: 0; text-decoration: underline; }

progress { width: 100%; margin-top: 12px; accent-color: var(--accent); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.space { justify-content: space-between; }
.hint { justify-content: flex-end; color: var(--muted); font-size: 0.85rem; }
.actions { gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--bad); }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill-online, .pill-completed { color: var(--ok); }
.pill-busy, .pill-running, .pill-queued, .pill-retrying, .pill-uploading { color: var(--busy); }
.pill-offline, .pill-failed { color: var(--bad); }
.pill-unknown, .pill-cancelled { color: var(--muted); }

.stages { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.stages li { padding: 2px 8px; border-radius: 4px; background: #232323; color: var(--muted); font-size: 0.85rem; }
.stages li.done { color: var(--text); }
.stages li.current { color: var(--accent-text); background: var(--accent); font-weight: 600; }

#preview { display: block; width: auto; height: auto; max-width: 100%; max-height: 80vh; margin: 0 auto;
  border-radius: 6px; background: var(--pitch); }
#preview-scrub { width: 100%; margin-top: 10px; accent-color: var(--accent); }
.controls { gap: 8px; }
.controls button, .controls select { margin-top: 4px; }
.controls select { width: auto; padding: 9px 10px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: none; }
.history button { margin: 0; padding: 4px 10px; font-size: 0.85rem; }
.history .prompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }

.turnstile:empty { display: none; }
.turnstile { margin-top: 12px; }

[hidden] { display: none !important; }
