:root {
  color-scheme: light dark;
  --border: #ccc;
  --muted: #666;
  --bg-alt: #f4f4f4;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-weight: 600;
  text-decoration: none;
}

.topbar nav {
  flex: 1;
}

.topbar nav a {
  margin-right: 1rem;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.logout-form button {
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem;
}

footer {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

fieldset {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.upload-widget {
  margin-top: 1rem;
}

.upload-widget progress {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 0.5rem;
  height: 0.9rem;
}

.upload-cancel {
  margin-top: 0.5rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}

label {
  display: block;
  margin-top: 0.75rem;
  font-weight: 600;
}

select, input[type="number"], input[type="text"], input[type="password"] {
  display: block;
  margin-top: 0.25rem;
  padding: 0.4rem;
  width: 100%;
  max-width: 420px;
}

button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: #b00020;
  font-weight: 600;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.5rem;
}

table.kv th {
  text-align: left;
  width: 180px;
  color: var(--muted);
  font-weight: 600;
  vertical-align: top;
}

th, td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-alt);
}

.status-completed { background: #d4f7dc; color: #14532d; }
.status-failed { background: #fbd5d5; color: #7f1d1d; }
.status-running { background: #fef3c7; color: #78350f; }
.status-queued { background: #e5e7eb; color: #374151; }

pre.log {
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: 6px;
  max-height: 480px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --border: #444;
    --bg-alt: #1e1e1e;
  }
  body { background: #121212; color: #e6e6e6; }
  .status-completed { background: #14351f; color: #a7f3c9; }
  .status-failed { background: #3a1616; color: #fca5a5; }
  .status-running { background: #3a2f0e; color: #fde68a; }
  .status-queued { background: #2a2a2a; color: #d1d5db; }
}
