/* ==========================================================================
   商品参数库 · 规格索引
   设计取向：技术仪器 / 零件目录。深色导航轨 + 冷灰纸面。
   字体：Bahnschrift 承担数字与标题，正文用微软雅黑，数据用等宽。
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #eef2ee;
  --bg-2: #e7ece6;
  --surface: #fbfcf8;
  --surface-2: #f3f6f0;
  --surface-3: #e9eee6;
  --ink: #111713;
  --ink-2: #34413a;
  --muted: #617068;
  --faint: #8a978f;
  --line: #d6ded5;
  --line-strong: #b9c6ba;
  --accent: #d4482c;
  --accent-ink: #a3331d;
  --accent-soft: #f7e3dc;
  --accent-line: #e7b8a8;
  --teal: #1d6c61;
  --teal-soft: #dff0eb;
  --best: #176b45;
  --best-bg: #e4f3e9;
  --worst: #a92d2d;
  --worst-bg: #f8e3e1;
  --warn: #8a5a10;
  --warn-bg: #fbf0d9;
  --rail-bg: #111814;
  --rail-ink: #edf2ec;
  --rail-muted: #94a69a;
  --rail-line: rgba(237, 242, 236, .13);
  --rail-soft: rgba(237, 242, 236, .07);
  --rail-accent: #ff7a55;
  --font-body: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  --font-display: "Bahnschrift", "DIN Alternate", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
  --wrap: 1280px;
  --rail-w: 264px;
  --tap: 40px;
  --r: 2px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c110e;
  --bg-2: #101712;
  --surface: #151d17;
  --surface-2: #111811;
  --surface-3: #1b261e;
  --ink: #e7efe7;
  --ink-2: #c3d0c5;
  --muted: #91a297;
  --faint: #6c7d71;
  --line: #28372c;
  --line-strong: #3a4c3e;
  --accent: #ff6f4a;
  --accent-ink: #ff9b7f;
  --accent-soft: #2a1a15;
  --accent-line: #5a2e22;
  --teal: #7ac9ba;
  --teal-soft: #122a25;
  --best: #61d394;
  --best-bg: #10271c;
  --worst: #ff8b83;
  --worst-bg: #2a1515;
  --warn: #e7b65c;
  --warn-bg: #2a2112;
  --rail-bg: #080d0a;
  --rail-ink: #e7efe7;
  --rail-muted: #879a8d;
  --rail-line: rgba(231, 239, 231, .12);
  --rail-soft: rgba(231, 239, 231, .06);
  --rail-accent: #ff7a55;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c110e;
    --bg-2: #101712;
    --surface: #151d17;
    --surface-2: #111811;
    --surface-3: #1b261e;
    --ink: #e7efe7;
    --ink-2: #c3d0c5;
    --muted: #91a297;
    --faint: #6c7d71;
    --line: #28372c;
    --line-strong: #3a4c3e;
    --accent: #ff6f4a;
    --accent-ink: #ff9b7f;
    --accent-soft: #2a1a15;
    --accent-line: #5a2e22;
    --teal: #7ac9ba;
    --teal-soft: #122a25;
    --best: #61d394;
    --best-bg: #10271c;
    --worst: #ff8b83;
    --worst-bg: #2a1515;
    --warn: #e7b65c;
    --warn-bg: #2a2112;
    --rail-bg: #080d0a;
    --rail-ink: #e7efe7;
    --rail-muted: #879a8d;
    --rail-line: rgba(231, 239, 231, .12);
    --rail-soft: rgba(231, 239, 231, .06);
    --rail-accent: #ff7a55;
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dim { color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface);
}

/* ---------- 外壳 ---------- */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

/* ---------- 左侧导航轨 ---------- */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px 18px;
  background: var(--rail-bg);
  color: var(--rail-ink);
  border-right: 1px solid var(--rail-line);
  overflow-y: auto;
}
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--rail-ink); min-width: 0; }
.brand:hover { color: var(--rail-ink); }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: var(--rail-accent);
  color: #1a0c08;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.rail-close { display: none; }
.rail .rail-close { display: none; }

.rail-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 2px;
}
.rail-search-ico {
  position: absolute; left: 10px;
  width: 16px; height: 16px;
  color: var(--rail-muted);
  pointer-events: none;
}
.rail-search-ico svg { width: 100%; height: 100%; }
.rail-search input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 34px;
  background: var(--rail-soft);
  border: 1px solid var(--rail-line);
  border-radius: var(--r);
  color: var(--rail-ink);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.rail-search input::placeholder { color: var(--rail-muted); }
.rail-search input:focus {
  border-color: var(--rail-accent);
  background: rgba(255, 255, 255, .1);
}
.rail-search kbd {
  position: absolute; right: 9px;
  border-color: var(--rail-line);
  background: transparent;
  color: var(--rail-muted);
  pointer-events: none;
}

.rail-label {
  margin: 4px 2px -6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--rail-muted);
  letter-spacing: .08em;
}
.cat-nav { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; overflow: auto; margin: 0 -8px; padding: 0 8px; }
.cat-link {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  color: var(--rail-muted);
  transition: background .15s, color .15s, border-color .15s;
}
.cat-link:hover { color: var(--rail-ink); background: var(--rail-soft); }
.cat-link.active { color: var(--rail-ink); background: var(--rail-soft); border-left-color: var(--rail-accent); }
.cat-ico { width: 18px; height: 18px; display: inline-flex; color: currentColor; }
.cat-ico svg { width: 100%; height: 100%; }
.cat-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--rail-muted);
  font-variant-numeric: tabular-nums;
}
.cat-link.active .cat-count { color: var(--rail-accent); }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rail-line); }
.rail-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rail-user .avatar { width: 30px; height: 30px; flex: 0 0 auto; }
.rail-user-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rail-user-main strong { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user-main span { font-family: var(--font-mono); font-size: 10px; color: var(--rail-muted); }
.rail-user-links { margin-left: auto; display: flex; flex-direction: column; gap: 1px; text-align: right; }
.rail-user-links a { font-size: 11px; color: var(--rail-muted); }
.rail-user-links a:hover { color: var(--rail-accent); }

/* ---------- 主工作区 ---------- */
.workspace { min-width: 0; display: flex; flex-direction: column; }
.workbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 34px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { color: var(--faint); font-family: var(--font-mono); }
.crumb > span:last-child { overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.work-utils { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
}
.menu-btn svg, .mobile-search svg { width: 18px; height: 18px; }
.mobile-search { display: none; }
.main {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 34px 34px 128px;
}

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.icon-btn svg { width: 17px; height: 17px; }
.rail .icon-btn { border-color: var(--rail-line); color: var(--rail-muted); }
.rail .rail-close { display: none; }
.work-utils .mobile-search { display: none; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}
.chip.pick { color: var(--ink-2); background: var(--surface); }
.chip.pick button {
  border: 0; padding: 0 0 0 2px; background: transparent;
  color: var(--muted); font-size: 14px; line-height: 1;
}
.chip.pick button:hover { color: var(--accent); }

/* ---------- 首页：规格索引 ---------- */
.index-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 44px;
  padding: 18px 0 30px;
  border-bottom: 2px solid var(--ink);
}
.kicker, .page-kicker {
  margin-bottom: 12px;
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
}
.index-title {
  max-width: 14ch;
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 58px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -.04em;
}
.index-lede {
  max-width: 50ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}
.index-figure {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 4px;
  border-left: 1px solid var(--line);
  padding-left: 28px;
}
.figure-n {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 600;
  line-height: .82;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
}
.figure-l {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.6;
}
.index-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 0;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.index-body { padding-top: 28px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.section-head p { color: var(--muted); font-size: 11.5px; }

.cat-index { border-top: 1px solid var(--line); }
.cat-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: background .15s, padding .15s;
}
.cat-row:hover { background: var(--surface-2); padding-left: 12px; padding-right: 0; }
.cat-row-icon { width: 24px; height: 24px; color: var(--accent); }
.cat-row-icon svg { width: 100%; height: 100%; }
.cat-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cat-row-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.cat-row-keys { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-row-count {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.cat-row-arrow { width: 16px; height: 16px; color: var(--faint); }
.cat-row-arrow svg { width: 100%; height: 100%; }
.cat-row:hover .cat-row-arrow { color: var(--accent); }

/* ---------- 页面头 / 列表 ---------- */
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 20px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(27px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -.035em;
}
.page-sub { margin-top: 7px; color: var(--muted); font-size: 12.5px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.table-scroll { overflow: auto; max-height: calc(100vh - 240px); }
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--surface); border-radius: 10px; }

.grid { width: 100%; min-width: 880px; border-collapse: collapse; text-align: left; }
.grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  white-space: nowrap;
}
.grid td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr.picked { background: var(--accent-soft); }
.grid th.sel, .grid td.sel { width: 42px; padding-left: 14px; padding-right: 0; }
.grid input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.grid td.num { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.empty { color: var(--faint); }
.prod { display: flex; align-items: center; gap: 12px; min-width: 260px; color: var(--ink); }
.prod:hover { color: var(--accent-ink); }
.prod-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prod-title { font-size: 13px; font-weight: 600; line-height: 1.4; }
.prod-meta { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px;
  color: var(--muted); font-family: var(--font-mono); font-size: 10.5px;
}
.list-foot .btn { font-family: var(--font-body); }

/* ---------- 缩略图 ---------- */
.thumb {
  width: 44px; height: 44px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ico { display: grid; place-items: center; color: var(--accent); }
.thumb.ico svg { width: 22px; height: 22px; }
.thumb.lg { width: 100%; height: auto; aspect-ratio: 4 / 3; border-color: var(--line-strong); }
.thumb.lg img { object-fit: contain; }

/* ---------- 全库搜索 ---------- */
.search-groups { border-top: 1px solid var(--line); }
.search-group { padding: 18px 0 4px; border-bottom: 1px solid var(--line); }
.search-group-head {
  display: flex; align-items: center; gap: 9px;
  padding: 0 2px 10px;
}
.search-group-head .cat-ico { color: var(--accent); width: 17px; height: 17px; }
.search-group-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.group-count {
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-family: var(--font-mono); font-size: 10px;
}
.search-group-head a { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.search-group-head a:hover { color: var(--accent); }
.search-results { display: flex; flex-direction: column; }
.search-result {
  display: flex; align-items: center; gap: 13px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.search-result:hover { background: var(--surface-2); color: var(--ink); }
.result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.result-meta { color: var(--muted); font-size: 10.5px; }
.result-arrow { margin-left: auto; width: 15px; height: 15px; color: var(--faint); flex: 0 0 auto; }
.result-arrow svg { width: 100%; height: 100%; }
.search-result:hover .result-arrow { color: var(--accent); }
mark { padding: 0 1px; background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- 详情 ---------- */
.crumb a { color: var(--muted); }
.detail-head {
  display: grid;
  grid-template-columns: minmax(280px, 36%) minmax(0, 1fr);
  gap: 38px;
  align-items: start;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--ink);
}
.detail-img { background: var(--surface); border: 1px solid var(--line); padding: 10px; }
.detail-info { min-width: 0; padding-top: 2px; }
.detail-meta { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.detail-title {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.03em;
}
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.variants { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 11.5px; }
.variant-link { padding: 1px 7px; border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); }
.variant-link:hover { border-color: var(--accent-line); color: var(--accent-ink); }
.keyfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  margin-top: 24px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.fact { padding: 9px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.fact-k { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-v { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }

.section { margin-top: 34px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.section-title::before { content: ""; width: 3px; height: 15px; background: var(--accent); }
.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.param-row {
  display: grid;
  grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: baseline;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.param-row.filler { visibility: hidden; }
.param-name { color: var(--muted); font-size: 11.5px; }
.param-value { font-family: var(--font-mono); font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.param-value.is-empty { color: var(--faint); }
.param-note { grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; }

/* ---------- 对比 ---------- */
.cmp { width: 100%; min-width: 760px; border-collapse: collapse; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 11px 12px; vertical-align: top; }
.cmp thead th { background: var(--surface-2); border-bottom-color: var(--line-strong); }
.cmp .rowhead {
  position: sticky; left: 0; z-index: 2;
  width: 168px; min-width: 168px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  text-align: left;
}
.cmp thead .rowhead { background: var(--surface-2); z-index: 3; }
.cmp .cmp-head { min-width: 190px; }
.cmp-head-in { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.cmp-title { font-size: 12px; font-weight: 600; color: var(--ink); }
.cmp-del { margin-top: 2px; }
.cmp-cell { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.cmp-cell.best { color: var(--best); background: var(--best-bg); }
.cmp-cell.worst { color: var(--worst); background: var(--worst-bg); }
.cmp-cell.same { color: var(--muted); }
.arrow { margin-left: 3px; font-size: 9px; }
.dir { display: block; margin-top: 3px; color: var(--faint); font-size: 9px; }
.arrow-demo { color: var(--best); }
.arrow-demo.down { color: var(--worst); }

/* ---------- 对比条 ---------- */
.cmpbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--rail-bg);
  color: var(--rail-ink);
  border-top: 1px solid var(--rail-line);
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
}
.cmpbar.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.cmpbar-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  min-height: 62px;
  padding: 10px 34px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cmpbar-hint { font-family: var(--font-mono); font-size: 10.5px; color: var(--rail-muted); white-space: nowrap; }
.cmpbar-chips { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.cmpbar .chip { border-color: var(--rail-line); background: var(--rail-soft); color: var(--rail-ink); }
.cmpbar .chip button { color: var(--rail-muted); }
.cmpbar .btn-primary { margin-left: auto; }
.cmpbar .btn-quiet { color: var(--rail-muted); }
.cmpbar .btn-quiet:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- 反馈 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 82px;
  z-index: 80;
  transform: translate(-50%, 8px);
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--worst); color: var(--worst); }
.skeleton { padding: 48px 0; color: var(--muted); font-size: 12px; }
.alert { padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--warn); background: var(--warn-bg); color: var(--warn); font-size: 12px; }
.alert-error { border-left-color: var(--worst); background: var(--worst-bg); color: var(--worst); }
.db-alert {
  position: fixed; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: 80vw;
  padding: 8px 14px;
  border: 1px solid var(--worst);
  background: var(--worst-bg);
  color: var(--worst);
  font-size: 12px;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  min-height: 220px;
  padding: 34px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.empty-state .ico { width: 28px; height: 28px; color: var(--faint); }
.empty-state .ico svg { width: 100%; height: 100%; }

/* ==========================================================================
   管理后台 / 登录页
   ========================================================================== */
.admin-workbar { height: 58px; gap: 14px; }
.admin-workbar .brand { color: var(--ink); }
.admin-workbar .brand:hover { color: var(--accent-ink); }
.admin-workbar .brand-mark { width: 26px; height: 26px; font-size: 16px; }
.admin-workbar .brand-name { font-size: 15px; }
.admin-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs a {
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  border-radius: var(--r);
}
.admin-tabs a:hover { color: var(--ink); background: var(--surface-2); }
.admin-tabs a.active { color: var(--accent-ink); background: var(--accent-soft); }
.admin-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 12px;
}
.admin-user .who { color: var(--ink-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user a { color: var(--muted); }
.admin-user a:hover { color: var(--accent); }
.admin-main { max-width: 1080px; }
.admin-card { padding: 18px; }
.admin-head-actions { gap: 8px; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.hover, .drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.drop-title { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.drop-sub { font-size: 11px; color: var(--muted); }
.hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.log-status {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}
.log-status.success { color: var(--best); border-color: var(--best); background: var(--best-bg); }
.log-status.failed { color: var(--worst); border-color: var(--worst); background: var(--worst-bg); }
.log-status.partial { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.log-msg { color: var(--muted); font-size: 11px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-ua { color: var(--faint); font-size: 10px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-ok { border-left-color: var(--best); background: var(--best-bg); color: var(--best); }
.alert-warn { border-left-color: var(--warn); background: var(--warn-bg); color: var(--warn); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-k { color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; }
.stat-v { color: var(--ink); font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.stat-v-time { font-family: var(--font-mono); font-size: 13px; font-weight: 400; line-height: 1.6; letter-spacing: 0; overflow-wrap: anywhere; }
.stat-s { color: var(--faint); font-size: 10.5px; }

.who-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.who-cell .avatar { width: 26px; height: 26px; flex: 0 0 auto; font-size: 12px; }
.who-name { color: var(--ink); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; overflow-wrap: anywhere; }

.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.admin-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-search input {
  height: 34px;
  min-width: 280px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.admin-search input:focus { outline: none; border-color: var(--accent); }
.admin-toolbar-hint { font-size: 10.5px; }
.admin-login-table td { font-size: 12px; }
.admin-login-table .num { font-size: 11px; }
.admin-logins-table .log-msg { max-width: 220px; }

/* 登录页 */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card {
  width: min(400px, 100%);
  padding: 30px 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .06);
}
.auth-logo {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  margin-bottom: 18px;
  background: var(--rail-accent);
  color: #1a0c08;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}
.auth-card h1 { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.auth-sub { margin: 6px 0 20px; color: var(--muted); font-size: 12.5px; }
.auth-hint { margin: 12px 0 0; color: var(--faint); font-size: 10.5px; line-height: 1.6; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form input {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  font-size: 12.5px;
}
.auth-back { display: inline-block; margin-top: 16px; color: var(--muted); font-size: 11.5px; }
.auth-back:hover { color: var(--accent); }

@media (max-width: 820px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-tabs a { padding: 6px 7px; font-size: 11px; }
  .admin-user .who { display: none; }
  .admin-search input { min-width: 0; flex: 1 1 190px; }
}
@media (max-width: 560px) {
  .admin-workbar { padding: 0 12px; height: 54px; gap: 8px; }
  .admin-workbar .brand-name { display: none; }
  .admin-main { padding: 24px 16px 72px; }
  .admin-head-actions { width: 100%; }
  .stat { padding: 12px 12px; }
  .stat-v { font-size: 24px; }
  .stat-v-time { font-size: 11px; }
  .admin-toolbar { align-items: flex-start; flex-direction: column; }
  .admin-toolbar-hint { display: none; }
}

/* ---------- 移动端 ---------- */
.rail-scrim { display: none; }

@media (max-width: 1100px) {
  :root { --rail-w: 238px; }
  .main { padding-left: 26px; padding-right: 26px; }
  .workbar { padding-left: 26px; padding-right: 26px; }
  .index-head { gap: 24px; }
  .detail-head { gap: 24px; }
}

@media (max-width: 900px) {
  .shell { display: block; }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 292px; max-width: 88vw; height: auto;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .28);
  }
  body.rail-open .rail { transform: translateX(0); }
  .rail-close { display: inline-flex; }
  .rail .rail-close { display: inline-flex; }
  .work-utils .mobile-search { display: inline-flex; }
  .rail-scrim {
    display: block;
    position: fixed; inset: 0;
    z-index: 55;
    background: rgba(7, 12, 9, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s;
  }
  body.rail-open .rail-scrim { opacity: 1; pointer-events: auto; }
  .menu-btn, .mobile-search { display: inline-flex; }
  .workbar { height: 52px; padding: 0 18px; gap: 9px; }
  .main { padding: 24px 18px 126px; }
  .index-head { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .index-figure { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .index-title { max-width: 16ch; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .toolbar { align-self: flex-start; }
  .detail-head { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .detail-img { max-width: 420px; }
  .param-grid { grid-template-columns: 1fr; }
  .cmpbar-inner { padding: 9px 18px; flex-wrap: wrap; }
  .cmpbar-hint { width: 100%; }
  .cmpbar-chips { order: 3; width: 100%; }
}

@media (max-width: 600px) {
  .work-utils .icon-btn { width: 32px; height: 32px; }
  .main { padding-left: 14px; padding-right: 14px; }
  .workbar { padding-left: 14px; padding-right: 14px; }
  .index-title { font-size: 34px; }
  .figure-n { font-size: 58px; }
  .cat-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; min-height: 66px; }
  .cat-row-arrow { display: none; }
  .page-title { font-size: 27px; }
  .grid { min-width: 760px; }
  .grid th, .grid td { padding-left: 9px; padding-right: 9px; }
  .prod { min-width: 220px; }
  .search-result { gap: 10px; }
  .cmpbar-inner { padding-left: 14px; padding-right: 14px; }
  .cmpbar .btn-primary { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
