:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-hover: #3d78e8;
  --ok: #3ecf8e;
  --err: #ff6b6b;
  --warn: #f0b429;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.brand svg { display: block; }

.nav { display: flex; gap: 6px; align-items: center; }
.nav a, .nav form button {
  font-size: 13px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--text); background: var(--surface-2); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.card.disabled { opacity: 0.6; }
.card .planned-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 6px;
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: middle;
}

.row { display: flex; gap: 8px; }
@media (max-width: 560px) { .row { flex-direction: column; } }

input[type="text"], input[type="password"], input[type="url"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
input:focus { border-color: var(--accent); }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border: 1px solid var(--err); color: var(--err); }
.btn-danger:hover { background: rgba(255,107,107,0.12); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.jobs { display: flex; flex-direction: column; gap: 10px; }
.job {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.job-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.job-title { font-weight: 500; word-break: break-word; font-size: 14px; }
.job-url { color: var(--muted); font-size: 12px; word-break: break-all; }

.status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status.queued { background: rgba(154,163,178,0.18); color: var(--muted); }
.status.running { background: rgba(79,140,255,0.18); color: var(--accent); }
.status.done { background: rgba(62,207,142,0.18); color: var(--ok); }
.status.error { background: rgba(255,107,107,0.18); color: var(--err); }
.status.canceled { background: rgba(240,180,41,0.18); color: var(--warn); }

.progress {
  height: 6px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0 8px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.job-meta { display: flex; gap: 12px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.job-actions { display: flex; gap: 8px; margin-top: 10px; }

.log {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 24px; }

.notice { font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.notice.ok { background: rgba(62,207,142,0.12); color: var(--ok); border: 1px solid rgba(62,207,142,0.3); }
.notice.err { background: rgba(255,107,107,0.12); color: var(--err); border: 1px solid rgba(255,107,107,0.3); }

/* Login */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand { justify-content: center; margin-bottom: 18px; font-size: 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }

code { font-family: var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
