:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2230;
  --muted: #7b8494;
  --line: #e6e9ef;
  --brand: #1f6feb;
  --red: #d92b2b;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }
.link { color: var(--brand); }
.link:hover { text-decoration: underline; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #141a24;
  color: #e8edf6;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06), 0 4px 14px rgba(9, 13, 20, .18);
}
.topbar-inner { display: flex; align-items: center; gap: 26px; height: 58px; background: transparent; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; white-space: nowrap; }
.brand span { font-weight: 400; font-size: 11px; color: #8b96ab; margin-left: 8px; letter-spacing: 0; }
.topbar nav { display: flex; gap: 4px; min-width: 0; }
.topbar nav a { color: #c3ccdd; padding: 7px 13px; border-radius: 8px; font-size: 13px; }
.topbar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.topbar nav a.active { background: rgba(255, 255, 255, .12); color: #fff; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar .btn { flex: 0 0 auto; }
.topbar .btn.ghost { border-color: rgba(255, 255, 255, .22); color: #dbe3f0; background: transparent; }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.pill { font-size: 12px; padding: 4px 11px; border-radius: 12px; background: rgba(255,255,255,.1); color: #c3ccdd; }
.pill.busy { background: var(--brand); color: #fff; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 15px 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
  border-left: 3px solid transparent;
}
.stat span { font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 26px; line-height: 1.25; }
.stat i { font-style: normal; font-size: 12px; color: var(--muted); }
.stat.hot { border-left-color: var(--red); }
.stat.hot b { color: var(--red); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.card-head h2 { font-size: 15px; margin: 0; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; min-width: 540px; }
.table.findings { min-width: 1000px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 8px; border-bottom: 1px solid #f2f4f8; vertical-align: top; }
.table tbody tr:hover { background: #fafbfd; }
.table.compact td { padding: 8px; }
.table tr.done { opacity: .55; }
.table .w-90 { width: 78px; }
.table .w-110 { width: 104px; }
.table .w-150 { width: 132px; }
.table .w-220 { width: 210px; }
.t-right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.snippet { font-size: 12px; color: #3b4453; word-break: break-word; line-height: 1.7; }
.empty { text-align: center; color: var(--muted); padding: 26px 8px; }
.hit-name { font-weight: 600; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.tag.ok { background: #e7f6ec; color: #167c3a; }
.tag.warn { background: #fff5e6; color: #a36200; }
.tag.bad { background: #fdecec; color: #c22; }
.tag.off { background: #eef0f3; color: #6b7280; }

.sev { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff; white-space: nowrap; }
.sev.H { background: var(--red); }
.sev.M { background: #f0a020; }
.sev.L { background: #7a8b99; }

.hit { background: var(--red); color: #fff; padding: 1px 3px; border-radius: 3px; font-weight: 600; }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-block;
  background: #eef1f6; color: var(--ink); border: none;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  cursor: pointer; font-family: inherit; line-height: 1.4;
}
.btn:hover { background: #e3e8f1; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a5fd0; }
.btn.danger { background: #fdecec; color: #c22; }
.btn.danger:hover { background: #fbd9d9; }
.btn.ghost { background: transparent; border: 1px solid #d9dee8; }
.btn.ghost:hover { background: #f2f5fa; }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.xs { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

input, select {
  padding: 8px 10px; border: 1px solid #d9dee8; border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus { outline: 2px solid rgba(31, 111, 235, .25); border-color: var(--brand); }

.add-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-bottom: 14px; }
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row select, .filter-row input { width: auto; min-width: 130px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: block; font-size: 13px; color: #48546a; }
.form-grid label input, .form-grid label select { margin-top: 5px; }
.form-grid .span2 { grid-column: span 2; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.check input, .switch input { width: auto; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 12px; }
.switch.inline { margin-bottom: 0; align-self: end; padding-bottom: 8px; }

.save-bar { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(244,246,249,0), var(--bg) 40%); padding: 14px 0 22px; }

/* ---------- 其它 ---------- */
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.text-bad { color: var(--red); font-size: 12px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 0; }
.page-head h1 { font-size: 20px; margin: 4px 0; }
.back { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 8px; }

.flash { margin-top: 14px; }
.flash-item {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 8px;
  background: #eef4ff; border: 1px solid #d6e3ff;
}
.flash-item.warn { background: #fff8e6; border-color: #ffe0a3; }
.flash-item.error { background: #fdecec; border-color: #f7c9c9; }
.flash-item.ok { background: #e9f7ef; border-color: #c6e9d3; }

.login-card {
  max-width: 380px; margin: 12vh auto; background: var(--card);
  padding: 30px 28px 26px; border-radius: 14px; box-shadow: 0 8px 30px rgba(16, 24, 40, .08);
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card form { margin-top: 18px; }
.login-card label { font-size: 13px; color: var(--muted); }
.login-card input { margin: 6px 0 14px; }
.login-card .btn { width: 100%; }

.report-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 2; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1c2230; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; z-index: 99; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------- 队列面板 ---------- */
.queue-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.queue-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fbfcfe; }
.queue-item.on { border-color: #bcd3ff; background: #f2f7ff; }
.q-name { font-size: 12px; color: var(--muted); }
.q-num { font-size: 22px; font-weight: 700; line-height: 1.3; }
.q-sub { font-size: 11px; color: var(--muted); }

.task-list { border-top: 1px dashed var(--line); padding-top: 8px; }
.task-row {
  display: grid; grid-template-columns: 180px 74px 1fr 140px 64px;
  gap: 10px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid #f5f7fa; font-size: 13px;
}
.task-row:last-child { border-bottom: none; }
.task-domain { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { font-size: 12px; color: var(--muted); text-align: right; }
.bar { height: 6px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .4s; }
.bar.done > i { background: #22a06b; }
.bar.fail > i { background: var(--red); }
.state {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px;
  background: #eef2f8; color: #4a5568; white-space: nowrap;
}
.state.run { background: #e8f0ff; color: #1a56c4; }
.state.ok { background: #e7f6ec; color: #167c3a; }
.state.err { background: #fdecec; color: #c22; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .add-row { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; height: 52px; padding: 0 12px; }
  .brand { font-size: 15px; flex: 0 0 auto; }
  .brand span { display: none; }
  .topbar nav { flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 6px 9px; font-size: 13px; white-space: nowrap; }
  .topbar .right { gap: 6px; }
  .topbar .right .tag { display: none; }
  .topbar .right .who { font-size: 12px; }
  .wrap { padding: 0 12px; }
  .card { overflow-x: auto; }
  .queue-grid { grid-template-columns: repeat(2, 1fr); }
  .task-row { grid-template-columns: 1fr; gap: 4px; }
  .task-meta { text-align: left; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .wl-search { float: none; width: 100%; margin-top: 8px; }
  .table { min-width: 620px; }
  .table.findings { min-width: 1000px; }
}

@media (max-width: 520px) {
  .topbar-inner { gap: 6px; }
  .topbar .right .who { display: none; }
  .topbar nav a { padding: 6px 8px; font-size: 12.5px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 22px; }
  .card { padding: 14px; }
}
/* ---- 探针（被控端） ---- */
.probe-tag { display: inline-block; font-size: 11px; padding: 1px 7px; margin-right: 6px; border-radius: 8px; background: #eef3ff; color: #2456b8; }
.probe-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fbfcfe; margin-bottom: 12px; }
.probe-card.on { border-color: #bcd3ff; background: #f2f7ff; }
.probe-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.probe-name { font-weight: 600; font-size: 14px; }
.probe-meta { color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c4cbd8; display: inline-block; }
.dot.on { background: #21a05a; box-shadow: 0 0 0 3px rgba(33,160,90,.15); }
.key-box { font-family: Consolas, monospace; font-size: 12px; background: #0f1729; color: #d7e3ff; padding: 9px 12px; border-radius: 8px; word-break: break-all; margin: 8px 0; }
.steps { font-size: 13px; line-height: 1.9; color: #3b4557; }
.steps code { background: #eef2f8; padding: 1px 6px; border-radius: 4px; font-family: Consolas, monospace; font-size: 12px; }

/* ---------- 域名注册信息（WHOIS） ---------- */
.whois-table th {
  width: 132px; text-align: left; font-weight: 600; color: var(--muted);
  padding: 8px; vertical-align: top; border-bottom: 1px solid #f2f4f8;
}
.whois-table td { padding: 8px; border-bottom: 1px solid #f2f4f8; word-break: break-word; }
.whois-table tr:last-child th, .whois-table tr:last-child td { border-bottom: none; }
.whois-table th + td .tag { margin-left: 6px; }

/* ---------- 租户版新增 ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pick-item {
  display: block; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; background: #fbfcfe; transition: border-color .15s, background .15s;
}
.pick-item:hover { border-color: #bcd3ff; background: #f2f7ff; }
.pick-name { font-weight: 600; margin-bottom: 2px; }
.inline-form { display: inline-block; margin: 0 8px 0 0; }
.inline-form select { padding: 5px 8px; border: 1px solid #d7dbe3; border-radius: 6px; font-size: 13px; background: #fff; }
.card-head h3 { font-size: 14px; margin: 0; font-weight: 600; }
.wl-search { float: right; width: 220px; padding: 5px 10px; border: 1px solid #d7dbe3; border-radius: 6px; font-size: 13px; font-weight: normal; }
.wl-value { word-break: break-all; }
.table.compact td select { padding: 4px 6px; border: 1px solid #d7dbe3; border-radius: 5px; }
.tenant-badge { font-size: 11px; color: #6b7280; background: #f1f3f7; padding: 1px 6px; border-radius: 10px; }
.keywords-table td { vertical-align: top; }
