:root {
  --bg: #0f1318;
  --surface: #171c23;
  --surface-2: #1f262f;
  --border: #2a323d;
  --text: #e8edf2;
  --muted: #8c98a6;
  --accent: #00bcd4;
  --accent-text: #001f24;
  --ok: #4caf7a;
  --warn: #e0a43a;
  --error: #ef6b6b;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8; --surface: #ffffff; --surface-2: #eef1f4; --border: #d8dee5;
    --text: #12171d; --muted: #5d6874; --accent: #0097a7; --accent-text: #ffffff;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));
}
main { max-width: 720px; margin: 0 auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 12px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 4px; overflow-wrap: anywhere; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 8px; }
.muted { color: var(--muted); }
.error { color: var(--error); margin: 8px 0; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok::before { content: "●"; color: var(--ok); margin-right: 6px; }
.pill.bad { color: var(--error); }
.pill.bad::before { content: "●"; margin-right: 6px; }

form { display: flex; gap: 8px; }
input {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 12px 16px;
  background: var(--accent); color: var(--accent-text); cursor: pointer; white-space: nowrap;
}
button:disabled { opacity: .55; cursor: default; }
button.secondary { background: var(--surface-2); color: var(--text); }
button.link { background: none; color: var(--muted); padding: 4px; font-weight: 500; }
a.button { display: inline-block; text-decoration: none; font-weight: 600; border-radius: 10px; padding: 10px 14px; background: var(--accent); color: var(--accent-text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-top: 14px; }
.media { display: flex; gap: 12px; align-items: flex-start; }
.media p { margin: 0; }
.media img { width: 128px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.choices { display: grid; gap: 10px; margin-top: 16px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  flex: 1 1 0; min-width: 72px; display: grid; gap: 2px; justify-items: center; text-align: center;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 9px 10px; font-weight: 600;
}
.seg-btn small { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.seg-btn:hover:not(:disabled) { border-color: var(--accent); }
.seg-btn.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); border-color: var(--accent); }
.seg-btn.on small { color: var(--text); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.go { margin-top: 6px; width: 100%; display: flex; justify-content: center; align-items: baseline; gap: 10px; padding: 14px 16px; }
.go-size { font-weight: 500; opacity: .8; font-size: 14px; }
details { margin-top: 12px; color: var(--muted); font-size: 14px; }
details summary { cursor: pointer; }
.raw-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); align-items: center; }
.raw-row code { font-size: 12px; color: var(--text); overflow-wrap: anywhere; }
.raw-row button { padding: 6px 10px; font-size: 13px; }

.jobs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.job { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.job-top { display: flex; gap: 10px; align-items: center; }
.job-top img { width: 64px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.job-title { font-weight: 600; overflow-wrap: anywhere; }
.job-sub { font-size: 13px; color: var(--muted); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.job-actions button { padding: 8px 12px; font-size: 14px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.bar.indet > i { width: 30%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
.status-failed { color: var(--error); }
.status-done { color: var(--ok); }

footer { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; font-size: 13px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .media img { width: 96px; }
  form.row { flex-direction: column; }
}
