/* ===== SDS-PAGE-Calc 样式（独立一份；色板与科研导航站、GRAVYCalc 完全一致） =====
   本页主角是「几个带单位的数字输入 + 一张两列配方表 + 一段可打印的制备流程」：
   ① 所有数字用 tabular-nums，毫升与微升两列右对齐，方便照着量具读数；
   ② 参数区用自适应网格，窄屏一行一个字段；
   ③ 打印时只留配方表与制备流程，顶栏、输入区、说明区全部隐掉——实验台要的是那张纸。 */
:root {
  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;
  --text: #2c3e50;
  --text-sub: #7f8c9b;
  --border: #e8ebef;
  --accent: #7c5cd6;
  --accent-soft: rgba(124, 92, 214, .1);
  --accent-text: #fff;
  --danger: #e2544d;
  --ok: #2f9e5f;
  --shadow: 0 2px 8px rgba(30, 40, 60, .06);
  --bar-bg: #f7f8fa;
  --code-bg: #f4f6f9;
  --tag-bg: #eef2f7;
  --group-line: #dfe5ec;
}

html[data-theme="dark"] {
  --bg: #060a17;
  --bg-card: #0d1424;
  --bg-hover: #1a2336;
  --text: #dce3ec;
  --text-sub: #8794a8;
  --border: #1e2a44;
  --accent: #a78bfa;
  --accent-soft: rgba(167, 139, 250, .16);
  --danger: #ff6b64;
  --ok: #4ade80;
  --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  --bar-bg: #0a1120;
  --code-bg: #101a30;
  --tag-bg: #16213a;
  --group-line: #24334f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  transition: background .25s, color .25s;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .back { color: var(--accent); text-decoration: none; font-size: 14px; white-space: nowrap; }
.topbar .back:hover { text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-mark img { width: 26px; height: 26px; }
.brand-text h1 { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { font-size: 12px; color: var(--text-sub); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.icon-btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); }
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang-btn {
  border: none; background: var(--bg-card); color: var(--text-sub);
  padding: 6px 10px; font-size: 13px; cursor: pointer; text-decoration: none;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-btn.active { background: var(--accent); color: var(--accent-text); }

/* ===== 面板 ===== */
.sds { max-width: 1080px; margin: 0 auto; padding: 14px 16px 4px; }
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.sec-head h2 { font-size: 16px; margin-right: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: 13.5px;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }

/* ===== 参数区 ===== */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { color: var(--text); font-weight: 600; font-size: 13px; }
.field-ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field-ctrl input, .field-ctrl select {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 7px; padding: 5px 8px; font-size: 14px; font-variant-numeric: tabular-nums;
}
.field-ctrl input { width: 96px; }
.field-ctrl input.short { width: 78px; }
.field-ctrl select { cursor: pointer; max-width: 130px; }
.field-ctrl input:focus, .field-ctrl select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
/* 数字框后面的单位（% / ml）当成控件的一部分，不占独立一行 */
.unit { font-size: 12.5px; color: var(--text-sub); }
.hint { font-size: 12px; color: var(--text-sub); }

/* ===== 配方表 ===== */
.notice { font-size: 13.5px; color: var(--text); background: var(--accent-soft); border-radius: 8px; padding: 7px 11px; margin-bottom: 10px; }
.notice.bad { background: rgba(226, 84, 77, .1); color: var(--danger); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data th {
  background: var(--bar-bg); color: var(--text-sub); font-weight: 600; font-size: 12px;
  position: sticky; top: 0; z-index: 1;
}
table.data th.center, table.data td.center { text-align: center; }
table.data th.left, table.data td.left { text-align: left; }
table.data th.right, table.data td.right { text-align: right; }
table.data td.num { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data td.empty { text-align: center; color: var(--text-sub); padding: 18px 10px; white-space: normal; }
table.data tr.sep-line td { border-top: 1px solid var(--group-line); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.note { font-size: 12px; color: var(--text-sub); margin-top: 8px; }
/* 配方表里 Tris 行下方的小字：两种 Tris 浓度各自标注在自己的列里 */
table.data td .sub { display: block; font-size: 11px; color: var(--text-sub); white-space: normal; line-height: 1.35; }

/* ===== 制备流程 ===== */
.proto-title { font-size: 14px; margin-bottom: 10px; }
.proto-block { margin-bottom: 12px; }
.proto-block h3 { font-size: 13.5px; margin-bottom: 4px; color: var(--accent); }
.proto-block ol { margin-left: 22px; font-size: 13.5px; }
.proto-block li { margin-bottom: 3px; }
#footBox .foot { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ===== 说明区（SEO 主体） ===== */
.doc { max-width: 1080px; margin: 10px auto 40px; padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc h2:first-child { margin-top: 0; }
.doc p { font-size: 14px; margin-bottom: 8px; }
.doc ul, .doc ol { margin: 0 0 8px 20px; font-size: 14px; }
.doc li { margin-bottom: 5px; }
.doc ul li b { display: inline-block; margin-right: 4px; }
.doc dl.faq dt { font-weight: 600; font-size: 14px; margin-top: 10px; }
.doc dl.faq dd { font-size: 14px; color: var(--text-sub); margin-left: 0; }
.doc .rel-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.doc .rel-links a {
  display: inline-block; padding: 4px 12px; background: var(--tag-bg);
  border-radius: 999px; color: var(--accent); text-decoration: none; font-size: 13px;
}
.doc .rel-links a:hover { background: var(--accent-soft); text-decoration: none; }
.doc .ver { font-size: 12px; color: var(--text-sub); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg-card); padding: 8px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .topbar .back { font-size: 13px; }
  .brand { flex: 1 1 auto; }
  .brand-text p { display: none; }
  .spacer { display: none; }
  .sds { padding: 10px 10px 0; }
  .panel { padding: 12px; }
  .sec-head h2 { font-size: 15px; }
  .field-grid { gap: 12px; }
  table.data { font-size: 13px; }
}

/* ===== 打印：只留配方与流程，一张纸贴在胶盒上 ===== */
@media print {
  body { background: #fff; color: #111; }
  .topbar, #panel-input, #panel-select, .doc, .toast, .btn-row, .lang-switch { display: none !important; }
  .sds { max-width: none; padding: 0; }
  .panel { border: none; box-shadow: none; padding: 0 0 10px; margin-bottom: 8px; }
  .notice { background: none; padding: 0 0 8px; }
  .table-wrap { border: 1px solid #999; }
  table.data th { background: #f0f0f0; color: #111; position: static; }
  table.data td .sub { color: #444; }
  #footBox .foot { color: #333; }
}
