/* =========================================================================
   Yb(BH3CH3)3THF 晶体模拟 · 测试文档
   移动优先 · 自适应布局（Mobile / Tablet / Desktop）
   断点：<768 手机 › 768–1023 平板 › ≥1024 桌面
   ========================================================================= */

/* ---------------------------------------------------------------- 1. 设计令牌 */
:root {
  --bg: #0e1116;
  --bg-soft: #11161d;
  --panel: #161c24;
  --panel-2: #1a222c;
  --panel-3: #1f2833;
  --line: #263040;
  --line-soft: #1c242f;

  --text: #e5ebf4;
  --text-2: #a9b5c5;
  --muted: #778394;

  --accent: #3fd0b0;
  --accent-soft: rgba(63, 208, 176, .12);
  --blue: #6ba8ff;
  --blue-soft: rgba(107, 168, 255, .12);
  --purple: #a98bf5;
  --purple-soft: rgba(169, 139, 245, .12);
  --ok: #57c98d;
  --ok-soft: rgba(87, 201, 141, .12);
  --warn: #e8b26a;
  --warn-soft: rgba(232, 178, 106, .13);
  --err: #ef6b73;
  --err-soft: rgba(239, 107, 115, .13);

  --radius: 12px;
  --radius-sm: 8px;

  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas,
          "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          Roboto, Helvetica, Arial, sans-serif;

  --app-bar-h: 54px;
  --bottom-nav-h: 58px;
  --pad: 14px;

  --side-w: 264px;
  --content-max: 1180px;
}

/* ---------------------------------------------------------------- 2. 基础 */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  overflow-wrap: break-word;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { line-height: 1.35; }
p { margin: 0; }

code, kbd, pre, samp { font-family: var(--mono); }

img, svg { max-width: 100%; }

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(63, 208, 176, .28); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b3644; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4859; }

/* 无障碍隐藏 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 跳转链接 */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  background: var(--accent);
  color: #04120f;
  font-weight: 700;
  font-size: 13px;
  transition: top .18s ease;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* ---------------------------------------------------------------- 3. 顶栏 */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--app-bar-h);
  padding: 0 10px 0 var(--pad);
  background: rgba(14, 17, 22, .92);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: -6px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--panel); color: var(--text); }
.icon-btn:active { background: var(--panel-2); }
.icon-btn svg { width: 21px; height: 21px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.logo {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: #04120f;
  background: linear-gradient(150deg, #57e0c0, #2ba98d);
  box-shadow: 0 0 0 1px rgba(63, 208, 176, .3), 0 6px 16px -10px rgba(63, 208, 176, .9);
}

.brand-text { min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 640;
  letter-spacing: .1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text h1 sub { font-size: .74em; }

.brand-text p {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #04120f;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, background .15s, border-color .15s, color .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(.5px); }

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2);
}
.btn.ghost:hover { border-color: #37465a; color: var(--text); background: var(--panel); }

/* ---------------------------------------------------------------- 4. 抽屉导航 */
.drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(84vw, 320px);
  padding: calc(var(--app-bar-h) + 8px) 14px calc(24px + env(safe-area-inset-bottom, 0px));
  background: #10151c;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform .24s cubic-bezier(.4, 0, .2, 1), visibility .24s;
  -webkit-overflow-scrolling: touch;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}
.drawer-head span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 9, 13, .62);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s, visibility .22s;
}
.backdrop.is-open { opacity: 1; visibility: visible; }

.drawer .side-block { margin-bottom: 20px; }

.side-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-list a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14.5px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .13s, color .13s, border-color .13s;
}
.nav-list a svg { width: 19px; height: 19px; flex: none; opacity: .8; }
.nav-list a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-list a[aria-current="page"] {
  background: var(--accent-soft);
  border-color: rgba(63, 208, 176, .28);
  color: var(--accent);
  font-weight: 600;
}
.nav-list a[aria-current="page"] svg { opacity: 1; }

.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
}
.cat-list a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.cat-list .c {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 20px;
  padding: 0 8px;
  line-height: 18px;
}

/* 搜索框 */
.field { display: block; }
.search {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search::placeholder { color: #5f6b7c; }
.search:focus {
  border-color: rgba(63, 208, 176, .55);
  box-shadow: 0 0 0 3px rgba(63, 208, 176, .1);
}
.search-hint { margin-top: 6px; font-size: 11.5px; color: var(--muted); padding-left: 2px; }

.meta-note code {
  display: inline-block;
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(63, 208, 176, .2);
  border-radius: 5px;
  padding: 1px 7px;
}
.meta-note p { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.meta-note p code { font-size: 11px; padding: 0 4px; background: var(--panel-2); border-color: var(--line); color: var(--text-2); }

.legend .lg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 4px;
}

/* ---------------------------------------------------------------- 5. 底部标签栏 */
.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: stretch;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(13, 17, 22, .94);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-top: 1px solid var(--line);
}

.bottom-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 2px 4px;
  color: #7c8899;
  font-size: 10px;
  letter-spacing: .1px;
  text-decoration: none;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a svg { width: 21px; height: 21px; stroke-width: 1.7; }
.bottom-nav a span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottom-nav a:active { background: rgba(255, 255, 255, .04); }
.bottom-nav a[aria-current="page"] { color: var(--accent); }
.bottom-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
}

/* ---------------------------------------------------------------- 6. 主体布局 */
.layout { display: block; }

.sidebar { display: none; }

.content {
  padding: 18px var(--pad) 28px;
  max-width: var(--content-max);
  margin-inline: auto;
  min-width: 0;
}

.content:focus { outline: none; }

/* ---------------------------------------------------------------- 7. 页头 */
.page-head { margin-bottom: 16px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 5px;
}

.page-head h2 {
  margin: 0 0 8px;
  font-size: clamp(21px, 5.6vw, 26px);
  font-weight: 660;
  letter-spacing: -.3px;
}

.page-head .lede {
  margin: 0;
  max-width: 76ch;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.8;
}

h3.sec {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin: 28px 0 12px;
  font-size: 15.5px;
  font-weight: 640;
  letter-spacing: .1px;
}
h3.sec::before {
  content: "";
  align-self: center;
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
  margin-right: 1px;
}
h3.sec .hint {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
h3.sec:first-of-type { margin-top: 4px; }

p.body { color: var(--text-2); margin: 0 0 12px; max-width: 84ch; }

/* ---------------------------------------------------------------- 8. 卡片 / KPI */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.kpi {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px 12px;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--accent);
  opacity: .55;
}

.kpi .k-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  letter-spacing: .3px;
  color: var(--muted);
}

.kpi .k-value {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.4px;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi .k-value .unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
  letter-spacing: 0;
}

.kpi .k-note {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
}

/* 徽标 */
.badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.lit  { color: var(--blue);   background: var(--blue-soft);   border-color: rgba(107, 168, 255, .28); }
.badge.test { color: var(--accent); background: var(--accent-soft); border-color: rgba(63, 208, 176, .28); }
.badge.calc { color: var(--purple); background: var(--purple-soft); border-color: rgba(169, 139, 245, .28); }
.badge.ok   { color: var(--ok);     background: var(--ok-soft);     border-color: rgba(87, 201, 141, .28); }
.badge.warn { color: var(--warn);   background: var(--warn-soft);   border-color: rgba(232, 178, 106, .3); }
.badge.err  { color: var(--err);    background: var(--err-soft);    border-color: rgba(239, 107, 115, .3); }
.badge.mute { color: var(--muted);  background: var(--panel-2);     border-color: var(--line); }

/* ---------------------------------------------------------------- 9. 摘要 */
.abstract {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 0 13px;
  background: linear-gradient(180deg, rgba(63, 208, 176, .06), rgba(63, 208, 176, .015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px 13px 0;
  margin-bottom: 16px;
}
.abstract::before {
  content: "";
  background: linear-gradient(180deg, var(--accent), rgba(63, 208, 176, .1));
  border-radius: 2px;
}
.abstract p { color: var(--text-2); font-size: 13.5px; line-height: 1.85; }

/* ---------------------------------------------------------------- 10. 表格 */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--panel);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }

td.num, th.num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
td.mono { font-family: var(--mono); font-size: 12.5px; }
td strong { color: var(--text); font-weight: 600; }
tr.hl td { background: rgba(63, 208, 176, .06); }

.tbl-note { font-size: 11.5px; color: var(--muted); margin: 7px 2px 0; line-height: 1.65; }

/* 横向滚动表（手机端保留表格形态，首列吸附） */
.table-wrap.scroll-x table { min-width: 620px; }
.table-wrap.scroll-x th:first-child,
.table-wrap.scroll-x td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: 1px 0 0 var(--line-soft);
}
.table-wrap.scroll-x thead th:first-child { background: var(--panel-2); }

/* 手机端堆叠表：每行变卡片，td 用 data-label 显示字段名 */
.stack thead { display: none; }
.stack tbody tr {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.stack tbody tr:last-child { border-bottom: none; }
.stack tbody td {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 3px 0;
  border: 0;
  font-size: 13px;
  text-align: right;
}
.stack tbody td::before {
  content: attr(data-label);
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .2px;
  text-align: left;
  padding-top: 1px;
}
.stack tbody td:empty { display: none; }
.stack tbody td.cell-main {
  display: block;
  text-align: left;
  padding-bottom: 6px;
  font-size: 13.5px;
  color: var(--text);
}
.stack tbody td.cell-main::before { display: none; }
.stack tbody td.cell-span { display: block; text-align: left; }
.stack tbody td.cell-span::before { display: none; }

/* 规格网格（晶胞参数等键值对） */
.spec-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.spec {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  background: var(--panel);
  font-size: 13px;
}
.spec .k { flex: none; width: 84px; color: var(--muted); font-size: 12.5px; }
.spec .v { flex: 1 1 auto; color: var(--text); font-family: var(--mono); font-size: 12.8px; }
.spec .badge { flex: none; }

/* ---------------------------------------------------------------- 11. 双栏 */
.cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
.cols.tight { gap: 10px; }

/* ---------------------------------------------------------------- 12. 清单 / 结论 */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.checklist li:last-child { border-bottom: none; }
.checklist .dot {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 3px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
}
.dot.ok   { background: var(--ok-soft);   color: var(--ok);   box-shadow: inset 0 0 0 1px rgba(87, 201, 141, .35); }
.dot.warn { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(232, 178, 106, .35); }
.dot.err  { background: var(--err-soft);  color: var(--err);  box-shadow: inset 0 0 0 1px rgba(239, 107, 115, .35); }
.checklist .ck-t { color: var(--text); }
.checklist .ck-n { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.55; }

.findings { display: grid; gap: 10px; }
.finding {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 0 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 12px 0;
}
.finding::before { content: ""; border-radius: 2px; background: var(--line); }
.finding.ok::before   { background: var(--ok); }
.finding.warn::before { background: var(--warn); }
.finding.err::before  { background: var(--err); }
.finding h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.finding p { font-size: 13px; color: var(--text-2); line-height: 1.75; }

/* ---------------------------------------------------------------- 13. 图表 */
.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px 8px;
}
.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.chart-head h4 { margin: 0; font-size: 13.5px; font-weight: 620; }
.chart-head .sub { font-size: 11px; color: var(--muted); font-family: var(--mono); text-align: right; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--text-2);
}
.chart-legend .sw {
  display: inline-block;
  width: 13px;
  height: 3px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: 3px;
}

svg.chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
svg.chart text { font-family: var(--mono); fill: #8b98a9; font-size: 12px; }
svg.chart .axis line, svg.chart .axis path { stroke: #2a3444; }
svg.chart .grid line { stroke: #1d2531; stroke-width: 1; }
svg.chart .series { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .series-area { opacity: .13; }

.chart-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}
.chart-tips b { color: var(--text-2); font-weight: 600; font-family: var(--mono); }

/* ---------------------------------------------------------------- 14. 分子视图 */
.viewer {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(120% 100% at 30% 0%, #182230 0%, #10151c 62%);
}
.viewer .stage {
  position: relative;
  aspect-ratio: 26 / 25;
}
.viewer .stage svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.viewer .stage svg.is-dragging { cursor: grabbing; }
.viewer .stage-hint {
  position: absolute;
  left: 11px;
  bottom: 8px;
  font-size: 10.5px;
  color: #66748a;
  font-family: var(--mono);
  pointer-events: none;
}
.viewer .legend-panel {
  border-top: 1px solid var(--line);
  padding: 11px 13px 13px;
  background: rgba(10, 14, 19, .45);
}
.viewer .legend-panel h5 {
  margin: 0 0 7px;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.atom-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 6px;
}
.atom-key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.atom-key i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.atom-key .rad { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.viewer .viewer-note { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

.viewer .ctl { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.viewer .ctl button {
  flex: 1 1 0;
  min-height: 36px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
}
.viewer .ctl button:hover { border-color: #3a4a5e; color: var(--text); }
.viewer .ctl button.on { background: var(--accent-soft); border-color: rgba(63, 208, 176, .4); color: var(--accent); }

/* ---------------------------------------------------------------- 15. 代码 */
.code-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #0c1015;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.code-head .right { display: flex; gap: 8px; align-items: center; }
.code-head button {
  min-height: 26px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.code-head button:hover { color: var(--accent); border-color: rgba(63, 208, 176, .4); }

pre.code {
  margin: 0;
  padding: 11px 12px;
  overflow-x: auto;
  font-size: 11.5px;
  line-height: 1.75;
  color: #c8d3e0;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
pre.code .c-cm { color: #5c7080; font-style: italic; }
pre.code .c-kw { color: #6ba8ff; }
pre.code .c-nm { color: #e8b26a; }
pre.code .c-st { color: #8fd6a8; }
pre.code .c-nu { color: #e0a3ff; }

/* ---------------------------------------------------------------- 16. 时间线 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, #35455a, #202a36 60%, rgba(38, 48, 64, .15));
}
.tl-item { position: relative; padding: 0 0 15px; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--panel-3);
  box-shadow: 0 0 0 1px var(--line), 0 0 0 4px var(--bg);
}
.tl-item.ok::before   { background: var(--ok);   box-shadow: 0 0 0 1px rgba(87, 201, 141, .5), 0 0 0 4px var(--bg); }
.tl-item.warn::before { background: var(--warn); box-shadow: 0 0 0 1px rgba(232, 178, 106, .5), 0 0 0 4px var(--bg); }
.tl-item.err::before  { background: var(--err);  box-shadow: 0 0 0 1px rgba(239, 107, 115, .5), 0 0 0 4px var(--bg); }

.tl-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.tl-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tl-tag {
  font-size: 11px;
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 6px;
}
.tl-msg { font-size: 13px; color: var(--text-2); line-height: 1.72; }

/* ---------------------------------------------------------------- 17. 问题 / 待办 */
.issues { display: grid; gap: 9px; }
.issue {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
}
.issue-top { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 5px; }
.issue-id { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.issue-title { flex: 1 1 100%; order: 2; font-size: 13.5px; font-weight: 620; color: var(--text); }
.issue-top .badge { order: 1; }
.issue p { font-size: 12.8px; color: var(--text-2); line-height: 1.72; }
.issue p + p { margin-top: 4px; }
.issue .fix::before { content: "处理："; color: var(--muted); font-size: 11.5px; }

.todo { display: grid; gap: 8px; }
.todo-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-areas: "p t" ". d";
  gap: 2px 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.todo-row .p {
  grid-area: p;
  align-self: start;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  border-radius: 4px;
  padding: 1px 0;
}
.p.P1 { color: var(--err);  background: var(--err-soft); }
.p.P2 { color: var(--warn); background: var(--warn-soft); }
.p.P3 { color: var(--muted); background: var(--panel-2); }
.todo-row .t { grid-area: t; font-size: 13.5px; color: var(--text); font-weight: 600; }
.todo-row .d { grid-area: d; font-size: 12px; color: var(--muted); line-height: 1.55; }
.todo-row .who { display: none; }

/* ---------------------------------------------------------------- 18. 文件索引 */
.files-toolbar {
  display: flex;
  gap: 7px;
  margin-bottom: 11px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.files-toolbar::-webkit-scrollbar { display: none; }

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .13s, color .13s, background .13s;
}
.pill:hover { border-color: #3a4a5e; color: var(--text); }
.pill[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: rgba(63, 208, 176, .4);
  color: var(--accent);
}
.pill .n { font-family: var(--mono); font-size: 10.5px; opacity: .8; }

.files-count { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-bottom: 9px; }

.file-table td.name { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.file-table .path {
  font-family: var(--mono);
  font-size: 11px;
  color: #6f7d90;
  word-break: break-all;
  margin-top: 3px;
  cursor: pointer;
}
.file-table .path:hover { color: var(--accent); }
.file-table .sub-desc { font-size: 12.5px; color: var(--text-2); }
.file-table .empty { text-align: center; color: var(--muted); padding: 26px; }

mark {
  background: rgba(232, 178, 106, .22);
  color: #f0d3a5;
  border-radius: 3px;
  padding: 0 2px;
}

/* ---------------------------------------------------------------- 19. 其它 */
.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.72;
}
.callout .ic { font-size: 13px; line-height: 1.5; }
.callout.warn { border-color: rgba(232, 178, 106, .3); background: rgba(232, 178, 106, .05); }
.callout.warn .ic { color: var(--warn); }
.callout.info { border-color: rgba(107, 168, 255, .28); background: rgba(107, 168, 255, .05); }
.callout.info .ic { color: var(--blue); }

.src-list { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.src-list li { margin-bottom: 6px; }
.src-list li::marker { color: var(--muted); font-family: var(--mono); }

.footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px var(--pad) 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  max-width: var(--content-max);
  margin: 0 auto;
}

/* 仅宽屏 / 仅窄屏元素 */
.only-lg { display: none !important; }
.only-sm { display: inline-flex; }

@media (min-width: 1024px) {
  .only-lg { display: inline-flex !important; }
  .only-sm { display: none !important; }
}

/* 打印版（all.html）不需要底部导航留白 */
body[data-mode="all"] { padding-bottom: 0; }
body[data-mode="all"] .content { padding: 20px 22px 48px; }

.fade-in { animation: fadeIn .26s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

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

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 8px);
  z-index: 90;
  max-width: min(86vw, 520px);
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid #35455a;
  background: #1f2833;
  color: var(--text);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: 0 12px 32px -14px #000;
  transition: opacity .2s, transform .2s, visibility .2s;
}
.toast.is-open { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* =========================================================================
   平板：≥768px
   ========================================================================= */
@media (min-width: 768px) {
  :root { --pad: 22px; }

  body { font-size: 14.5px; }

  .app-bar { height: 58px; padding: 0 16px; }
  .brand .logo { width: 34px; height: 34px; font-size: 13.5px; }
  .brand-text h1 { font-size: 15.5px; }
  .brand-text p { font-size: 11.5px; }

  .content { padding: 22px var(--pad) 32px; }

  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .kpi .k-value { font-size: 21px; }

  .viewer { grid-template-columns: minmax(0, 1fr) 196px; }
  .viewer .stage { aspect-ratio: 3 / 2; }
  .viewer .legend-panel {
    border-top: none;
    border-left: 1px solid var(--line);
  }
  .atom-keys { flex-direction: column; gap: 5px; }
  .viewer .ctl { flex-direction: column; }
  .viewer .ctl button { flex: none; width: 100%; }

  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .todo-row { grid-template-columns: 38px 1fr auto; grid-template-areas: "p t who" ". d d"; }
  .todo-row .who {
    display: inline-block;
    grid-area: who;
    align-self: start;
    font-size: 11px;
    color: var(--text-2);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1px 9px;
    white-space: nowrap;
  }

  .footer { flex-direction: row; justify-content: space-between; }
}

/* =========================================================================
   桌面：≥1024px —— 侧边栏版式
   ========================================================================= */
@media (min-width: 1024px) {
  :root { --pad: 32px; }

  body {
    font-size: 14px;
    padding-bottom: 0;
  }

  .bottom-nav { display: none; }
  #btn-menu { display: none; }

  .layout {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    align-items: start;
  }

  .sidebar {
    display: block;
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    overflow-y: auto;
    padding: 18px 14px 40px;
    border-right: 1px solid var(--line);
    background: var(--bg-soft);
  }

  .sidebar .side-block { margin-bottom: 22px; }

  .content { padding: 26px var(--pad) 64px; }

  .cards { grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 11px; }

  .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .stack thead { display: table-header-group; }
  .stack tbody tr { display: table-row; border: 0; padding: 0; }
  .stack tbody td {
    display: table-cell;
    text-align: left;
    padding: 8px 13px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12.8px;
  }
  .stack tbody td::before { display: none; }
  .stack tbody td.cell-main,
  .stack tbody td.cell-span { display: table-cell; text-align: left; }
  .stack tbody tr:hover td { background: rgba(255, 255, 255, .022); }
  .table-wrap.scroll-x table { min-width: 0; }
  .table-wrap.scroll-x th:first-child,
  .table-wrap.scroll-x td:first-child { position: static; box-shadow: none; }

  .viewer .stage { aspect-ratio: 3 / 2; }

  .issue-top .issue-title { flex: 1 1 auto; order: 0; }

  .footer { padding: 14px var(--pad); }
}

/* =========================================================================
   打印 / PDF
   ========================================================================= */
@media print {
  :root { --pad: 0px; }

  html, body {
    background: #fff !important;
    color: #111 !important;
    padding: 0 !important;
    font-size: 10.5pt;
  }

  .app-bar, .drawer, .backdrop, .bottom-nav, .sidebar,
  .files-toolbar, .files-count, .viewer .ctl, .code-head button,
  .skip-link, .toast { display: none !important; }

  .layout { display: block !important; }
  .content { max-width: none; padding: 0; }

  .card, .kpi, .chart-card, .table-wrap, .issue, .finding,
  .abstract, .todo-row, .code-card, .viewer, .spec-grid {
    break-inside: avoid;
    border-color: #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .page-head h2, h3.sec, .finding h4, .issue-title,
  .kpi .k-value, .spec .v { color: #111 !important; }

  .lede, p.body, .finding p, .issue p, tbody td,
  .tl-msg, .kpi .k-note, .spec .k { color: #333 !important; }

  thead th { background: #f2f2f2 !important; color: #444 !important; }
  .badge { border-color: #bbb !important; background: #f6f6f6 !important; color: #444 !important; }

  svg.chart text { fill: #444 !important; }
  svg.chart .grid line { stroke: #e6e6e6 !important; }

  .footer { color: #666 !important; border-color: #ccc !important; }
  a { color: #111 !important; text-decoration: none !important; }

  .stack thead { display: table-header-group !important; }
  .stack tbody tr { display: table-row !important; }
  .stack tbody td { display: table-cell !important; padding: 5px 8px !important; }
  .stack tbody td::before { display: none !important; }

  .page-break { break-before: page; }
}
