:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e4e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .04);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 布局 ---------- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
.tabs button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 500;
}
.tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }
h2.section-title { font-size: 15px; margin: 0 0 12px; font-weight: 600; }

/* ---------- 卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat.danger .value { color: var(--danger); }
.stat.warning .value { color: var(--warning); }
.stat.success .value { color: var(--success); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-body { padding: 16px 18px; }
.panel-body.flush { padding: 0; }

/* ---------- 表格 ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: #fafbfc; position: sticky; top: 0; }
tbody tr:hover { background: #fafbff; }
td .sub { color: var(--muted); font-size: 12px; }
.domain-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ns-list { white-space: normal; color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.badge.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.muted { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .25); border-color: var(--primary); }
textarea { min-height: 78px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text); }
.switch { position: relative; width: 58px; height: 26px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch span::after { content: "关"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; line-height: 1; color: #64748b; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(32px); }
.switch input:checked + span::after { content: "开"; right: auto; left: 9px; color: #fff; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* 表格内的操作列不换行：防止表格自动布局把该列压成竖排（宁可横向滚动） */
td .actions { flex-wrap: nowrap; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.close-x { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---------- 提示条 ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--primary);
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: 13.5px;
  animation: slide .18s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

/* ---------- 登录 ---------- */
.login-mask { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 200; }
.login-box { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-box h1 { font-size: 19px; margin: 0 0 4px; }
.login-box p { color: var(--muted); margin: 0 0 18px; font-size: 13px; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- 日志分页栏 ---------- */
.pager {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
}
.pager button {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 4px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager input {
  width: 60px; text-align: center; padding: 4px 6px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; color: var(--text); background: var(--panel);
}
.pager select {
  width: auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: var(--text); background: var(--panel); cursor: pointer;
}
.pager-info { white-space: nowrap; }
.pager-spacer { flex: 1; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: #fff; }
.card h4 { margin: 0 0 6px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.card .meta { color: var(--muted); font-size: 12.5px; }
.footer-note { color: var(--muted); font-size: 12.5px; text-align: center; padding: 10px 0 30px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: #f8fafc; }
.bulk-bar .check { margin-right: 4px; font-size: 13px; }
.card input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; }
.test-hint { font-size: 12.5px; color: var(--muted); align-self: center; overflow-wrap: anywhere; }
.test-hint.good { color: #16a34a; }
.test-hint.bad { color: #dc2626; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- 运行实况（本地续期 / 线上巡检共用） ---------- */
.run-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.run-head .metrics { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.run-head .metrics b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.run-actions { margin-left: auto; display: flex; gap: 8px; }
.run-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 14px 0 10px; }
.run-step { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.run-step .dot { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; flex: none; }
.run-step.done .dot { background: var(--success); }
.run-step.active .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }
.run-step.done { color: #047857; }
.run-step.active { color: var(--text); font-weight: 600; }
.run-step .line { width: 16px; height: 1px; background: var(--border); margin: 0 6px; }
.run-current { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; color: var(--text); overflow-wrap: anywhere; }
.run-current .k { color: var(--muted); }
.run-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.run-tools select, .run-tools input[type="text"] { width: auto; padding: 5px 9px; font-size: 12.5px; }
.run-tools input[type="text"] { min-width: 150px; }
.run-tools .count { color: var(--muted); font-size: 12px; margin-left: auto; }
.run-log { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 10px 12px; max-height: 420px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.65; }
.run-line { display: flex; gap: 8px; white-space: pre-wrap; word-break: break-all; }
.run-line .t { color: #94a3b8; flex: none; font-variant-numeric: tabular-nums; }
.run-line .p { flex: none; color: #93c5fd; min-width: 52px; }
.run-line .m { color: #e2e8f0; }
.run-line.ok .m { color: #86efac; }
.run-line.err .m { color: #fca5a5; }
.run-line.warn .m { color: #fcd34d; }
.run-log .empty-line { color: #64748b; }

