:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e3e8ee;
  --text: #1a2233;
  --muted: #6b7688;
  --green: #008060;
  --green-dark: #004c3f;
  --blue: #2563eb;
  --red: #d92d20;
  --amber: #b25e09;
  --sidebar: #10233b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 35, 59, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
.loading { color: var(--muted); padding: 30px; text-align: center; }

/* ── 布局 ─────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; background: var(--sidebar); color: #cfd8e3;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { font-size: 26px; }
.brand-name { font-weight: 700; color: #fff; font-size: 15px; }
.brand-sub { font-size: 11px; color: #8fa3ba; }
nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #cfd8e3;
  text-decoration: none; font-size: 14px; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--green); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-gray { background: #8fa3ba; }
.dot-green { background: #2ecc71; }
.dot-red { background: #ff6b6b; }

.main { flex: 1; padding: 26px 30px 60px; max-width: 1280px; }
h1 { font-size: 22px; margin-bottom: 18px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.view-head h1 { margin-bottom: 0; }

/* ── 通用控件 ─────────────────────── */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: #c4ccd8; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--green-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input, select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--green); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { width: 320px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }

/* ── 表格 ─────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover { background: #f6f9f7; }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: #eef1f5; display: block; }
.thumb-none { width: 38px; height: 38px; border-radius: 6px; background: #eef1f5; display: flex; align-items: center; justify-content: center; color: #aab; font-size: 15px; }

/* ── 标签 ─────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.b-green { background: #e3f5ee; color: #046c4e; }
.b-gray { background: #eef1f5; color: #55627a; }
.b-blue { background: #e4efff; color: #1c4fb8; }
.b-red { background: #fdebe9; color: #b42318; }
.b-amber { background: #fdf1e0; color: #b25e09; }

/* ── 仪表盘 ───────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } .dash-cols { grid-template-columns: 1fr; } }
.card h3 { font-size: 14.5px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.lowitem { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; border-bottom: 1px solid #eef1f5; font-size: 13px; }
.lowitem:last-child { border-bottom: none; }

/* ── 抽屉 ─────────────────────────── */
.drawer-mask { position: fixed; inset: 0; background: rgba(10, 20, 35, .4); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: -560px; width: 540px; max-width: 94vw; height: 100vh; background: #fff;
  z-index: 50; box-shadow: -8px 0 30px rgba(0,0,0,.15); transition: right .22s ease; display: flex; flex-direction: column;
}
.drawer.open { right: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.icon-btn { border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; }
.icon-btn:hover { background: #eef1f5; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; font-size: 13px; margin-bottom: 18px; }
.kv dt { color: var(--muted); }
.kv dd { word-break: break-all; }
.sec-title { font-weight: 700; font-size: 13.5px; margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 变体编辑行 */
.variant-row { display: flex; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid #eef1f5; flex-wrap: wrap; font-size: 13px; }
.variant-row .vname { flex: 1; min-width: 120px; }
.variant-row input { width: 84px; padding: 5px 8px; }
.price-cell input { width: 90px; padding: 5px 8px; font-size: 13px; }

/* ── Toast ────────────────────────── */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: #10233b; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13.5px;
  z-index: 100; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 80vw;
}
.toast.err { background: #7a1c14; }

/* ── 设置 / MCP 页 ─────────────────── */
.guide ol { margin: 10px 0 0 18px; line-height: 1.9; }
.guide code { background: #eef1f5; border-radius: 5px; padding: 2px 6px; font-size: 12.5px; }
.scopes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-row input { width: 100%; }
.form-row .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
pre.config-block {
  background: #10233b; color: #d5e3f0; padding: 14px 16px; border-radius: 10px;
  font-size: 12.5px; overflow-x: auto; line-height: 1.55; position: relative;
}
.copy-btn { position: absolute; top: 8px; right: 8px; }
.mcp-section { margin-bottom: 22px; }
.mcp-section h3 { margin-bottom: 8px; font-size: 15px; }
.mcp-section p { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
.tool-list { display: flex; flex-wrap: wrap; gap: 8px; }
.notice { background: #fdf6e7; border: 1px solid #f2dcab; color: #7a5410; padding: 12px 16px; border-radius: 10px; font-size: 13px; line-height: 1.7; margin-bottom: 16px; }

/* ── 前台 AI 测试页 ───────────────── */
.sf-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .sf-grid { grid-template-columns: 1fr; } }
.sf-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sf-result-count { grid-column: 1/-1; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.sf-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer;
  background: #fff; transition: .15s; display: flex; flex-direction: column;
}
.sf-card:hover { border-color: var(--green); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,128,96,.12); }
.sf-card img { width: 100%; height: 130px; object-fit: cover; background: #eef1f5; }
.sf-noimg { width: 100%; height: 130px; display: flex; align-items: center; justify-content: center; background: #eef1f5; font-size: 26px; color: #aab; }
.sf-title { padding: 8px 10px 2px; font-size: 12.5px; font-weight: 600; line-height: 1.35; min-height: 36px; }
.sf-price { padding: 0 10px 4px; color: var(--green-dark); font-weight: 700; font-size: 13.5px; }
.sf-id { padding: 2px 10px 8px; color: var(--muted); font-size: 11px; }
.sf-faq { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: #fafbfc; }
.sf-faq-q { font-weight: 600; color: var(--blue); margin-bottom: 6px; font-size: 13.5px; }
.sf-faq-a { color: var(--text); font-size: 13px; line-height: 1.7; }
