/* ============================================================
   工具中心 · 全局样式
   精致极简：白底、深色文字、色块区分模块、无渐变无阴影
   ============================================================ */

:root {
  /* 基础色 */
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --text: #1a1a1a;
  --text-muted: #8a8a8a;
  --text-faint: #b5b5b5;
  --border: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.22);

  /* 模块色：tint = 浅色块背景，accent = 图标/重点色 */
  --ecommerce-tint: #faece7;
  --ecommerce-accent: #c0492b;
  --content-tint: #e1f5ee;
  --content-accent: #1f9a75;
  --data-tint: #e6f1fb;
  --data-accent: #2d6cb5;
  --ai-tint: #eeedfe;
  --ai-accent: #6b5cc4;

  /* 状态色 */
  --ok: #1f9a75;
  --ok-tint: #e1f5ee;
  --danger: #c0492b;
  --danger-tint: #faece7;
  --admin: #c0492b;

  /* 圆角 */
  --r-card: 12px;
  --r-control: 8px;

  /* 间距节奏（4 的倍数） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;

  --topbar-h: 56px;
  --sidebar-w: 200px;
  --maxw: 1200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-4);
  border: 0.5px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.btn-primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn-primary:hover { background: #000; border-color: #000; }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: 12px; }

.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.input, .select {
  height: 38px;
  padding: 0 var(--sp-3);
  border: 0.5px solid var(--border);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  transition: border-color .15s;
}
.input:focus, .select:focus { outline: none; border-color: var(--text); }
.input-wrap { position: relative; }
.input-wrap .toggle-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--text-muted); padding: 4px;
  font-size: 16px; line-height: 1;
}

/* 圆点标签 */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-muted { background: var(--text-faint); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
}
.badge-model { background: var(--ok-tint); color: var(--ok); }
.badge-none { background: var(--bg-soft); color: var(--text-faint); }
.badge-admin { background: var(--danger-tint); color: var(--admin); }
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-fail { background: var(--danger-tint); color: var(--danger); }

/* ---------- 顶部栏 ---------- */
.topbar {
  height: var(--topbar-h);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  gap: var(--sp-4);
  position: sticky; top: 0; background: var(--bg); z-index: 20;
}
.brand { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: 15px; }
.brand i { font-size: 20px; }
.topbar-spacer { flex: 1; }

.search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-3);
  border: 0.5px solid var(--border); border-radius: var(--r-control);
  background: var(--bg-soft);
}
.search i { color: var(--text-muted); font-size: 17px; }
.search input { border: none; background: none; outline: none; width: 100%; font-size: 14px; color: var(--text); }

.user-menu { display: flex; align-items: center; gap: var(--sp-3); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--text); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 500; }
.icon-btn {
  border: 0.5px solid var(--border); background: var(--bg);
  width: 32px; height: 32px; border-radius: var(--r-control);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; transition: background .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* ---------- 工具导航首页 ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: var(--sp-6) var(--sp-5) var(--sp-7); }

.module { margin-bottom: var(--sp-6); }
.module-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.module-ico {
  width: 28px; height: 28px; border-radius: var(--r-control);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.module-title { font-size: 15px; font-weight: 600; }
.module-count { font-size: 12px; color: var(--text-faint); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

.card {
  border: 0.5px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  background: var(--bg);
  display: flex; flex-direction: column; gap: var(--sp-3);
  transition: border-color .15s, transform .15s;
}
a.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-ico { width: 34px; height: 34px; border-radius: var(--r-control); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.card-name { font-size: 14px; font-weight: 500; }
.card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; min-height: 36px; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }

.empty { padding: var(--sp-7); text-align: center; color: var(--text-faint); font-size: 13px; }

.footer {
  max-width: var(--maxw); margin: 0 auto; padding: var(--sp-5);
  border-top: 0.5px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4);
  font-size: 12px; color: var(--text-muted);
}
.footer .sep { color: var(--text-faint); }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-5); }
.auth-card { width: 360px; border: 0.5px solid var(--border); border-radius: var(--r-card); padding: var(--sp-6); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-6); }
.auth-logo i { font-size: 30px; }
.auth-logo span { font-size: 16px; font-weight: 600; }
.auth-foot { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: var(--sp-4); }
.auth-err { color: var(--danger); font-size: 12px; min-height: 16px; margin-bottom: var(--sp-3); }
.auth-hint { background: var(--bg-soft); border: 0.5px solid var(--border); border-radius: var(--r-control); padding: var(--sp-3); font-size: 11px; color: var(--text-muted); line-height: 1.6; margin-bottom: var(--sp-4); }
.auth-hint code { background: #fff; padding: 1px 5px; border-radius: 4px; border: 0.5px solid var(--border); }

/* ---------- 管理后台布局 ---------- */
.admin-body { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar { width: var(--sidebar-w); border-right: 0.5px solid var(--border); padding: var(--sp-4) var(--sp-3); flex-shrink: 0; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  height: 38px; padding: 0 var(--sp-3); border-radius: var(--r-control);
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item i { font-size: 18px; }
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--bg-soft); color: var(--text); }

.admin-main { flex: 1; padding: var(--sp-6); min-width: 0; }
.admin-main h1 { font-size: 18px; font-weight: 600; margin: 0 0 var(--sp-2); }
.admin-main .sub { color: var(--text-muted); font-size: 13px; margin: 0 0 var(--sp-5); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-6); }
.stat { border: 0.5px solid var(--border); border-radius: var(--r-card); padding: var(--sp-4); }
.stat .label { font-size: 12px; color: var(--text-muted); margin-bottom: var(--sp-2); }
.stat .value { font-size: 28px; font-weight: 600; line-height: 1; }
.stat .value small { font-size: 13px; color: var(--text-faint); font-weight: 400; }

.section-title { font-size: 14px; font-weight: 600; margin: 0 0 var(--sp-3); }
.quick-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.panel { border: 0.5px solid var(--border); border-radius: var(--r-card); overflow: hidden; margin-bottom: var(--sp-5); }
.panel-head { padding: var(--sp-4); border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-head .spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: var(--sp-3) var(--sp-4); border-bottom: 0.5px solid var(--border); white-space: nowrap; }
th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: none; background: var(--bg-soft); }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; }
.t-actions { display: flex; gap: var(--sp-2); }
.key-cell { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-muted); }

.filter-bar { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 150px; height: 34px; }

.summary { padding: var(--sp-4); display: flex; gap: var(--sp-5); font-size: 12px; color: var(--text-muted); border-top: 0.5px solid var(--border); }
.summary strong { color: var(--text); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.28);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: var(--sp-5);
}
.modal-mask.open { display: flex; }
.modal { width: 420px; max-width: 100%; background: var(--bg); border-radius: var(--r-card); border: 0.5px solid var(--border); overflow: hidden; }
.modal-head { padding: var(--sp-4); border-bottom: 0.5px solid var(--border); font-weight: 600; }
.modal-body { padding: var(--sp-4); max-height: 70vh; overflow: auto; }
.modal-foot { padding: var(--sp-4); border-top: 0.5px solid var(--border); display: flex; justify-content: flex-end; gap: var(--sp-3); }
.checks { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); font-weight: 400; }

.note {
  background: var(--bg-soft); border: 0.5px solid var(--border);
  border-radius: var(--r-control); padding: var(--sp-3); font-size: 12px;
  color: var(--text-muted); line-height: 1.6; margin-bottom: var(--sp-4);
}

/* 入场：页面载入轻微上浮 */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.module, .stat, .panel, .auth-card { animation: rise .3s ease both; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  .search { max-width: none; }
  .user-name { display: none; }
}
