:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }

a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { font-weight: 600; margin: 0; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: #111827; color: #e5e7eb;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 20px 18px; font-size: 16px; font-weight: 700; letter-spacing: .3px;
  border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 8px;
}
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d39988; }
.nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: #cbd5e1; cursor: pointer; margin-bottom: 2px; font-size: 13.5px; transition: .12s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #9ca3af; }
.sidebar-foot .u { color: #e5e7eb; font-weight: 600; }
.sidebar-foot a { display: inline-block; margin-top: 8px; color: #fca5a5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--border); padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; }
.topbar .right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ---------- 卡片 ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat.green .value { color: var(--green); }
.stat.blue .value { color: var(--brand); }
.stat.red .value { color: var(--red); }
.stat.amber .value { color: var(--amber); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title h2 { font-size: 15px; }
.section-title .hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; outline: none;
  transition: border .12s, box-shadow .12s; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field .help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.field textarea.mono, textarea.mono { font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; font-size: 13.5px; font-weight: 500; transition: .12s; background: #fff;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger.solid:hover { background: #b91c1c; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #f9fafb; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 9px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f3f7; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl .addr { font-family: var(--mono); font-size: 12.5px; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.badge.green { background: #ecfdf5; color: #047857; }
.badge.red { background: #fef2f2; color: #b91c1c; }
.badge.gray { background: #f3f4f6; color: #6b7280; }
.badge.blue { background: #eff6ff; color: #1d4ed8; }
.badge.amber { background: #fffbeb; color: #b45309; }

.checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: none; align-items: flex-start;
  justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; }
.modal-mask.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 15px; }
.modal-head .x { border: none; background: none; font-size: 20px; color: var(--muted); padding: 4px 8px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 工具栏 / 分页 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; }
.toolbar .spacer { flex: 1; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 14px; justify-content: flex-end; color: var(--muted); font-size: 13px; }
.pager button { padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* ---------- 提示 ---------- */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert.info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert.error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert.success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.alert pre { margin: 8px 0 0; white-space: pre-wrap; word-break: break-all; font-size: 12px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.right-align { text-align: right; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* 进度条 */
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width .2s; }

/* 日志 */
.logbox { background: #0b1220; color: #d1e3ff; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  border-radius: 8px; padding: 14px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* 域名分布条形图 */
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-row .dom { width: 150px; font-family: var(--mono, monospace); color: var(--muted); }
.bar-row .track { flex: 1; height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, var(--brand), #60a5fa); }
.bar-row .num { width: 40px; text-align: right; color: var(--muted); }

.tag { display: inline-block; background: #eef2ff; color: #4338ca; border-radius: 6px; padding: 1px 7px; margin-right: 4px; font-size: 11.5px; }