/* ============================================================
   爬虫哨兵 — 设计系统
   克制编辑风：暖纸底 + 墨字 + 单一克制强调色（暗青）
   ============================================================ */
:root {
  --paper: #f6f3ec;
  --surface: #fffdf8;
  --ink: #1b1a17;
  --muted: #6b6862;
  --faint: #9a958c;
  --line: #e3ddd0;
  --line-strong: #d6cebc;
  --accent: #2f6f63;
  --accent-ink: #1f4d45;
  --accent-soft: #e7f0ed;
  --danger: #a8412f;
  --danger-soft: #f6e6e1;
  --success: #2f6f3f;
  --success-soft: #e4f0e6;
  --warning: #8a6212;
  --warning-soft: #f4ecd8;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.04), 0 8px 24px rgba(27, 26, 23, 0.05);
  --font-display: "Fraunces", Georgia, "Songti SC", serif;
  --font-body: "Hanken Grotesk", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --space: clamp(16px, 2.4vw, 28px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; }
.brand-mark { font-size: 22px; color: var(--accent); line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: .2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  color: var(--muted);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14.5px;
}
.nav-item:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
}
.who { color: var(--ink); font-weight: 600; }
.logout { color: var(--faint); }
.logout:hover { color: var(--danger); }

.content { padding: var(--space) calc(var(--space) + 8px); max-width: 1080px; }

/* ---------- 页面标题 ---------- */
.page-head { margin-bottom: 26px; }
.page-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 34px);
  margin: 0 0 4px;
  letter-spacing: -.3px;
}
.page-sub { color: var(--muted); margin: 0; font-size: 14.5px; }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-num { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: var(--ink); }
.hint { font-size: 12px; color: var(--faint); font-weight: 400; }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=time], input[type=date], select, textarea {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); text-decoration: none; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.badge-on { background: var(--success-soft); color: var(--success); }
.badge-off { background: var(--paper); color: var(--faint); border: 1px solid var(--line-strong); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-err { background: var(--danger-soft); color: var(--danger); }

/* ---------- 提示 ---------- */
.flash-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.flash-success { background: var(--success-soft); border-color: #cfe6d3; color: var(--accent-ink); }
.flash-danger { background: var(--danger-soft); border-color: #eccfc7; color: var(--danger); }
.flash-warning { background: var(--warning-soft); border-color: #e6d6ad; color: var(--warning); }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty-mark { font-size: 30px; color: var(--faint); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 30px;
}
.login-card .brand { justify-content: center; margin-bottom: 22px; }
.login-title { font-family: var(--font-display); font-size: 22px; text-align: center; margin: 0 0 22px; }

/* ---------- 邮件预览 ---------- */
.preview-box {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-top: 14px;
  min-height: 80px;
}
.kv { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 14px; padding: 14px 18px; overflow-x: auto;
  }
  .brand { margin: 0; }
  .nav { flex-direction: row; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 面板内标题行（标题 + 右侧链接） ---------- */
.panel-head-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.panel-head-row .panel-title { margin: 0; }
.panel-link { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.panel-link:hover { text-decoration: underline; }

/* ---------- 验证配置报告 ---------- */
.verify-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.verify-bad { background: var(--danger-soft); border: 1px solid #eccfc7; }
.verify-icon { font-size: 20px; color: var(--danger); line-height: 1.2; }
.verify-head { font-weight: 600; color: var(--danger); }
.verify-msg { font-size: 13px; color: var(--ink); margin-top: 2px; word-break: break-all; }
.verify-tip { font-size: 13.5px; color: var(--muted); }

.vstep { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.vstep:last-of-type { border-bottom: none; }
.vstep-dot { flex: none; width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.vstep.ok .vstep-dot { background: var(--success); }
.vstep.bad .vstep-dot { background: var(--danger); }
.vstep.warn .vstep-dot { background: var(--warning); }
.vstep-body { flex: 1; min-width: 0; }
.vstep-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vstep-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tag { font-size: 11.5px; font-weight: 500; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 1px 9px; }
.sample-links { list-style: none; padding: 8px 0 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sample-links a { font-size: 13px; word-break: break-all; }
.content-sample { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); white-space: pre-wrap; word-break: break-all; max-height: 160px; overflow: auto; }

/* ---------- 命中明细 ---------- */
.err-text { color: var(--danger); word-break: break-word; }
.hit-list { display: flex; flex-direction: column; gap: 8px; }
.hit-item { padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.hit-title { font-weight: 600; font-size: 13.5px; word-break: break-all; }
.hit-kw { font-size: 12px; color: var(--accent-ink); margin-top: 2px; }

/* ---------- 目标列表：可展开卡片 ---------- */
.target-list { display: flex; flex-direction: column; gap: 10px; }
.target-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.target-card[open] { border-color: var(--line-strong); box-shadow: var(--shadow); }
.target-card[data-auto-off] { border-color: var(--danger); border-left: 3px solid var(--danger); }
.target-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  flex-wrap: wrap;
}
.target-summary::-webkit-details-marker { display: none; }
.target-summary:hover { background: var(--accent-soft); }
.target-name { font-weight: 600; font-size: 15px; }
.target-meta { color: var(--muted); font-size: 12.5px; }
.target-arrow { margin-left: auto; color: var(--faint); transition: transform .18s ease; font-size: 13px; }
.target-card[open] .target-arrow { transform: rotate(180deg); }
.target-body { padding: 14px 16px; border-top: 1px dashed var(--line); }
.target-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 18px;
}
.target-detail-grid .ditem label {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.target-detail-grid .ditem div { font-size: 13px; word-break: break-all; }
.target-alert {
  background: var(--danger-soft);
  border: 1px solid #eccfc7;
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 10px;
}
.target-alert.warn { background: var(--warning-soft); border-color: #e6d6ad; color: var(--warning); }
@media (max-width: 820px) {
  .target-detail-grid { grid-template-columns: 1fr; }
}
