:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 0 0 12px; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: #111827;
  color: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 17px; }
.nav { display: flex; gap: 18px; }
.nav a { color: #d1d5db; }
.nav a:hover { color: #fff; text-decoration: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: #d1d5db; }
.link { background: none; border: 0; color: #93c5fd; cursor: pointer; padding: 0; font: inherit; }

.container { max-width: 1180px; margin: 24px auto 64px; padding: 0 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.card.narrow { max-width: 420px; margin: 60px auto; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 160px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 7px; font-weight: 400; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input[type=checkbox] { width: auto; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
button:disabled { opacity: .6; cursor: wait; }
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #fff; border-color: #d1d5db; color: var(--text); }
.secondary:hover { background: #f9fafb; }
.danger { background: var(--danger); color: #fff; }
.small { padding: 5px 10px; font-size: 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.list-item.vertical { flex-direction: column; align-items: stretch; }
.list-item form { margin: 0; }

details.add { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 10px; }
details summary { cursor: pointer; color: var(--primary); font-weight: 600; margin-bottom: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f9fafb; }
tr:last-child td { border-bottom: 0; }
.truncate { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
  white-space: nowrap;
}
.badge.success { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.running { background: #dbeafe; color: #1e40af; }
.badge.pending, .badge.queued { background: #fef3c7; color: #92400e; }
.badge.canceled { background: #e5e7eb; color: #4b5563; }

.progress { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width .4s ease; }
.mini-progress { width: 90px; height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-progress > span { display: block; height: 100%; background: var(--primary); }
.job-status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; word-break: break-all; }

pre.logs {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
