:root {
  --bg: #f2f6f7;
  --surface: #fff;
  --surface-2: #f7fafb;
  --line: #e2e9ec;
  --line-strong: #d0dae0;
  --text: #12242e;
  --text-2: #52646f;
  --text-3: #8a9aa4;
  --navy: #0f2c38;
  --navy-2: #123644;
  --cyan: #17b8c8;
  --cyan-d: #0f9dad;
  --cyan-l: #e3f7f9;
  --green: #12805c;
  --red: #d14343;
  --amber: #b5730a;
  --r: 12px;
  --r-s: 8px;
  --sh: 0 1px 2px rgba(12, 40, 50, .06), 0 6px 20px rgba(12, 40, 50, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ============ 登录 ============ */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 28px;
  background: radial-gradient(1100px 600px at 15% 0%, #143d4c 0%, #0b2531 45%, #071a23 100%);
}
.auth-card {
  width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr;
  border-radius: 16px; overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.auth-left {
  background: linear-gradient(160deg, #10404f, #0c2b37 60%, #0a232e);
  color: #eaf6f8; padding: 44px 40px; display: flex; flex-direction: column; min-height: 560px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, #21c8d8, #128e9e); color: #fff;
  box-shadow: 0 4px 14px rgba(23, 184, 200, .35);
}
.logo-mark.sm { width: 34px; height: 34px; border-radius: 9px; }
.auth-brand-name { font-size: 15px; font-weight: 600; color: #fff; }
.auth-brand-sub { font-size: 12px; color: #9dc3cc; }
.auth-tag {
  align-self: flex-start; margin-top: 54px; font-size: 12px; color: #5fd6e2;
  background: rgba(23, 184, 200, .12); border: 1px solid rgba(23, 184, 200, .3);
  padding: 3px 11px; border-radius: 20px;
}
.auth-slogan { font-size: 26px; line-height: 1.4; margin: 14px 0 26px; color: #fff; font-weight: 600; max-width: 22em; }
.auth-feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-feats li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: #cfe6ea; }
.auth-feats .fi {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: #7fdbe6; font-size: 12px;
}
.auth-foot { margin-top: auto; font-size: 12px; color: #7d9ea8; }

.auth-right { background: #fff; padding: 52px 48px; display: flex; flex-direction: column; }
.auth-welcome { font-size: 12.5px; color: var(--cyan-d); font-weight: 600; letter-spacing: .3px; }
.auth-title { font-size: 26px; margin: 6px 0 6px; }
.auth-sub { font-size: 13px; color: var(--text-3); margin-bottom: 26px; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld > span { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.fld > span .mut { font-weight: 400; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-s);
  padding: 9px 11px; background: #fff; outline: none; transition: .15s; font-size: 13.5px;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(23, 184, 200, .16); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
textarea { resize: vertical; line-height: 1.55; }
select { cursor: pointer; }
.in-ico { position: relative; }
.in-ico > input { padding-left: 32px; }
.in-ico::before {
  content: attr(data-ico); position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--text-3);
}
.auth-err, .err {
  font-size: 12.5px; color: var(--red); background: #fdecec; border: 1px solid #f6cbc9;
  border-radius: var(--r-s); padding: 8px 11px; margin-bottom: 12px;
}
.auth-hint { margin-top: 18px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.auth-seed { margin-top: 10px; font-size: 11.5px; color: #b3c2c9; text-align: center; font-family: var(--mono); }

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--line-strong); background: #fff; padding: 8px 15px;
  border-radius: var(--r-s); cursor: pointer; transition: .15s; font-size: 13.5px; white-space: nowrap;
}
.btn:hover { border-color: #b9c8d0; background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--cyan-d); border-color: var(--cyan-d); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-danger { color: var(--red); border-color: #eec7c5; }
.btn-danger:hover { background: #fdecec; border-color: var(--red); }

/* ============ 应用外壳 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }
.side {
  width: 224px; flex: none; background: linear-gradient(180deg, #0f2c38, #0b222c);
  color: #cfe3e8; display: flex; flex-direction: column; padding: 18px 12px;
}
.side-brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-name { font-size: 14px; color: #fff; font-weight: 600; }
.side-sub { font-size: 11px; color: #86a9b2; }
.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; flex: 1; }
.nav-it {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  padding: 9px 12px; border-radius: var(--r-s); cursor: pointer; text-align: left;
  color: #a9c6ce; font-size: 13.5px; transition: .14s;
}
.nav-it:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-it.on { background: rgba(23, 184, 200, .16); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.nav-it .ni { width: 16px; text-align: center; opacity: .85; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, #21c8d8, #128e9e); color: #fff; font-size: 13px; font-weight: 600;
}
.su-txt { flex: 1; min-width: 0; }
.su-txt div:first-child { font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-txt div:last-child { font-size: 11px; color: #86a9b2; }
.side-out { border: 0; background: transparent; color: #86a9b2; cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.side-out:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.view { display: none; }
.view.on { display: block; }
.vhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.vhead h1 { font-size: 21px; }
.vhead p { font-size: 13px; color: var(--text-3); margin-top: 4px; max-width: 60em; }
.vhead-r { display: flex; align-items: center; gap: 10px; flex: none; }

/* ============ 通用组件 ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px 8px; margin-bottom: 14px; }
.c-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.c-head h3 { font-size: 14px; }
.c-head-r { display: flex; align-items: center; gap: 8px; }
.tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 20px; background: var(--cyan-l);
  color: var(--cyan-d); border: 1px solid #c4eaf0; white-space: nowrap; font-weight: 500;
}
.tag.gray { background: var(--surface-2); color: var(--text-3); border-color: var(--line); }
.tag.warn { background: #fdf4e3; color: var(--amber); border-color: #f3dfb8; }
.tag.bad { background: #fdecec; color: var(--red); border-color: #f6cbc9; }
.mut { font-size: 12.5px; color: var(--text-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 9px; margin: 8px 0 12px; flex-wrap: wrap; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; padding: 5px 12px; border-radius: 20px; font-size: 12.5px; cursor: pointer; }
.chip input { margin: 0; accent-color: var(--cyan); }
.note { background: var(--cyan-l); border: 1px solid #c4eaf0; border-radius: var(--r-s); padding: 11px 13px; margin: 10px 0 14px; }
.note b { font-size: 12.5px; color: #0d7f8d; display: block; margin-bottom: 4px; }
.note p { font-size: 12.5px; color: #2b6d78; }
.note.warn { background: #fdf4e3; border-color: #f3dfb8; }
.note.warn b { color: var(--amber); }
.note.warn p { color: #8a6220; }
.list { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; padding: 4px 0 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh); }
.stat .n { font-size: 24px; font-weight: 600; }
.stat .l { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.tbl-wrap { max-height: 460px; overflow: auto; margin: 8px 0 12px; border: 1px solid var(--line); border-radius: var(--r-s); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--cyan-d); }
.tbl .ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-btn { border: 1px solid var(--line-strong); background: #fff; border-radius: 5px; padding: 3px 10px; font-size: 11.5px; cursor: pointer; }
.mini-btn:hover { border-color: var(--cyan); color: var(--cyan-d); }
.mini-btn.on { background: var(--cyan-l); border-color: var(--cyan); color: var(--cyan-d); }

/* ============ 工作台 ============ */
.pickbar {
  display: flex; align-items: flex-end; gap: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--sh); flex-wrap: wrap;
}
.fld-inline { display: flex; flex-direction: column; gap: 6px; }
.fld-inline > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.fld-inline.grow { flex: 1; min-width: 260px; }
.pills { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 3px; gap: 2px; flex-wrap: wrap; }
.pills button { border: 0; background: transparent; padding: 6px 13px; border-radius: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.pills button.on { background: var(--navy); color: #fff; font-weight: 500; }
.search-wrap { position: relative; }
.search-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-s);
  box-shadow: 0 12px 32px rgba(12, 40, 50, .14); max-height: 320px; overflow-y: auto;
}
.sd-it { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sd-it:last-child { border-bottom: 0; }
.sd-it:hover { background: var(--cyan-l); }
.sd-it .a { font-family: var(--mono); font-size: 11.5px; color: var(--cyan-d); font-weight: 600; }
.sd-it .b { font-size: 12.5px; }
.sd-it .c { font-size: 11px; color: var(--text-3); }
.sd-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 12.5px; }

.work-grid { display: grid; grid-template-columns: minmax(400px, 1fr) minmax(420px, 1.05fr); gap: 14px; align-items: start; }
.col { min-width: 0; }
.conn-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; }
.conn-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.conn-dot.ok i { background: #23b37e; box-shadow: 0 0 0 3px rgba(35, 179, 126, .18); }
.conn-dot.no i { background: var(--red); }
.conn-dot.warn i { background: var(--amber); }

.result-card { padding-bottom: 14px; }
.cmp-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cmp { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.cmp.ok { color: var(--green); border-color: #bfe6d6; background: #e9f7f1; }
.cmp.warn { color: var(--amber); border-color: #f3dfb8; background: #fdf4e3; }
.cmp.bad { color: var(--red); border-color: #f6cbc9; background: #fdecec; }
.result-body { display: flex; flex-direction: column; gap: 10px; }
.placeholder { text-align: center; color: var(--text-3); padding: 46px 20px 40px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ph-ico { font-size: 32px; color: #c8d6dc; line-height: 1; }
.placeholder b { color: var(--text-2); font-size: 14px; }
.placeholder p { font-size: 12.5px; max-width: 34em; }
.ph-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ph-list li { font-size: 11.5px; border: 1px dashed var(--line-strong); border-radius: 20px; padding: 3px 11px; color: var(--text-3); }
.ph-list.tight li { margin: 0; }
.mod { border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.mod-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.mod-h .t { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.mod-h .t::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--cyan); }
.mod-b { padding: 11px 13px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.mod-b.mono { font-family: var(--mono); font-size: 12px; color: #35505c; }
.mod-b ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.mod-f { display: flex; align-items: center; gap: 9px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 11.5px; color: var(--text-3); }
.mod-f .g { flex: 1; }
.typing::after { content: "▋"; color: var(--cyan); animation: bk 1s steps(2) infinite; }
@keyframes bk { 50% { opacity: 0; } }
.gen-banner { font-size: 12.5px; padding: 9px 12px; border-radius: var(--r-s); margin-bottom: 10px; }
.gen-banner.err { background: #fdecec; color: var(--red); border: 1px solid #f6cbc9; }
.gen-banner.off { background: #fdf4e3; color: var(--amber); border: 1px solid #f3dfb8; }
.gen-banner.ok { background: #e9f7f1; color: var(--green); border: 1px solid #bfe6d6; }

/* 历史记录 */
.his { border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px; background: #fff; }
.his-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.his-h .mono { font-family: var(--mono); font-size: 12px; color: var(--cyan-d); font-weight: 600; }
.his-h .dt { font-size: 11.5px; color: var(--text-3); margin-left: auto; }
.his-body { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; }
.his-cell .l { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.his-cell .v { font-size: 12.5px; }
.his-note { margin-top: 8px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; color: var(--text-2); }
.his-acts { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.import-log { font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.import-log div { padding: 5px 10px; border-radius: 6px; }
.import-log .ok { background: #e9f7f1; color: var(--green); }
.import-log .bad { background: #fdecec; color: var(--red); }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 20px; border-radius: 22px; font-size: 13px; z-index: 200; box-shadow: 0 8px 26px rgba(0, 0, 0, .25); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c6d3da; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aabcc5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1200px) {
  .work-grid, .grid2.cols-fix { grid-template-columns: 1fr; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-left { min-height: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .side { width: 190px; }
}

/* ============================================================
   MCP 数据源（卖家精灵 / SIF）
   ============================================================ */
.sec-h { font-size: 15px; margin: 22px 0 3px; }
.sec-h-sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; max-width: 72em; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.grid2.tight { gap: 0 10px; }
.grid2.tight .fld > span { font-size: 12.5px; }

.raw-box {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 10px 12px; margin: 8px 0 12px; font-family: var(--mono); font-size: 11.5px;
  line-height: 1.6; color: var(--text-2); max-height: 260px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.ai-box {
  background: var(--cyan-l); border: 1px solid #c4eaf0; border-radius: var(--r-s);
  padding: 10px 13px; margin: 8px 0 12px; font-size: 12.5px; color: #2b6d78;
}
.ai-box b { color: #0d7f8d; }
.ai-box .extra { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ai-box .extra span {
  background: #fff; border: 1px solid #c4eaf0; border-radius: 14px; padding: 2px 9px;
  font-size: 11.5px; font-family: var(--mono);
}
.mcp-out { font-size: 12.5px; line-height: 1.7; }
.mcp-out.ok { color: var(--green); }
.mcp-out.bad { color: var(--red); }
.tool-list { display: flex; flex-direction: column; gap: 5px; }
.tool-list .tl {
  display: flex; gap: 9px; align-items: baseline; padding: 5px 8px;
  border-bottom: 1px solid var(--line); font-size: 11.5px;
}
.tool-list .tl:last-child { border-bottom: 0; }
.tool-list .tl code { flex: none; background: #fff; }
.tool-list .tl span { color: var(--text-3); }
.src-tag {
  display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); margin-left: 5px;
}
.chip.only { border-style: dashed; }

@media (max-width: 1200px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
}
