:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1f2530;
  --border: #2a3140;
  --text: #e6edf3;
  --muted: #8b95a5;
  --accent: #4eaaff;
  --accent-strong: #1f6feb;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

header {
  padding: 32px 24px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tag {
  margin: 0;
  color: var(--muted);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  user-select: none;
  margin-bottom: 8px;
}

.field summary:hover {
  color: var(--text);
}

.lbl {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.req {
  color: var(--err);
  margin-left: 2px;
}

input[type="file"],
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

input[type="file"] {
  padding: 8px 12px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(78, 170, 255, 0.2);
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.inline {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}

.inline.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding-top: 22px;
}

.inline.checkbox input {
  width: auto;
}

button,
.btn {
  background: var(--accent-strong);
  color: white;
  border: 0;
  border-radius: 6px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.btn:hover {
  background: var(--accent);
}

button:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ok);
}
.btn.primary:hover {
  background: #4ac162;
}

.btn:not(.primary) {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

#submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.hidden {
  display: none !important;
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.job-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}

.job-header h2 code {
  color: var(--text);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

.status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status-queued { color: var(--muted); }
.status-running { color: var(--warn); border-color: var(--warn); }
.status-done { color: var(--ok); border-color: var(--ok); }
.status-failed { color: var(--err); border-color: var(--err); }

#job-message {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

#job-error {
  background: #2c1216;
  border: 1px solid var(--err);
  color: #ffb4b4;
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}

#job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

#preview-wrap {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

#preview-frame {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  border: 0;
  display: block;
}

footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

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