:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --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", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.error { color: var(--danger); min-height: 20px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 16px; margin: 0 0 12px; }

button {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
button:hover { background: #f3f4f6; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: #b91c1c; }
button.ghost { background: transparent; }
button.small { padding: 3px 10px; font-size: 13px; }

input, select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--primary); }
input { min-width: 220px; }

/* 登录 */
.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
}
.login-card input { width: 100%; }

/* 布局 */
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: baseline; }
header nav { display: flex; gap: 4px; }
.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
}
.tab:hover { background: #f3f4f6; color: var(--text); }
.tab.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.header-right select { min-width: 120px; }

main { max-width: 1180px; margin: 0 auto; padding: 22px 24px 60px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.view { display: flex; flex-direction: column; gap: 16px; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { display: flex; gap: 10px; align-items: center; }
.domain .card-head { margin-bottom: 10px; }
.domain-head-actions { display: flex; gap: 8px; align-items: center; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, th.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f9fafb; }

/* 徽标 */
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 20px;
  background: #f3f4f6;
  color: var(--muted);
}
.badge.ok { background: #ecfdf5; color: var(--ok); }
.badge.bad { background: #fef2f2; color: var(--danger); }
.badge.run { background: #eff6ff; color: var(--primary); }
.badge.wait { background: #fffbeb; color: var(--warn); }

/* 横幅 */
.banner {
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}
.banner.bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.banner.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.result { margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.switch { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); }

/* 提示 */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  max-width: 80vw;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card { width: 460px; max-width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 日志 */
pre.log {
  margin: 0;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* 进度条 */
.progress {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width .3s;
}