/* GradeCard 工业风样式 v1.4：三档断点（<768 / 768-1024 / >1024），无外部字体图标库 */
:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --ink: #1f2937;
  --ink-2: #6b7280;
  --line: #d9dee5;
  --accent: #1d6fb8;
  --accent-dark: #155a94;
  --green: #1a7f4b;
  --green-bg: #e6f4ec;
  --gray-bg: #f3f4f6;
  --warn-bg: #fff4e5;
  --warn-line: #f0b35c;
  --danger-bg: #fdecec;
  --danger-line: #e07a7a;
  --shadow: 0 1px 3px rgba(16, 30, 54, .08), 0 4px 14px rgba(16, 30, 54, .06);
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
.hidden { display: none !important; }

/* 顶部品牌导航（固定可见） */
.topbar {
  background: linear-gradient(120deg, #14202e, #1d3a5a); color: #fff;
  padding: 14px 24px 10px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(16, 30, 54, .18);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.logo { margin: 0; font-size: 24px; letter-spacing: .5px; }
.logo-sub { font-size: 14px; font-weight: 400; color: #9db8d6; margin-left: 10px; }
.topnav { margin-left: auto; display: flex; gap: 14px; }
.nav-link { color: #cfe0f0; text-decoration: none; font-size: 14px; padding: 6px 4px; }
.nav-link:hover { color: #fff; }
.tagline { margin: 4px 0 0; color: #bcd0e4; font-size: 14px; }
#searchBox, #library { scroll-margin-top: 78px; }

/* 布局 */
.layout {
  max-width: 1180px; margin: 20px auto 60px; padding: 0 16px;
  display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start;
}
.main-col { min-width: 0; }

/* 卡片 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* 输入区 */
.hero { padding: 18px; }
#queryInput {
  width: 100%; min-height: 64px; resize: vertical; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 8px; font-size: 15px;
  font-family: inherit; color: var(--ink); background: #fbfcfe;
}
#queryInput:focus { outline: none; border-color: var(--accent); background: #fff; }
.query-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 22px; font-size: 15px; cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #9db0c2; cursor: not-allowed; }
.hint { color: var(--ink-2); font-size: 13px; }
.templates { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tpl-btn {
  border: 1px solid var(--line); background: var(--gray-bg); color: var(--ink);
  border-radius: 16px; padding: 6px 13px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tpl-btn:hover { border-color: var(--accent); color: var(--accent); background: #eef5fb; }

/* 加载动画 */
.loading { display: flex; align-items: center; gap: 12px; padding: 22px; color: var(--accent); font-size: 15px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #d5e3f2; border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 结果区 */
.result { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }

/* 总结卡 */
.summary-card {
  background: linear-gradient(120deg, #eaf3fb, #f7fbfe);
  border: 1px solid #c9def2; border-radius: var(--radius);
  padding: 14px 16px; font-weight: 600; color: #144a75;
}

/* 冲突卡 */
.conflict-card { border: 1px solid; border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }
.conflict-card.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #7a4d0b; }
.conflict-card.info { background: #eef4fc; border-color: #a9c8ea; color: #1d4e79; }
.conflict-card .conflict-tag { font-weight: 700; margin-right: 8px; }

/* 候选卡 */
.cand-card { padding: 16px 18px; }
.cand-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cand-grade { font-size: 20px; font-weight: 700; color: #14202e; }
.cand-cat { color: var(--ink-2); font-size: 13px; }
.score-pill {
  margin-left: auto; background: var(--green-bg); color: var(--green);
  border-radius: 14px; padding: 3px 12px; font-weight: 700; font-size: 14px;
}
.cart-btn {
  border: 1px solid var(--accent); color: var(--accent); background: #fff;
  border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.cart-btn.added { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.cand-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.param { background: var(--gray-bg); border-radius: 8px; padding: 7px 10px; }
.param .k { color: var(--ink-2); font-size: 12px; display: block; }
.param .v { font-weight: 600; font-size: 14px; }
.cand-price { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.cand-price b { color: #b3521a; font-size: 16px; }
.price-basis { color: var(--ink-2); font-size: 12px; margin-left: 4px; }
.cand-reason { margin-top: 10px; font-size: 14px; background: #f7fafc; border-radius: 8px; padding: 10px 12px; color: #334155; }
.cand-alt { margin-top: 8px; font-size: 13px; color: #7a5b1e; background: #fdf6e3; padding: 8px 12px; border-radius: 6px; }
.gap-box { margin-top: 8px; font-size: 13px; color: #9a3412; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; padding: 8px 12px; }

/* 候选差异化对比 */
.comp-wrap { overflow-x: auto; }
.comp-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.comp-table th, .comp-table td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.comp-table thead th { background: #eef2f7; }
.comp-table .w { color: var(--green); font-weight: 700; background: var(--green-bg); }
.comp-table .l { color: #9aa3ad; }
.comp-table .note { color: var(--ink-2); font-size: 13px; }

/* 案例卡 */
.case-card { padding: 14px 16px; border-left: 4px solid #8a6d3b; }
.case-title { font-weight: 700; }
.case-meta { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.case-reason { font-size: 14px; margin-top: 6px; }

/* 澄清卡 */
.clarify-card { padding: 18px; border: 1px solid #b7d3ec; background: #f2f8fd; }
.clarify-card h3 { margin: 0 0 8px; color: #144a75; }
.clarify-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.clarify-opt {
  border: 1.5px solid var(--accent); background: #fff; color: var(--accent);
  border-radius: 18px; padding: 8px 16px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.clarify-opt:hover { background: var(--accent); color: #fff; }


/* 场景工况卡（v2.7） */
.scene-card { padding: 18px; border: 1px solid #b7d3ec; background: linear-gradient(180deg, #f2f8fd, #fff 90px); }
.scene-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.scene-icon { font-size: 30px; line-height: 1; }
.scene-head-main { flex: 1; min-width: 0; }
.scene-name { font-size: 18px; font-weight: 700; color: #144a75; }
.scene-desc { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.6; }
.scene-sub { font-size: 13px; color: #7a5b1e; background: #fdf6e3; border-radius: 6px; padding: 8px 12px; margin-bottom: 4px; }
.scene-q { margin-top: 14px; }
.scene-q-title { font-size: 14px; font-weight: 600; color: #14202e; margin-bottom: 8px; }
.scene-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.scene-opt {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; max-width: 100%;
}
.scene-opt:hover { border-color: var(--accent); color: var(--accent); }
.scene-opt.on { border-color: var(--accent); background: #eef5fb; color: var(--accent); }
.scene-opt-desc { font-size: 12px; color: var(--ink-2); }
.scene-opt.on .scene-opt-desc { color: #7ea0bd; }
.scene-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }

/* 场景二次结果说明块 */
.scene-ctx { padding: 14px 16px; border-left: 4px solid #144a75; background: #f2f8fd; margin-bottom: 12px; }
.scene-ctx-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scene-ctx-icon { font-size: 22px; }
.scene-ctx-title { font-weight: 700; color: #144a75; flex: 1; min-width: 0; }
.scene-ctx-block { margin-top: 8px; }
.scene-ctx-label { font-size: 12px; font-weight: 700; color: #7a8a99; margin-bottom: 4px; }
.scene-ctx-list { margin: 0; padding-left: 18px; font-size: 13px; color: #334155; line-height: 1.7; }

/* 反向详情卡（材料库详情复用） */
.reverse-card { padding: 18px; }
.reverse-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.reverse-title h2 { margin: 0; }
.reverse-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.reverse-table th, .reverse-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.reverse-table th { width: 120px; background: #f4f6f9; color: var(--ink-2); font-weight: 600; }
.reverse-table .wide { width: auto; }

/* 对比视图 */
.compare-view { padding: 18px; }
.compare-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.compare-head h2 { margin: 0; font-size: 18px; }
.state-select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.state-note { font-size: 13px; color: #7a5b1e; background: #fdf6e3; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.cmp-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.cmp-table th, .cmp-table td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.cmp-table thead th { background: #eef2f7; }
.cmp-table th:first-child, .cmp-table td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.cmp-table thead th:first-child { background: #eef2f7; z-index: 2; }
.cmp-table .winner { color: var(--green); font-weight: 700; background: var(--green-bg); }
.cmp-table .loser { color: #9aa3ad; }
.cmp-table .note { color: var(--ink-2); font-size: 13px; }
.compare-summary { margin-top: 12px; font-weight: 600; }
.compare-reco { margin-top: 6px; font-size: 14px; color: #144a75; }
.disclaimer { margin-top: 14px; font-size: 12px; color: var(--ink-2); text-align: center; }

/* 对比器侧栏（桌面） */
.compare-drawer { position: sticky; top: 104px; padding: 14px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer-head .badge {
  background: var(--accent); color: #fff; border-radius: 12px; padding: 1px 9px; font-size: 13px;
}
.drawer-actions { display: flex; gap: 6px; }
.btn-ghost-small { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-ghost-small:hover { color: var(--accent); border-color: var(--accent); }
.cart-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cart-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.cart-item .g { font-weight: 700; }
.cart-item .m { color: var(--ink-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item .rm { border: none; background: none; color: #c0392b; cursor: pointer; font-size: 16px; min-width: 32px; }
.btn-compare { width: 100%; margin-top: 6px; }
.cart-hint { color: var(--ink-2); font-size: 12px; text-align: center; margin: 8px 0 0; }
.cart-empty { color: var(--ink-2); font-size: 13px; text-align: center; padding: 16px 0; }

/* 底部悬浮条（移动/平板） */
.mobile-bar { position: fixed; bottom: 16px; left: 0; right: 0; display: flex; justify-content: center; z-index: 60; pointer-events: none; }
.mobile-cart {
  background: var(--accent); color: #fff; border: none; border-radius: 24px;
  padding: 12px 26px; font-size: 15px; cursor: pointer; box-shadow: var(--shadow); font-family: inherit; pointer-events: auto;
}

/* 回到顶部 & 展开对比器 悬浮按钮 */
.back-top {
  position: fixed; right: 16px; bottom: 150px; z-index: 85;
  width: 44px; height: 44px; border-radius: 50%;
  background: #1f2937; color: #fff; border: none; font-size: 18px; cursor: pointer;
  box-shadow: var(--shadow); font-family: inherit;
}
.back-top:hover { background: #374151; }
.open-drawer-btn {
  position: fixed; right: 16px; bottom: 84px; z-index: 85;
  background: var(--accent); color: #fff; border: none; border-radius: 20px;
  padding: 10px 16px; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); font-family: inherit;
}
.open-drawer-btn:hover { background: var(--accent-dark); }

/* 页脚 */
.footer { text-align: center; color: var(--ink-2); font-size: 12px; padding: 18px 12px 40px; }
.footer p { margin: 3px 0; }
.footer-links { margin: 6px 0 0; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-icp { margin: 4px 0 0; }
.footer-icp a { color: var(--ink-2); text-decoration: none; }
.footer-icp a:hover { text-decoration: underline; }
.footer-deploy { margin-top: 10px; }
.footer-deploy .hint { display: block; margin-top: 4px; }
.btn-deploy {
  border: 1px solid var(--line); background: var(--gray-bg); color: var(--ink);
  border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.btn-deploy:hover { color: var(--accent); border-color: var(--accent); background: #eef5fb; }
.btn-deploy:disabled { opacity: .6; cursor: default; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 100; box-shadow: var(--shadow); max-width: 86vw;
}
.error-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  background: #7f1d1d; color: #fff; text-align: center; padding: 10px; font-size: 14px;
}

/* 公告弹窗（桌面居中） */
.announce-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.announce-card {
  background: #fff; border-radius: 14px; padding: 22px 26px 20px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px);
}
.announce-card h2 { margin: 0 0 12px; font-size: 18px; flex: 0 0 auto; }
.announce-card > p { margin: 0 0 14px; font-size: 15px; line-height: 1.7; }
.announce-list { margin: 0 0 14px; text-align: left; background: #f5f7fa; border-radius: 10px; padding: 12px 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.announce-list p { margin: 0 0 6px; font-size: 14px; color: #374151; }
.announce-list p:last-child { margin-bottom: 0; }
.announce-new { border-left: 3px solid var(--accent); padding-left: 8px; color: #1d4e79 !important; }
#btnAnnounceClose { min-width: 120px; flex: 0 0 auto; }

/* 材料库折叠面板 */
.library { margin-top: 20px; padding: 16px; }
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-head h2 { margin: 0; font-size: 17px; }
.lib-count { color: var(--ink-2); font-size: 13px; }
.lib-search {
  width: 100%; margin-top: 10px; padding: 10px 12px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 8px; font-family: inherit; color: var(--ink); background: #fbfcfe;
}
.lib-search:focus { outline: none; border-color: var(--accent); background: #fff; }
.lib-groups { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.lib-group { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.lib-group-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; background: #f7f9fb; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink); font-family: inherit; text-align: left;
}
.lib-group-head .gname { display: flex; align-items: center; gap: 8px; }
.lib-group-head .gcount { color: var(--ink-2); font-weight: 400; font-size: 12px; }
.lib-group-head .arrow { transition: transform .2s; color: var(--ink-2); font-size: 12px; }
.lib-group.open .arrow { transform: rotate(90deg); }
.lib-group-head:hover { background: #eef5fb; color: var(--accent); }
.lib-items { display: none; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 10px 12px; }
.lib-group.open .lib-items { display: grid; }
.lib-item {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 6px 8px; font-size: 13px; cursor: pointer; font-family: inherit; line-height: 1.35;
}
.lib-item:hover { border-color: var(--accent); color: var(--accent); }
.lib-item.active { border-color: var(--accent); background: #eef5fb; color: var(--accent); }
.lib-item .g { font-weight: 700; }
.lib-item .a { color: var(--ink-2); font-size: 12px; display: block; }
.lib-item.active .a { color: var(--accent); }
.lib-detail { margin-top: 12px; }
mark { background: #ffe58a; color: inherit; border-radius: 2px; }
.lib-empty { color: var(--ink-2); font-size: 13px; text-align: center; padding: 14px 0; }

/* 平板与移动端：<=1024 底部抽屉布局 */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .compare-drawer {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 80;
    transform: translateY(110%); transition: transform .25s ease;
    border-radius: 14px 14px 0 0; max-height: 62vh; overflow-y: auto;
  }
  .compare-drawer.open { transform: translateY(0); }
  .mobile-bar { display: flex; }
  /* 底部固定对比器条留安全区，避免遮住页脚最后一行 */
  .footer { padding-bottom: 96px; }
  /* 移动端只保留底部「对比器 (0)」，去掉悬浮「展开对比器」 */
  .open-drawer-btn { display: none !important; }
  /* 公告改底部半屏弹窗（按钮常驻可见，只有内容区滚动） */
  .announce-overlay { align-items: flex-end; padding: 0; }
  .announce-card {
    max-width: 100%; border-radius: 16px 16px 0 0;
    max-height: 82vh; max-height: 82dvh;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    text-align: left;
  }
  .announce-list { margin-bottom: 12px; padding: 12px 14px; }
  #btnAnnounceClose { width: 100%; min-height: 44px; }
}

/* 手机端：<768 */
@media (max-width: 767px) {
  body { font-size: 14px; }
  .topbar { padding: 10px 14px 8px; }
  .logo { font-size: 20px; }
  .logo-sub { font-size: 12px; margin-left: 6px; }
  .tagline { font-size: 12px; }
  .topnav { gap: 10px; }
  .layout { margin: 12px auto 70px; padding: 0 10px; }
  .hero, .cand-card, .compare-view, .reverse-card, .clarify-card { padding: 12px; }
  .library { padding: 12px; }
  #queryInput { font-size: 16px; min-height: 56px; }
  .query-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  #btnQuery { width: 100%; min-height: 44px; font-size: 16px; }
  .hint { font-size: 12px; }
  #queryInput::placeholder { color: transparent; }
  .query-actions .hint { display: none; }
  /* 示例快捷词横向滑动 chips */
  .templates { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  .templates::-webkit-scrollbar { display: none; }
  .tpl-btn { flex: 0 0 auto; min-height: 36px; padding: 8px 14px; font-size: 14px; }
  .cand-head { gap: 8px; }
  .cand-grade { font-size: 18px; width: 100%; }
  .score-pill { margin-left: 0; }
  .cart-btn { min-height: 36px; padding: 6px 12px; font-size: 14px; }
  /* 参数两列网格卡片 */
  .cand-params { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .param { padding: 6px 8px; }
  .param .k { font-size: 11px; }
  .param .v { font-size: 13px; }
  .cand-price { font-size: 13px; }
  .cand-price b { font-size: 15px; }
  .price-basis { display: block; margin: 2px 0 0; font-size: 11px; }
  .clarify-opt { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  .btn-ghost-small { min-height: 44px; padding: 8px 12px; font-size: 13px; }
  .mobile-cart { min-height: 48px; }
  .state-select { width: 100%; min-height: 44px; }
  .btn-compare { min-height: 44px; }
  .btn-deploy { min-height: 44px; padding: 8px 14px; }
  .lib-search { font-size: 16px; }
  .lib-item { min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
  .back-top { right: 12px; bottom: 156px; }
  .open-drawer-btn { right: 12px; bottom: 88px; }
  /* 对比表：纵向维度卡片，消除横向滚动 */
  .cmp-wrap { overflow: visible; }
  .cmp-table, .cmp-table tbody { display: block; width: 100%; min-width: 0; }
  .cmp-table thead { display: none; }
  .cmp-table tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 2px 10px; }
  .cmp-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border: none; border-bottom: 1px dashed var(--line); padding: 8px 2px; text-align: right; position: static;
  }
  .cmp-table td:last-child { border-bottom: none; }
  .cmp-table td::before { content: attr(data-label); font-weight: 600; color: var(--ink-2); text-align: left; flex-shrink: 0; max-width: 42%; }
  .cmp-table td.dim { justify-content: flex-start; font-weight: 700; font-size: 14px; background: #f7f9fb; border-radius: 8px; }
  .cmp-table td.dim::before { content: none; }
  .cmp-table th:first-child, .cmp-table td:first-child { position: static; background: transparent; }
  .comp-wrap { overflow: visible; }
  .comp-table, .comp-table tbody { display: block; width: 100%; min-width: 0; }
  .comp-table thead { display: none; }
  .comp-table tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 2px 10px; }
  .comp-table td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border: none; border-bottom: 1px dashed var(--line); padding: 8px 2px; text-align: right;
  }
  .comp-table td:last-child { border-bottom: none; }
  .comp-table td::before { content: attr(data-label); font-weight: 600; color: var(--ink-2); text-align: left; flex-shrink: 0; max-width: 42%; }
  .comp-table td.dim { justify-content: flex-start; font-weight: 700; font-size: 14px; background: #f7f9fb; border-radius: 8px; }
  .comp-table td.dim::before { content: none; }
  .reverse-table th { width: 34%; }
}

/* ===== GradeCard v1.5 新增样式 ===== */

/* 结果工具栏：候选数 + 成本排序 */
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 2px 10px; flex-wrap: wrap; }
.result-count { font-size: 13px; color: var(--ink-2); }
.btn-ghost-small.active { border-color: var(--accent); color: var(--accent); background: #eef5fb; }

/* 成本等级徽标 */
.cost-badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 12px; padding: 2px 10px; margin: 8px 0 2px; }
.cost-badge.低 { background: var(--green-bg); color: var(--green); border: 1px solid #b9e0c8; }
.cost-badge.中低 { background: #eef7e2; color: #4a7d1f; border: 1px solid #cfe3b4; }
.cost-badge.中 { background: var(--warn-bg); color: #a05a1a; border: 1px solid #f0cf9f; }
.cost-badge.中高 { background: #fdeee2; color: #b3541e; border: 1px solid #efc0a0; }
.cost-badge.高 { background: var(--danger-bg); color: #b33a3a; border: 1px solid #efb3b3; }
.cost-badge.很高 { background: #f7d9d9; color: #8f2020; border: 1px solid #e8a2a2; }

/* 推荐理由折叠 */
.reason-fold { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.reason-head { display: flex; align-items: center; justify-content: space-between; width: 100%; border: none; background: #f7fafc; color: #334155; font-size: 14px; font-weight: 600; padding: 9px 12px; cursor: pointer; font-family: inherit; }
.reason-head:hover { background: #eef4f8; }
.reason-head.open .reason-arrow { transform: rotate(180deg); }
.reason-arrow { transition: transform .18s; font-size: 11px; color: var(--ink-2); margin-left: 8px; }
.reason-body { padding: 8px 12px 10px; }
.reason-item { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.reason-item:last-child { border-bottom: none; }
.reason-item.pass { color: #1a5c37; }
.reason-item.fail { color: #a52a2a; }
.reason-item.warn { color: #7a5a12; }
.ri-dim { font-weight: 700; min-width: 44px; }
.ri-verdict { font-size: 12px; border-radius: 4px; padding: 0 6px; background: var(--gray-bg); }
.reason-item.pass .ri-verdict { background: var(--green-bg); }
.reason-item.fail .ri-verdict { background: var(--danger-bg); }
.reason-item.warn .ri-verdict { background: var(--warn-bg); }
.ri-detail { color: inherit; }
.ri-note { width: 100%; color: var(--ink-2); font-size: 12px; }

/* 推理摘要 */
.reasoning-summary { margin-bottom: 12px; padding: 12px 16px; background: linear-gradient(120deg, #f2f7fc, #f8fbfd); }
.rs-title { font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.rs-body { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.rs-line { font-size: 13px; color: #334155; }
.rs-k { color: var(--ink-2); margin-right: 4px; }
.rs-note { margin-top: 8px; font-size: 12px; color: var(--ink-2); }

/* 详情页元信息分区 */
.detail-sec { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.comp-block { margin-bottom: 12px; }
.comp-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.comp-chips, .std-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.comp-chip { font-size: 12px; border-radius: 6px; padding: 3px 8px; background: var(--gray-bg); color: #334155; border: 1px solid var(--line); }
.comp-chip.main { background: #eef5fb; border-color: #c9dcef; color: #1d4e79; }
.comp-chip.residual { background: #fdf1e7; border-color: #efd0b4; color: #8a5a2a; }
.std-chip { font-size: 12px; border-radius: 6px; padding: 3px 8px; background: #eef7ec; border: 1px solid #cfe3c4; color: #2f6b3a; }
.price-range-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.price-range-line b { color: #b3521a; }
.source-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: #334155; }
.source-text { color: var(--ink-2); }
.conf-badge { font-size: 12px; font-weight: 600; border-radius: 12px; padding: 2px 10px; }
.conf-badge.high { background: var(--green-bg); color: var(--green); }
.conf-badge.mid { background: var(--warn-bg); color: #a05a1a; }
.muted { color: var(--ink-2); font-size: 13px; }

/* 收藏按钮 */
.fav-btn { border: 1px solid var(--line); background: #fff; color: #b7791f; border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer; font-family: inherit; margin-left: auto; }
.fav-btn:hover { border-color: #e0b04f; background: #fff8e8; }
.fav-btn.on { background: #fff3d6; border-color: #e0b04f; color: #9a6b12; }
.fav-btn.mini { padding: 2px 7px; font-size: 13px; margin-left: 0; }
.cand-price .price-range { display: inline-block; margin-left: 8px; font-size: 13px; color: #b3521a; }

/* 我的数据（收藏 / 最近浏览 / 历史，已并入账户弹窗） */
.local-overlay { position: fixed; inset: 0; background: rgba(16, 30, 54, .45); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.local-card { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 78vh; display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(16,30,54,.25); }
.local-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.local-head h2 { margin: 0; font-size: 17px; }
.local-tabs { display: flex; gap: 6px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); }
.local-tab { border: 1px solid var(--line); background: var(--gray-bg); color: var(--ink-2); border-radius: 8px 8px 0 0; padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
.local-tab.active { background: #fff; color: var(--accent); border-bottom-color: #fff; font-weight: 600; }
.local-tabpane { flex: 1; overflow-y: auto; padding: 12px 18px; min-height: 140px; }
.local-item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 14px; }
.local-item .g { font-weight: 700; }
.local-item .m { color: var(--ink-2); font-size: 12px; flex: 1; min-width: 80px; }
.local-item .acts { display: flex; gap: 6px; }
.local-item .hq { width: 100%; font-size: 13px; color: #334155; }
.local-item .hm { width: 100%; font-size: 12px; color: var(--ink-2); }
.local-empty { color: var(--ink-2); font-size: 13px; text-align: center; padding: 30px 10px; }
.local-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* 手机端 v1.5 保护：无横向滚动 */
@media (max-width: 767px) {
  .local-card { width: 100%; max-height: 84vh; }
  .local-item .acts { width: 100%; justify-content: flex-end; }
  .cost-badge { margin: 6px 0 0; }
  .reason-item { align-items: flex-start; }
  .ri-detail { width: 100%; }
  .fav-btn { margin-left: 0; }
  .cand-head .fav-btn.mini { margin-left: 2px; }
  .price-range-line { font-size: 13px; }
  .detail-sec { word-break: break-all; }
}


/* 2.0 用户系统 */
.user-area { margin-left: auto; display: flex; align-items: center; }
.btn-user { border: 1px solid var(--line); background: #fff; color: var(--accent); border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.btn-user:hover { border-color: var(--accent); background: #f2f7fd; }
.btn-user .user-name { font-weight: 600; }
.btn-user .user-quota { font-size: 11px; color: var(--ink-2); }

/* 3.7.0 额度剩余进度条 */
.btn-user .quota-bar { display: block; align-self: stretch; width: 100%; height: 3px; margin-top: 5px; border-radius: 999px; background: #e3e9f0; overflow: hidden; }
.btn-user .quota-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .25s ease; }
.btn-user .quota-bar-fill.low { background: #e0a33a; }
.btn-user .quota-bar-fill.out { background: #d9534f; }
body.theme-dark .btn-user .quota-bar { background: #2b3542; }

/* 3.7.0 额度用尽：邮件申请弹窗 */
.quota-card { width: min(400px, 100%); }
.quota-msg { font-weight: 600; color: var(--ink); }
.quota-apply { margin: 12px 0 4px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: var(--gray-bg); }
.quota-apply-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.quota-apply-mail { color: var(--accent); font-weight: 600; text-decoration: none; word-break: break-all; }
.quota-apply .hint { margin: 8px 0 0; }
.quota-apply-btn { display: block; text-align: center; text-decoration: none; box-sizing: border-box; }
.quota-apply-alt { display: block; width: 100%; box-sizing: border-box; text-align: center; padding: 10px 12px; font-size: 13px; border-radius: 8px; }

.auth-overlay { position: fixed; inset: 0; background: rgba(16, 30, 54, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { background: #fff; border-radius: 12px; width: min(420px, 100%); max-height: 84vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(16,30,54,.25); }
.auth-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.auth-head h2 { margin: 0; font-size: 17px; }
.auth-tabs { display: flex; gap: 6px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); }
.auth-tab { border: 1px solid var(--line); background: var(--gray-bg); color: var(--ink-2); border-radius: 8px 8px 0 0; padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
.auth-tab.active { background: #fff; color: var(--accent); border-bottom-color: #fff; font-weight: 600; }
.auth-pane { padding: 14px 18px 18px; }
.auth-pane .hint { margin: 0 0 12px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none; width: 100%; box-sizing: border-box; }
.auth-input:focus { border-color: var(--accent); }
.auth-submit { width: 100%; }
.redeem-quota { background: var(--gray-bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; color: #334155; }
.redeem-quota-line { margin: 4px 0 0; font-weight: 600; color: var(--accent); }
.auth-logout { width: 100%; margin-top: 10px; }

@media (max-width: 767px) {
  /* 3.7.0：加额度行后横排会挤压换行，移动端改为上下两行（与桌面一致，更紧凑） */
  .btn-user { gap: 0; padding: 6px 12px; max-width: 62vw; }
  .btn-user .user-quota { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .btn-user .quota-bar { margin-top: 4px; align-self: stretch; }
  /* 顶栏宽度变化后标题会断在词中间，固定成「GradeCard / 材料选型助手」两行 */
  .logo-sub { display: block; margin-left: 0; }
  .user-area { margin-left: 6px; }
}


/* ============ 2.3 选型工作台 ============ */
.topnav { flex-wrap: wrap; }
.nav-link.active { color: #fff; border-bottom: 2px solid #fff; }
.ws-tab { min-width: 0; }
.ws-tab.card { padding: 16px 18px; }
.ws-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ws-head h2 { margin: 0; font-size: 17px; }
.ws-count { font-size: 12px; }
.ws-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.wf-item label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.wf-item input, .ws-sub textarea { border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px; font-family: inherit; color: var(--ink); background: #fbfcfe; box-sizing: border-box; }
.wf-item input { width: 150px; }
.wf-item input:focus, .ws-sub textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.wf-btn { min-height: 40px; }
.ws-sub { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.ws-sub h3 { margin: 0 0 10px; font-size: 15px; }
.ws-sub textarea { width: 100%; min-height: 56px; resize: vertical; margin-bottom: 8px; }
.ws-sub-hint { margin: 0 0 8px; }
.ws-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.ws-chip { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.ws-chip:hover { border-color: var(--accent); color: var(--accent); }
.ws-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 标准件库 */
.fstd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 12px; }
.fstd-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.fstd-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.fstd-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fstd-card .fc-cat { display: inline-block; font-size: 11px; color: var(--accent); background: #eef5fb; border-radius: 999px; padding: 1px 8px; margin-bottom: 6px; }
.fstd-card .fc-name { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.fstd-card .fc-std { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.fstd-card .fc-rows { font-size: 12px; color: #334155; line-height: 1.6; }
.fstd-card .fc-rows span { display: block; }
.fstd-card .fc-acts { display: flex; gap: 6px; margin-top: 8px; align-items: center; flex-wrap: wrap; }

/* 公差结果 */
.tol-result { margin-top: 12px; }
.tol-fit-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.tol-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.tol-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.tol-legend .lh { background: rgba(29,111,184,.35); border: 1px solid #1d6fb8; }
.tol-legend .ls { background: rgba(26,127,75,.35); border: 1px solid #1a7f4b; }
.tol-band { position: relative; height: 30px; border: 1px solid var(--line); border-radius: 6px; margin: 4px 0 10px; background: repeating-linear-gradient(90deg, #f3f4f6 0 24px, #fff 24px 48px); overflow: hidden; }
.tol-band-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.tol-band-bar.hole { background: rgba(29, 111, 184, .35); border: 1px solid #1d6fb8; }
.tol-band-bar.shaft { background: rgba(26, 127, 75, .35); border: 1px solid #1a7f4b; }
.tol-zero { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #111; }
.tol-devs { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin: 8px 0; }
.tol-devs b { color: var(--accent); }
.tol-commons { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tol-common-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; background: #fff; }
.tol-common-item:hover { border-color: var(--accent); }
.tol-common-item b { color: var(--accent); }
.tol-common-item .tt { display: inline-block; font-size: 11px; border-radius: 999px; padding: 0 8px; margin-left: 6px; color: #fff; }
.tt-gap { background: #1a7f4b; }
.tt-trans { background: #b45309; }
.tt-int { background: #b91c1c; }
.tol-suggest-card { border: 1px dashed var(--warn-line); background: var(--warn-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; }

/* v2.4 公差工程师工具 */
.tol-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.tol-tab { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; }
.tol-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tol-sub { margin-top: 4px; }
.tol-legend .lg { background: rgba(180, 83, 9, .3); border: 1px solid #b45309; }
.tol-band { height: 34px; }
.tol-gap { position: absolute; top: 12px; bottom: 4px; border-radius: 4px; opacity: .55; z-index: 2; }
.tol-gap.tt-gap { background: #1a7f4b; }
.tol-gap.tt-trans { background: #b45309; }
.tol-gap.tt-int { background: #b91c1c; }
.tol-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 10px 0; }
.tol-meta { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.7; }
.tol-meta b { color: var(--accent); }
.tol-yield { border: 1px solid #bfe3cf; background: var(--green-bg); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 8px; }
.tol-yield b { color: #1a7f4b; }
.tol-yield-track { height: 6px; background: #e5e7eb; border-radius: 999px; margin: 6px 0 4px; overflow: hidden; }
.tol-yield-track i { display: block; height: 100%; background: linear-gradient(90deg, #34d399, #1a7f4b); border-radius: 999px; }
.rev-result { margin-top: 10px; }
.rev-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.rev-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; }
.rev-card b { color: var(--accent); }
.rev-card .btn-mini { margin-top: 6px; }
.tol-batch-wrap { overflow-x: auto; margin-top: 8px; }
.tol-batch-table { border-collapse: collapse; font-size: 13px; min-width: 560px; width: 100%; }
.tol-batch-table th, .tol-batch-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.tol-batch-table th { background: #f5f7fa; }
.tol-batch-table tr.err td { background: #fef2f2; }
.tol-tpl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.tol-tpl-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.8; background: #fff; }
.tol-tpl-card b { color: var(--accent); }


/* 工艺推荐 */
.proc-result { margin-top: 12px; }
.proc-reco { border: 1px solid #bfe3cf; background: var(--green-bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.proc-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.proc-item.reco { border-color: var(--accent); background: #f2f7fd; }
.proc-item .pi-name { font-weight: 700; }
.proc-item .pi-param { font-size: 13px; color: #334155; margin-top: 3px; }
.proc-item .pi-use { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.proc-tips { background: #f5f7fa; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #374151; margin-top: 10px; }
.proc-tips p { margin: 3px 0; }
.solution-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
.solution-card .sol-row { display: flex; gap: 8px; margin: 5px 0; font-size: 14px; }
.solution-card .sol-k { color: var(--ink-2); min-width: 72px; flex: 0 0 auto; }
.sol-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sol-actions .muted { font-size: 12px; }
.sol-inp { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 13px;
  font-family: inherit; color: var(--ink); background: #fff; min-width: 150px; max-width: 100%; }
.sol-inp:focus { outline: none; border-color: var(--accent); }
.sol-share-inp { min-width: 240px; color: var(--ink-2); }

/* API 文档 */
.api-docs .api-endpoint { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.api-ep-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f7f9fb; flex-wrap: wrap; }
.api-method { font-family: Consolas, monospace; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 7px; flex: 0 0 auto; }
.api-path { font-family: Consolas, monospace; font-size: 13px; color: #0f2a43; word-break: break-all; }
.api-ep-desc { font-size: 13px; color: var(--ink-2); width: 100%; }
.api-code { background: #0f172a; color: #d1e4f5; padding: 10px 12px; font-family: Consolas, monospace; font-size: 12px; overflow-x: auto; white-space: pre; line-height: 1.5; margin: 0; }
.api-copy { margin-left: auto; flex: 0 0 auto; }
.api-token-list { overflow-x: auto; }
.api-token-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.api-token-list th, .api-token-list td { border-bottom: 1px solid #eef0f2; padding: 7px 6px; text-align: left; white-space: nowrap; }
.api-token-created { background: var(--green-bg); border: 1px solid #bfe3cf; border-radius: 8px; padding: 10px 12px; font-family: Consolas, monospace; font-size: 13px; word-break: break-all; margin-bottom: 10px; }

/* 移动端工作台 */
@media (max-width: 767px) {
  .ws-tab.card { padding: 12px; }
  .ws-form { align-items: stretch; }
  .wf-item input { width: 100%; min-height: 44px; font-size: 16px; }
  .wf-btn { width: 100%; min-height: 44px; }
  .fstd-grid { grid-template-columns: 1fr; }
  .tol-commons { grid-template-columns: 1fr; }
  .api-ep-head { align-items: flex-start; }
  .api-copy { margin-left: 0; }
  .api-method { padding: 2px 8px; }
}

/* 2.3 补充：公告动态渲染 / 联动按钮 / API 表格 */
.announce-item { border-bottom: 1px dashed var(--line); padding: 8px 0; }
.announce-item:last-child { border-bottom: 0; }
.announce-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.announce-body { font-size: 13px; color: #334155; line-height: 1.6; white-space: pre-wrap; }
.proc-btn { border: 1px solid #bfe3cf; background: #f0fdf4; color: #166534; border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer; margin-left: 6px; font-family: inherit; vertical-align: middle; }
.proc-btn:hover { background: #dcfce7; }
.proc-btn.mini { padding: 2px 8px; margin-left: 0; }
.err-text { color: #b91c1c; font-size: 14px; }
.fstd-detail { margin-top: 14px; }
.fit-entry { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.tag-active { background: #dcfce7; color: #166534; }
.tag-disabled { background: #f3f4f6; color: #6b7280; }
.api-token-list code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* 首页：FAQ */
.home-faq { margin-top: 14px; }
.home-faq-head h3 { margin: 0 0 4px; font-size: 15px; }
.faq-list { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px dashed var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-q { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 2px; background: none; border: 0; cursor: pointer; text-align: left; font-size: 14px; color: #0f2a43; font-family: inherit; }
.faq-q:hover { color: var(--accent); }
.faq-arrow { transition: transform .15s; color: var(--ink-2); font-size: 12px; }
.faq-item.open .faq-arrow { transform: rotate(90deg); }
.faq-a { display: none; padding: 0 2px 10px 22px; font-size: 13px; color: #334155; line-height: 1.7; }
.faq-item.open .faq-a { display: block; }
.faq-a p { margin: 0 0 8px; }
.faq-go { border: 1px solid var(--accent); color: var(--accent); background: #f2f7fd; border-radius: 8px; padding: 3px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.faq-go:hover { background: var(--accent); color: #fff; }
/* ============ 首页视觉升级 v2.6.0 ============ */
/* Hero 搜索区 */
.hero {
  position: relative; overflow: hidden;
  padding: 30px 26px 22px;
  background:
    radial-gradient(560px 220px at 88% -30%, rgba(29,111,184,.10), transparent 60%),
    radial-gradient(420px 200px at -6% 110%, rgba(26,127,75,.07), transparent 60%),
    linear-gradient(150deg, #f3f9ff 0%, #ffffff 55%, #fbfcff 100%);
  border-color: #d8e7f5;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(29,111,184,.08), transparent 65%);
  pointer-events: none;
}
.hero-top { position: relative; margin-bottom: 14px; }
.hero-badge {
  display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent);
  background: #e7f1fb; border: 1px solid #cfe2f4; border-radius: 999px; padding: 3px 12px;
  letter-spacing: .3px;
}
.hero-title { margin: 10px 0 4px; font-size: 22px; color: #14202e; letter-spacing: .3px; }
.hero-sub { margin: 0; font-size: 13px; color: var(--ink-2); }
#queryInput {
  position: relative; min-height: 68px; padding: 14px 16px; font-size: 15px;
  border: 1.5px solid #c9d9ea; border-radius: 12px; background: rgba(255,255,255,.92);
  box-shadow: inset 0 1px 3px rgba(16,30,54,.04);
}
#queryInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,111,184,.12); }
.hero .btn-primary {
  padding: 11px 30px; font-size: 15px; border-radius: 10px;
  background: linear-gradient(135deg, #1d6fb8, #155a94);
  box-shadow: 0 4px 12px rgba(29,111,184,.28);
}
.hero .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(29,111,184,.34); }
.templates { margin-top: 16px; }
.tpl-btn { border-radius: 999px; padding: 6px 15px; background: #fff; border-color: #d8e0ea; transition: all .15s; }
.tpl-btn:hover { background: #eef5fb; transform: translateY(-1px); }

/* 常见问题 */
.home-faq { padding: 18px; }
.home-faq-head h3 { font-size: 16px; margin-bottom: 2px; }
.faq-item { border-bottom: 1px solid #edf0f4; }
.faq-item:last-child { border-bottom: 0; }
.faq-q { padding: 12px 6px; border-radius: 8px; font-size: 14px; transition: background .12s; }
.faq-q:hover { background: #f6f9fc; }
.faq-arrow {
  width: 20px; height: 20px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--accent); background: #e7f1fb; border-radius: 6px;
  transition: transform .15s;
}
.faq-item.open .faq-arrow { transform: rotate(90deg); }
.faq-a { padding: 0 4px 14px 34px; font-size: 13px; color: #475569; }

/* 移动端适配 */
@media (max-width: 767px) {
  .hero { padding: 22px 16px 18px; }
  .hero-title { font-size: 19px; }
  .home-faq { padding: 14px; }
  /* 顶部栏：Logo 左、登录/注册右上，功能选项 4 列两行网格 */
  .topbar-inner {
    display: grid; grid-template-columns: 1fr auto; align-items: center;
    gap: 10px 12px;
  }
  .logo { grid-column: 1; grid-row: 1; }
  .user-area { grid-column: 2; grid-row: 1; justify-self: end; }
  .topnav {
    grid-column: 1 / -1; grid-row: 2; margin-left: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  }
  .nav-link {
    text-align: center; white-space: nowrap; padding: 8px 2px;
    font-size: 13px; background: rgba(255,255,255,.07); border-radius: 8px;
  }
  .nav-link.active { border-bottom: 0; background: rgba(255,255,255,.18); }
  /* 搜索框下常用需求一行：移动端隐藏 */
  .templates { display: none; }
}

/* ================= 2.8 工程计算器 ================= */
.calc-tab {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 5px 14px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.calc-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.calc-sub { margin-top: 4px; }
.wf-item select {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fbfcfe; box-sizing: border-box; width: 150px;
}
.wf-item select:focus { outline: none; border-color: var(--accent); background: #fff; }
.calc-verdict {
  border-radius: 8px; padding: 9px 12px; font-size: 14px; font-weight: 600;
  margin-bottom: 10px; border: 1px solid;
}
.calc-verdict.ok { background: #eef9f0; border-color: #a8dcb4; color: #1c6b34; }
.calc-verdict.bad { background: #fdeeee; border-color: #f0b4b4; color: #a32020; }
.calc-verdict.info { background: #eef4fc; border-color: #b6cfeb; color: #1c5fa8; }
.calc-kv { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
.calc-kv th, .calc-kv td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.calc-kv th { background: #f4f7fb; width: 160px; font-weight: 600; color: #33475b; }
.calc-note { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; line-height: 1.65; }
.calc-basis { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; font-style: italic; }
.calc-extbox { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: 13px; background: #fbfcfe; }
.calc-extbox b { display: block; margin-bottom: 4px; }
.calc-extbox ul { margin: 0 0 0 18px; padding: 0; }
.calc-list { display: flex; flex-direction: column; gap: 8px; }
.calc-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; background: #fff; }
.calc-item h4 { margin: 0 0 6px; font-size: 14px; color: var(--accent); }
.calc-item .row { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.calc-item .row span { color: var(--ink-2); }
.calc-item .row b { color: var(--ink); font-weight: 600; }
@media (max-width: 1024px) {
  .wf-item select { width: 100%; min-height: 44px; font-size: 16px; }
  .calc-kv th { width: 110px; }
  .calc-tab { padding: 7px 13px; }
}
/* ================= 2.8 详情页：数据可信标注 + 牌号对照 ================= */
.trust-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.trust-text {
  color: #334155; background: #f4f7fb; border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 10px; line-height: 1.6;
}
.basis-text { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.equiv-block { font-size: 13px; }
.equiv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.equiv-cell {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: #fbfcfe;
}
.equiv-key { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.equiv-val { flex: 1 1 auto; min-width: 0; color: var(--ink); word-break: break-word; }
.equiv-val.empty { color: var(--ink-2); }
.equiv-sub { margin: 8px 0 0; font-size: 12px; color: #334155; line-height: 1.7; }
.equiv-note {
  margin: 6px 0 0; font-size: 12px; color: #8a5a2a; line-height: 1.65;
  background: #fdf6ee; border: 1px solid #efd9bd; border-radius: 6px; padding: 6px 10px;
}
.equiv-more { margin-top: 8px; }

/* 我的方案（方案库） */
.sol-lib-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.sol-lib-toolbar .muted { font-size: 13px; }
.sol-item { display: flex; align-items: flex-start; gap: 12px; }
.sol-item-main { flex: 1 1 auto; min-width: 0; }
.sol-item-main h4 { margin: 0 0 4px; font-size: 14px; color: var(--accent); word-break: break-word; }
.sol-item .row b { font-weight: 600; }
.sol-item-acts { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.sol-item-acts .btn-mini { white-space: nowrap; }
.sol-del { color: #a32020; border-color: #f0b4b4; }
.sol-del:hover { background: #fdeeee; }

@media (max-width: 1024px) {
  .equiv-grid { grid-template-columns: 1fr; }
  .equiv-cell { padding: 7px 10px; }
  .equiv-more { width: 100%; min-height: 40px; font-size: 14px; margin-top: 10px; }
  .sol-item { flex-direction: column; gap: 8px; }
  .sol-item-acts { flex-direction: row; }
  .sol-item-acts .btn-mini { min-height: 38px; padding: 0 14px; }
  .sol-actions { gap: 6px; }
  .sol-share-inp { flex: 1 1 100%; min-width: 0; }
}

/* ================= 3.0 工程闭环：成本估算 / 尺寸链 / 材料导出 ================= */
.cost-dims { margin-top: 4px; }
.ds-badge {
  display: block; font-style: normal; background: #f4f7fb;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
  color: #33475b; margin-top: 8px;
}

/* 过度设计：低价替代牌号卡片 */
.od-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.od-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.od-head b { font-size: 14px; color: var(--accent); }
.od-drop {
  font-size: 12px; font-weight: 600; color: #1c6b34;
  background: #eef9f0; border: 1px solid #a8dcb4; border-radius: 999px; padding: 2px 10px;
}
.od-meta { font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.od-risk {
  margin-top: 6px; font-size: 12px; color: #8a5a2a; line-height: 1.65;
  background: #fdf6ee; border: 1px solid #efd9bd; border-radius: 6px; padding: 5px 10px;
}
.od-ok {
  margin-top: 6px; font-size: 12px; color: #1c6b34; line-height: 1.65;
  background: #eef9f0; border: 1px solid #a8dcb4; border-radius: 6px; padding: 5px 10px;
}

/* 尺寸链组成环 */
.dc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 10px 0 8px;
}
.dc-head .muted { font-size: 12px; line-height: 1.6; }
.dc-rings { display: flex; flex-direction: column; gap: 8px; }
.dc-ring {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfcfe;
}
.dc-ring input {
  border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff; box-sizing: border-box;
}
.dc-ring input:focus { outline: none; border-color: var(--accent); }
.dc-ring .dc-name { flex: 0 0 110px; width: 110px; }
.dc-ring .dc-nominal, .dc-ring .dc-tol { flex: 1 1 110px; min-width: 90px; }
.dc-ring select {
  flex: 0 0 100px; border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 8px;
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff;
}
.dc-ring [data-dc-del] { flex: 0 0 auto; }

/* 材料导出：快捷按钮 */
.exp-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.exp-quick-btn { padding: 7px 12px; font-size: 13px; }

@media (max-width: 1024px) {
  .dc-ring { padding: 10px; gap: 6px; }
  .dc-ring .dc-name, .dc-ring .dc-nominal, .dc-ring .dc-tol { flex: 1 1 46%; width: auto; min-height: 44px; font-size: 16px; }
  .dc-ring select { flex: 1 1 46%; min-height: 44px; font-size: 16px; }
  .dc-ring [data-dc-del] { flex: 1 1 100%; min-height: 40px; }
  .exp-quick-btn { flex: 1 1 46%; min-height: 40px; font-size: 14px; }
  .calc-verdict { font-size: 13px; }
  .calc-kv { font-size: 12px; }
  .calc-kv th, .calc-kv td { padding: 6px 8px; }
  .ds-badge { font-size: 11px; }
}

/* ===== v3.0 数据来源标注（材料库列表 + 对比表） ===== */
.lib-item { position: relative; }
.ds-dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; cursor: help;
}
.ds-dot.ds-hi { background: #2fa36b; box-shadow: 0 0 0 2px rgba(47,163,107,.16); }
.ds-dot.ds-mid { background: #d99a2b; box-shadow: 0 0 0 2px rgba(217,154,43,.16); }
.ds-dot.ds-lo { background: #b8bec9; box-shadow: 0 0 0 2px rgba(184,190,201,.16); }

.cmp-sources {
  margin-top: 12px; border: 1px dashed var(--line); border-radius: 8px;
  padding: 10px 12px; background: #fafbfd;
}
.cmp-sources .ds-badge { margin: 0 0 6px; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.cmp-sources ul { margin: 0; padding-left: 16px; }
.cmp-sources li { font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.cmp-sources li b { color: var(--ink); }

@media (max-width: 1024px) {
  .cmp-sources { padding: 10px; }
  .cmp-sources li { font-size: 12px; }
  .ds-dot { top: 8px; right: 8px; }
}

/* ---- v3.0 疲劳校核 ---- */
.calc-verdict.warn { background: #fff8e6; border-color: #f0d79a; color: #8a6100; }
.dc-ring .ft-sa, .dc-ring .ft-sm, .dc-ring .ft-cyc { flex: 1 1 110px; min-width: 90px; }
@media (max-width: 1024px) {
  .dc-ring .ft-sa, .dc-ring .ft-sm, .dc-ring .ft-cyc { flex: 1 1 46%; width: auto; min-height: 44px; font-size: 16px; }
}

/* ---- 3.1 电机选型 ---- */
.mot-h { margin: 14px 0 6px; font-size: 14px; color: #22344a; }
.mot-h:first-child { margin-top: 0; }
.mot-note { font-weight: 400; font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.mot-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 767px) {
  .mot-scroll.wide > .calc-kv { min-width: 680px; }
}
.auth-tabs { flex-wrap: wrap; row-gap: 6px; }
.auth-card.wide { width: min(560px, 100%); }
#authPaneData .local-tabpane { max-height: 46vh; }
/* v3.4 联系客服：客服邮箱条 + 我的留言时间线 */
.support-contact { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: var(--gray-bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.support-contact .support-label { color: var(--ink-2); }
.support-contact b { color: var(--accent); user-select: all; word-break: break-all; }
.support-contact a.btn-ghost-small { text-decoration: none; display: inline-flex; align-items: center; }
.support-mine { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.support-mine h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.support-msg { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.support-msg-head { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: 12px; margin-bottom: 4px; }
.support-msg-body { color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.support-msg-reply { margin-top: 6px; background: var(--green-bg); border-radius: 6px; padding: 6px 8px; color: #14532d; white-space: pre-wrap; word-break: break-word; }
.support-tag { border-radius: 999px; padding: 1px 8px; font-size: 11px; white-space: nowrap; }
.support-tag.open { background: var(--warn-bg); color: #92400e; }
.support-tag.handled { background: var(--green-bg); color: var(--green); }

/* v3.2 驱动链配套件：复选框组与方案页签内联选项 */
.wf-checks { display: flex; gap: 14px; align-items: center; min-height: 40px; flex-wrap: wrap; }
.wf-checks .wf-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); margin: 0; white-space: nowrap; }
.wf-checks .wf-check input, .sol-drive .wf-check input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; border-radius: 3px; flex: 0 0 auto; }
.sol-drive { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 8px; }
.sol-drive-t { font-size: 12px; color: var(--ink-2); }
.sol-drive input[type="number"] { width: 120px; border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; font-family: inherit; background: #fbfcfe; box-sizing: border-box; }
.sol-drive select { border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; font-family: inherit; background: #fbfcfe; color: var(--ink); box-sizing: border-box; }
.sol-drive input[type="number"]:focus, .sol-drive select:focus { outline: none; border-color: var(--accent); background: #fff; }
.sol-drive .wf-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); margin: 0; white-space: nowrap; }
@media (max-width: 760px) {
  .sol-drive input[type="number"], .sol-drive select { width: 100%; min-height: 44px; font-size: 16px; }
  .sol-drive-t { width: 100%; }
}

/* v3.2 驱动链成本卡片列表：桌面 / 移动端同一套结构 */
.drive-list { list-style: none; margin: 0 0 10px; padding: 0; }
.drive-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; background: #fbfcfe; }
.drive-li-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drive-li-main b { font-size: 13px; color: #33475b; }
.drive-li-main span { font-size: 12px; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.drive-li-main .drive-li-note { font-size: 11px; color: #8a97a6; }
.drive-li-price { flex: 0 0 auto; font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; color: #33475b; }
.drive-li-price .drive-li-qty { display: block; font-size: 11px; font-weight: 400; color: var(--ink-2); margin-top: 2px; }
.drive-total { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 13px;
  padding: 9px 11px; border-radius: 8px; background: #eef4fb; color: #33475b; }
.drive-total b { font-size: 18px; color: var(--accent); }

/* ================= 3.5 设置 / 数据接口 / 私有库 / 黑夜模式 ================= */

/* 顶栏螺母设置按钮（登录按钮之前） */
.btn-nut {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-right: 8px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .32); border-radius: 8px;
  background: rgba(255, 255, 255, .08); color: #dbe8f5; cursor: pointer;
}
.btn-nut:hover { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .6); }
.btn-nut.active { background: #fff; color: #1d3a5a; border-color: #fff; }
.btn-nut svg { display: block; }

/* 材料库来源切换（通用库 / 我的私有库） */
.lib-scope { display: inline-flex; gap: 4px; margin-top: 10px; padding: 3px; background: var(--gray-bg); border: 1px solid var(--line); border-radius: 8px; }
.lib-scope-btn { border: none; background: none; font-family: inherit; font-size: 13px; color: var(--ink-2); padding: 5px 14px; border-radius: 6px; cursor: pointer; }
.lib-scope-btn:hover { color: var(--accent); }
.lib-scope-btn.active { background: var(--panel); color: var(--accent); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 30, 54, .14); }
.lib-mine { display: inline-block; margin-left: 6px; vertical-align: middle; font-size: 10px; font-weight: 600; color: var(--green); background: var(--green-bg); border: 1px solid #bfe3cf; border-radius: 999px; padding: 0 6px; }
.lib-empty-act { margin-top: 10px; display: flex; justify-content: center; }

/* 设置弹窗 */
.settings-card { width: min(520px, 100%); }
.settings-body { padding: 4px 18px 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.settings-row:last-of-type { border-bottom: none; }
.settings-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; color: var(--ink); }
.settings-hint { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.settings-actions { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.settings-actions a.btn-mini { text-decoration: none; display: inline-flex; align-items: center; }
.settings-support { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.settings-support > summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.settings-support .hint { margin: 8px 0; }

/* 开关控件 */
.switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; width: 0; height: 0; opacity: 0; }
.switch-track { display: block; position: relative; width: 44px; height: 24px; background: #cbd5e1; border-radius: 999px; transition: background .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(16, 30, 54, .35); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 数据接口面板 */
.data-api-lead { margin: 0 0 12px; }
.data-api-guest { border: 1px dashed var(--line); border-radius: 8px; padding: 16px; text-align: center; background: var(--gray-bg); }
.data-api-guest p { margin: 0 0 10px; }
.data-api-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.data-import-text { width: 100%; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 13px; line-height: 1.5; resize: vertical; }
.data-import-result { font-size: 13px; }
.data-import-ok { background: var(--green-bg); border: 1px solid #bfe3cf; color: #14532d; border-radius: 8px; padding: 9px 12px; }
.data-import-bad { background: var(--danger-bg); border: 1px solid var(--danger-line); color: #8a1f1f; border-radius: 8px; padding: 9px 12px; margin-top: 6px; }
.data-search { width: 100%; max-width: 240px; margin-top: 0; }
.data-list { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.data-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.data-row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.data-row-main .g { font-weight: 700; font-size: 14px; }
.data-row-main .a, .data-row-main .c { font-size: 12px; color: var(--ink-2); }
.data-row-meta { flex: 1 1 auto; font-size: 12px; color: var(--ink-2); line-height: 1.5; word-break: break-word; }
.data-row-acts { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.data-empty { color: var(--ink-2); font-size: 13px; text-align: center; padding: 14px 0; }
.data-editor { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--gray-bg); }
.data-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.data-editor-acts { display: inline-flex; gap: 6px; }
.data-editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.data-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.data-field-label { font-size: 12px; color: var(--ink-2); }
.data-field .req { color: #c0392b; margin-left: 2px; }

/* 开放 API 折叠区 */
.openapi-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--gray-bg); }
.openapi-box > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.openapi-box[open] > summary { margin-bottom: 10px; }
.openapi-box .ws-sub { border-top: none; padding-top: 0; margin-top: 0; }

/* 设置 / 数据接口 移动端 */
@media (max-width: 767px) {
  .btn-nut { width: 32px; height: 32px; margin-right: 6px; }
  .settings-body { padding: 2px 14px 14px; }
  .settings-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .settings-actions { width: 100%; }
  .lib-scope { width: 100%; }
  .lib-scope-btn { flex: 1 1 0; text-align: center; min-height: 36px; }
  .data-search { max-width: none; }
  .data-row { flex-wrap: wrap; }
  .data-row-acts { width: 100%; }
  .data-editor-grid { grid-template-columns: 1fr 1fr; }
  .data-api-actions .btn-mini, .data-api-actions .btn-ghost-small { flex: 1 1 auto; }
}

/* ---------------- 黑夜模式：整站配色覆盖 ---------------- */
body.theme-dark {
  color-scheme: dark;
  --bg: #10151c;
  --panel: #19212b;
  --ink: #e4ebf3;
  --ink-2: #9aa8b8;
  --line: #2b3542;
  --accent: #4d9fe0;
  --accent-dark: #3b87c6;
  --green: #4cc98a;
  --green-bg: #16321f;
  --gray-bg: #1f2836;
  --warn-bg: #3a2c15;
  --warn-line: #7a5a24;
  --danger-bg: #3a1f21;
  --danger-line: #7d3c3c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 14px rgba(0, 0, 0, .35);
}

/* 白底面板与控件 */
body.theme-dark .card,
body.theme-dark .auth-card,
body.theme-dark .cart-btn,
body.theme-dark .sol-inp { background: #1b2734; color: #dbe6f2; border-color: #2c3d50; }
body.theme-dark .btn-ghost-small,
body.theme-dark .btn-user,
body.theme-dark .btn-user:hover,
body.theme-dark .local-card,
body.theme-dark .lib-group,
body.theme-dark .lib-item,
body.theme-dark .announce-card,
body.theme-dark .fstd-card,
body.theme-dark .tol-common-item,
body.theme-dark .tol-tpl-card,
body.theme-dark .tol-tab,
body.theme-dark .rev-card,
body.theme-dark .od-card,
body.theme-dark .scene-opt,
body.theme-dark .clarify-opt,
body.theme-dark .state-select,
body.theme-dark .tpl-btn,
body.theme-dark .ws-chip,
body.theme-dark .tag-disabled,
body.theme-dark .fav-btn.on,
body.theme-dark .faq-arrow,
body.theme-dark .faq-go,
body.theme-dark .dc-ring,
body.theme-dark .api-token-list code { background: var(--panel); border-color: var(--line); }

/* 浅灰底块 */
body.theme-dark .lib-group-head,
body.theme-dark .api-ep-head,
body.theme-dark .announce-list,
body.theme-dark .proc-tips,
body.theme-dark .comp-table thead th,
body.theme-dark .cmp-table thead th,
body.theme-dark .calc-kv th,
body.theme-dark .reverse-table th,
body.theme-dark .tol-batch-table th,
body.theme-dark .reason-head,
body.theme-dark .reason-head:hover,
body.theme-dark .cand-reason,
body.theme-dark .cmp-table td.dim,
body.theme-dark .comp-table td.dim,
body.theme-dark .tol-yield-track { background: #202a37; color: var(--ink); }

/* 浅蓝底信息块 */
body.theme-dark .summary-card,
body.theme-dark .reasoning-summary,
body.theme-dark .clarify-card,
body.theme-dark .scene-card,
body.theme-dark .scene-ctx,
body.theme-dark .scene-opt.on,
body.theme-dark .conflict-card.info,
body.theme-dark .comp-chip.main,
body.theme-dark .local-tab.active,
body.theme-dark .auth-tab.active,
body.theme-dark .btn-ghost-small.active,
body.theme-dark .tpl-btn:hover,
body.theme-dark .lib-item.active,
body.theme-dark .lib-group-head:hover,
body.theme-dark .faq-q:hover,
body.theme-dark .drive-total,
body.theme-dark .calc-extbox,
body.theme-dark .equiv-note { background: #1e2f42; }

/* 绿色语义块 */
body.theme-dark .calc-verdict.ok,
body.theme-dark .od-ok,
body.theme-dark .proc-btn,
body.theme-dark .proc-btn:hover,
body.theme-dark .std-chip,
body.theme-dark .tag-active,
body.theme-dark .od-drop,
body.theme-dark .cost-badge.中低 { background: var(--green-bg); color: var(--green); }

/* 黄色 / 橙色语义块 */
body.theme-dark .conflict-card.warn,
body.theme-dark .gap-box,
body.theme-dark .state-note,
body.theme-dark .scene-sub,
body.theme-dark .cand-alt,
body.theme-dark .fav-btn:hover,
body.theme-dark .cost-badge.高,
body.theme-dark .cost-badge.中高,
body.theme-dark .cost-badge.很高 { background: #3a3320; color: #e8c877; }
body.theme-dark .od-risk { background: #3a2a18; color: #e8b98a; }

/* 输入类控件 */
body.theme-dark #queryInput,
body.theme-dark #queryInput:focus,
body.theme-dark .lib-search,
body.theme-dark .lib-search:focus,
body.theme-dark .wf-item input,
body.theme-dark .wf-item input:focus,
body.theme-dark .wf-item select,
body.theme-dark .wf-item select:focus,
body.theme-dark .ws-sub textarea,
body.theme-dark .ws-sub textarea:focus,
body.theme-dark .sol-drive input[type="number"],
body.theme-dark .sol-drive input[type="number"]:focus,
body.theme-dark .sol-drive select,
body.theme-dark .sol-drive select:focus,
body.theme-dark .dc-ring input,
body.theme-dark .dc-ring select,
body.theme-dark .auth-input,
body.theme-dark .api-token-list code { background: #141b24; color: var(--ink); border-color: var(--line); }
body.theme-dark #queryInput::placeholder,
body.theme-dark .lib-search::placeholder,
body.theme-dark .auth-input::placeholder,
body.theme-dark .ws-sub textarea::placeholder { color: #6d7c8c; }

/* 原先写死的深色文字改为浅色 */
body.theme-dark .cand-grade,
body.theme-dark .scene-q-title,
body.theme-dark .hero-title,
body.theme-dark .mot-h { color: var(--ink); }
body.theme-dark .cand-reason,
body.theme-dark .reason-head,
body.theme-dark .rs-line,
body.theme-dark .source-line,
body.theme-dark .local-item .hq,
body.theme-dark .redeem-quota,
body.theme-dark .fstd-card .fc-rows,
body.theme-dark .proc-item .pi-param,
body.theme-dark .proc-tips,
body.theme-dark .announce-body,
body.theme-dark .announce-list p,
body.theme-dark .faq-a,
body.theme-dark .trust-text,
body.theme-dark .equiv-sub,
body.theme-dark .comp-chip,
body.theme-dark .calc-kv th,
body.theme-dark .ds-badge,
body.theme-dark .drive-li-main b,
body.theme-dark .drive-li-price,
body.theme-dark .drive-total { color: #c7d3e0; }
body.theme-dark .faq-q,
body.theme-dark .api-path,
body.theme-dark .calc-verdict.info,
body.theme-dark .comp-chip.main,
body.theme-dark .conflict-card.info,
body.theme-dark .summary-card,
body.theme-dark .clarify-card h3,
body.theme-dark .scene-name,
body.theme-dark .scene-ctx-title,
body.theme-dark .scene-ctx-list,
body.theme-dark .compare-reco,
body.theme-dark .announce-new { color: #8fc4ee; }
body.theme-dark .support-msg-reply,
body.theme-dark .data-import-ok,
body.theme-dark .reason-item.pass,
body.theme-dark .calc-verdict.ok,
body.theme-dark .od-ok,
body.theme-dark .proc-btn,
body.theme-dark .tag-active,
body.theme-dark .od-drop { color: #8fe0b0; }
body.theme-dark .data-import-bad,
body.theme-dark .err-text,
body.theme-dark .reason-item.fail,
body.theme-dark .sol-del,
body.theme-dark .calc-verdict.bad { color: #f0a3a3; }
body.theme-dark .support-tag.open,
body.theme-dark .gap-box,
body.theme-dark .cost-badge.高,
body.theme-dark .cost-badge.很高 { color: #e8b98a; }
body.theme-dark mark { background: #4a3d18; color: #f0e2b8; }
body.theme-dark .hero { background: linear-gradient(135deg, #1b2431, #22303f); border-color: var(--line); }
body.theme-dark .hero-badge { background: #23364a; color: #8fc4ee; }
body.theme-dark .switch-track { background: #46536a; }
body.theme-dark .od-risk { border-color: #5a4222; }
body.theme-dark .data-import-ok,
body.theme-dark .lib-mine { border-color: #2c6b46; }
body.theme-dark .api-code { background: #0d1117; }
