/* ============================================================================
   检测台账 · 样式
   设计取向：长时间录入，低刺激底色 + 高对比表格 + 清晰的选区块
   主题：深色（默认） / 日间浅色，通过 <html data-theme="light"> 切换
   ========================================================================== */

/* ---------------------------------------------------------------- 深色主题 */
:root {
  --bg: #0f1319;
  --bg-soft: #161c25;
  --bg-raised: #1c2330;
  --line: #2a3342;
  --line-soft: #212936;
  --text: #dde4ee;
  --text-dim: #8b97a9;
  --text-faint: #5d6879;
  --accent: #4c8dff;
  --accent-soft: rgba(76, 141, 255, 0.14);
  --ok: #3fbf7f;
  --warn: #e0a94a;
  --err: #ef5f5f;
  --pos: #ffd166;
  --row-h: 28px;
  --head-h: 54px;

  /* 表格专用色（两套主题分别定义，避免写死颜色） */
  --row-bg: #0f1319;
  --row-bg-alt: #11161e;
  --row-hover: #1a2230;
  --auto-bg: #141a23;
  --auto-bg-alt: #121821;
  --auto-text: #8b97a9;
  --head-bg: #1c2330;
  --head-hover: #232c3b;
  --head-sel: #26344a;
  --rownum-bg: #161c25;
  --rownum-sel-bg: #26344a;
  --cell-err-bg: rgba(239, 95, 95, 0.13);
  --cell-err-ring: rgba(239, 95, 95, 0.45);
  --cell-err-text: #ffd7d7;
  /* 错误行整行底色 */
  --row-err-tint: rgba(239, 95, 95, 0.07);
  --row-err-tint-auto: rgba(239, 95, 95, 0.10);
  --row-err-tint-hover: rgba(239, 95, 95, 0.12);
  --row-warn-tint: rgba(224, 169, 74, 0.06);
  --row-warn-tint-hover: rgba(224, 169, 74, 0.11);
  --cell-warn-bg: rgba(224, 169, 74, 0.10);
  --cell-warn-ring: rgba(224, 169, 74, 0.35);
  --cell-warn-text: #ffe9bf;
  --editor-bg: #ffffff;
  --editor-text: #10151d;
  --handle-ring: #ffffff;
  --scroll-thumb: #39445a;
  --dropdown-bg: #1c2330;
  --dropdown-line: #3a465c;
  --dropdown-sel: rgba(76, 141, 255, 0.14);
  --toast-bg: #2a3446;
  --toast-line: #3d4b63;
  --toast-warn-bg: #45371d;
  --toast-warn-line: #6b5528;
  --shadow-strong: 0 10px 34px rgba(0, 0, 0, .55);
  --shadow-panel: 0 16px 48px rgba(0, 0, 0, .6);
  /* 十字高亮色（可在界面里改） */
  --spot-color: rgba(255, 196, 61, 0.10);
  --spot-strong: #e0a94a;
  /* 日期/批次 分组边框色 */
  --group-day: rgba(76, 141, 255, 0.55);
  --group-batch: rgba(140, 155, 180, 0.45);
  --sidebar-bg: #0e1218;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- 日间主题 */
:root[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-soft: #ffffff;
  --bg-raised: #ffffff;
  --line: #d7dee8;
  --line-soft: #e6ebf2;
  --text: #1f2937;
  --text-dim: #4b5563;
  --text-faint: #6b7280;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;
  --pos: #b45309;

  --row-bg: #ffffff;
  --row-bg-alt: #fafbfd;
  --row-hover: #eef4ff;
  --auto-bg: #f1f4f9;
  --auto-bg-alt: #edf1f7;
  --auto-text: #5b6878;
  --head-bg: #eef2f7;
  --head-hover: #e3eaf4;
  --head-sel: #d7e5fd;
  --rownum-bg: #f1f4f9;
  --rownum-sel-bg: #d7e5fd;
  --cell-err-bg: #fdecec;
  --cell-err-ring: #f3b4b4;
  --cell-err-text: #9b1c1c;
  --row-err-tint: #fef7f7;
  --row-err-tint-auto: #fbecec;
  --row-err-tint-hover: #fce6e6;
  --row-warn-tint: #fefcf5;
  --row-warn-tint-hover: #fdf6e3;
  --cell-warn-bg: #fdf6e3;
  --cell-warn-ring: #eed49a;
  --cell-warn-text: #8a5a00;
  --editor-bg: #ffffff;
  --editor-text: #10151d;
  --handle-ring: #ffffff;
  --scroll-thumb: #c2cbd8;
  --dropdown-bg: #ffffff;
  --dropdown-line: #cfd8e5;
  --dropdown-sel: rgba(37, 99, 235, 0.10);
  --toast-bg: #263241;
  --toast-line: #3a475a;
  --toast-warn-bg: #5b3d09;
  --toast-warn-line: #7a5312;
  --shadow-strong: 0 10px 30px rgba(15, 23, 42, .18);
  --shadow-panel: 0 16px 44px rgba(15, 23, 42, .22);
  --spot-color: rgba(255, 193, 7, 0.16);
  --spot-strong: #b45309;
  --group-day: rgba(37, 99, 235, 0.55);
  --group-batch: rgba(100, 116, 139, 0.45);
  --sidebar-bg: #f4f6fa;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow: hidden;
}

body {
  overflow: hidden;
}

/* ---------------------------------------------------------------- 左右分栏骨架 */
.lg-app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.lg-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 模块容器：每个模块一个独立宿主 */
.lg-module-container {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lg-module-root {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lg-module-root[hidden] { display: none; }

/* 侧栏分组标题 */
.lg-sb-group {
  padding: 12px 10px 4px;
  font-size: 10px;
  letter-spacing: .6px;
  color: var(--text-faint);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.lg-sidebar.is-collapsed .lg-sb-group {
  padding: 8px 0 2px;
  text-align: center;
  font-size: 9px;
  opacity: .55;
}

/* ---------------------------------------------------------------- 通用模块页 */
.lg-mod-inner { padding: 20px 24px; }
.lg-mod-head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 650; color: var(--text); }
.lg-mod-head p { margin: 0 0 14px; font-size: 12px; color: var(--text-dim); }

.lg-mat-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.lg-mat-tab {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.lg-mat-tab:hover { background: var(--head-hover); color: var(--text); }
.lg-mat-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.lg-mat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--text);
}
.lg-mat-table th {
  text-align: left;
  padding: 7px 10px;
  background: var(--head-bg);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.lg-mat-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.lg-mat-table tbody tr:hover td { background: var(--row-hover); }
.lg-mat-table tr.is-low td { background: var(--row-warn-tint); }
.lg-mat-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.lg-mat-table .strong { font-weight: 700; }
.lg-mat-table .pos { color: var(--ok); }
.lg-mat-table .neg { color: var(--err); }

.lg-mat-low {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--warn);
  color: #fff;
  font-size: 9.5px;
  font-style: normal;
  font-weight: 700;
}

.lg-mat-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  background: var(--accent-soft);
  color: var(--accent);
}
.lg-mat-tag.t-in, .lg-mat-tag.t-ret { background: rgba(34, 177, 112, .16); color: var(--ok); }
.lg-mat-tag.t-out, .lg-mat-tag.t-scrap { background: rgba(239, 95, 95, .16); color: var(--err); }
.lg-mat-tag.t-adj { background: rgba(224, 169, 74, .18); color: var(--warn); }
.lg-mat-tag.t-maintain { background: rgba(224, 169, 74, .18); color: var(--warn); }
.lg-mat-tag.t-calibrate { background: rgba(150, 120, 235, .18); color: #9b87f5; }
.lg-mat-tag.t-fault { background: rgba(239, 95, 95, .16); color: var(--err); }
.lg-mat-tag.t-reserve { background: var(--accent-soft); color: var(--accent); }
.lg-mat-tag.t-use { background: rgba(34, 177, 112, .16); color: var(--ok); }

.lg-mat-del {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
}
.lg-mat-del:hover { color: var(--err); }

.lg-mat-card {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}
.lg-mat-card.ok { border-color: rgba(34, 177, 112, .4); }
.lg-mat-card.bad { border-color: rgba(239, 95, 95, .5); background: var(--row-err-tint); }
.lg-mat-code {
  margin-left: 8px;
  font-size: 10px;
  color: var(--text-faint);
  font-family: Consolas, monospace;
}

.lg-mat-empty { margin-top: 6vh; }

.lg-ins-busy, .lg-ins-free {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10.5px;
}
.lg-ins-busy { background: rgba(239, 95, 95, .16); color: var(--err); }
.lg-ins-free { background: rgba(34, 177, 112, .16); color: var(--ok); }

/* 设置页 */
.lg-set-block { margin-bottom: 24px; }
.lg-set-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.lg-set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}
.lg-set-note { margin: 0 0 10px; font-size: 11.5px; color: var(--text-faint); }
.lg-set-modrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--text);
}
.lg-set-modrow span:first-child { flex: 1 1 auto; }
.lg-btn.danger { color: var(--err); }
.lg-btn.danger:hover { background: rgba(239, 95, 95, .12); }

/* 视图切换 */
.lg-view { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; overflow: hidden; }
.lg-view.is-active { display: flex; }
.lg-view-inner { flex: 1 1 auto; overflow: auto; padding: 24px; }

/* 占位页 */
.lg-placeholder { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.lg-ph-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 26px;
}
.lg-placeholder h2 { margin: 0 0 8px; font-size: 17px; font-weight: 650; color: var(--text); }
.lg-placeholder p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.7; color: var(--text-dim); }
.lg-placeholder .lg-ph-note { font-size: 11.5px; color: var(--text-faint); margin-bottom: 16px; }

/* ---------------------------------------------------------------- 左侧菜单栏 */
.lg-sidebar {
  flex: 0 0 auto;
  width: 186px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  transition: width .16s ease;
  overflow: hidden;
}
.lg-sidebar.is-collapsed { width: 56px; }

.lg-sb-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft);
  min-height: 58px;
}
.lg-avatar {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #2f6fe0, #1a4ba8);
  color: #fff;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(47, 111, 224, .32);
}
.lg-sb-title { min-width: 0; display: flex; flex-direction: column; }
.lg-sb-title b {
  font-size: 13px; font-weight: 650; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lg-sb-title span {
  font-size: 10.5px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.lg-sb-nav { flex: 1 1 auto; padding: 8px 6px; display: flex; flex-direction: column; gap: 2px; }

.lg-sb-item,
.lg-sb-collapse {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.lg-sb-item:hover,
.lg-sb-collapse:hover { background: var(--head-hover); color: var(--text); }
.lg-sb-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.lg-sb-icon {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 13px;
  line-height: 1;
}
.lg-sb-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.lg-sb-foot { padding: 6px; border-top: 1px solid var(--line-soft); }
.lg-sb-collapse { color: var(--text-faint); font-size: 11.5px; }

/* 折叠态：只留图标，文字隐藏 */
.lg-sidebar.is-collapsed .lg-sb-title,
.lg-sidebar.is-collapsed .lg-sb-label { display: none; }
.lg-sidebar.is-collapsed .lg-sb-head { justify-content: center; padding: 12px 6px; }
.lg-sidebar.is-collapsed .lg-sb-item,
.lg-sidebar.is-collapsed .lg-sb-collapse { justify-content: center; padding: 9px 6px; }
.lg-sidebar.is-collapsed .lg-sb-collapse .lg-sb-icon { transform: rotate(180deg); }

/* ---------------------------------------------------------------- 顶栏 */
.lg-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.lg-brand { display: flex; align-items: center; gap: 10px; }

.lg-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #2f6fe0, #1a4ba8);
  font-weight: 700; font-size: 17px; color: #fff;
  box-shadow: 0 2px 10px rgba(47, 111, 224, .35);
}

.lg-brandtext h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: .5px; }
.lg-brandtext p { margin: 1px 0 0; font-size: 11px; color: var(--text-dim); }

.lg-week { display: flex; align-items: center; gap: 6px; }

.lg-field { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }

.lg-field input[type="date"] {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 12px;
  font-family: inherit;
  color-scheme: dark;
}

.lg-tilde { color: var(--text-faint); }

.lg-topactions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- 按钮 */
.lg-btn {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.lg-btn:hover { background: var(--head-hover); border-color: var(--line); }
.lg-btn:active { transform: translateY(1px); }
.lg-btn.primary {
  background: linear-gradient(180deg, #3d7ff0, #2f68d4);
  border-color: #2f68d4; color: #fff; font-weight: 600;
}
.lg-btn.primary:hover { background: linear-gradient(180deg, #4b8bff, #3a76e6); }
.lg-btn.ghost { background: transparent; }
.lg-btn.ghost:hover { background: var(--bg-raised); }
.lg-btn.sm { padding: 4px 10px; font-size: 12px; }

.lg-save { font-size: 11px; color: var(--text-faint); }
.lg-save.ok { color: var(--ok); }
.lg-save.err { color: var(--err); }

/* 主题切换按钮 */
.lg-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
}
.lg-theme-icon { font-size: 13px; line-height: 1; }
.lg-theme-label { font-size: 12px; }
.lg-caret { font-size: 9px; opacity: .8; margin-left: 2px; }

/* ---------------------------------------------------------------- 统计条 */
.lg-stats {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  overflow: hidden;
}

.lg-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 7px 16px;
  border-right: 1px solid var(--line-soft);
  min-width: 84px;
}
.lg-stat.grow { flex: 1; min-width: 200px; border-right: 1px solid var(--line-soft); }
.lg-stat:last-child { border-right: 0; }

.lg-stat-k { font-size: 10px; color: var(--text-faint); letter-spacing: .3px; }
.lg-stat-v { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.lg-stat-v.is-pos { color: var(--pos); }
.lg-stat-v.is-err { color: var(--err); }
.lg-stat-v.is-warn { color: var(--warn); }
.lg-stat-v.is-filtered { color: var(--accent); }

.lg-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.lg-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.lg-chip b { color: var(--text); font-weight: 650; margin-right: 3px; }
.lg-cats:empty::after { content: '暂无数据'; font-size: 10px; color: var(--text-faint); }

.lg-badge {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 22px;
  padding: 0 8px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lg-badge.is-ok { background: rgba(63, 191, 127, .14); color: var(--ok); }
.lg-badge.is-error { background: rgba(239, 95, 95, .16); color: var(--err); }
:root[data-theme="light"] .lg-badge.is-ok { background: #e7f7ee; color: #146c3a; }
:root[data-theme="light"] .lg-badge.is-error { background: #fdeaea; color: #b91c1c; }

/* ---------------------------------------------------------------- 工具条 */
.lg-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.lg-tools { display: flex; align-items: center; gap: 6px; }
.lg-div { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

.lg-filter { display: flex; align-items: center; gap: 6px; }

.lg-select, .lg-input {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  color-scheme: dark;
}
.lg-select:focus, .lg-input:focus { border-color: var(--accent); }
.lg-input { width: 150px; }

.lg-hints {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.lg-hints kbd {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 10px;
  font-family: inherit;
  color: var(--text-dim);
}
.lg-dot { color: var(--accent); }

/* ---------------------------------------------------------------- 表格区 */
.lg-main {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

.lg-grid-host {
  position: absolute;
  inset: 0;
  overflow: auto;
  outline: none;
  scrollbar-color: var(--scroll-thumb) var(--bg);
}
.lg-grid-host::-webkit-scrollbar { width: 12px; height: 12px; }
.lg-grid-host::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; border: 3px solid var(--bg); }
.lg-grid-host::-webkit-scrollbar-corner { background: var(--bg); }

.lg-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: max-content;      /* 由各列 width 之和决定，配合 table-layout:fixed 不被内容撑开 */
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 表头 */
.lg-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-raised);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
  padding: 0;
  height: var(--head-h);
  min-height: var(--head-h);
  white-space: normal;
  vertical-align: middle;
  text-align: left;
  user-select: none;
}

.lg-corner {
  width: 46px;
  min-width: 46px;
  position: sticky;
  left: 0;
  z-index: 7 !important;
  background: var(--bg-raised) !important;
  text-align: center !important;
  color: var(--text-faint);
  font-size: 10px;
  cursor: pointer;
  border-right: 1px solid var(--line) !important;
}

.lg-hcell {
  padding: 4px 8px !important;
  cursor: pointer;
  transition: background .1s;
  vertical-align: middle;
  text-align: center;
}
.lg-hcell:hover { background: var(--head-hover) !important; }
.lg-hcell.is-sel { background: var(--head-sel) !important; box-shadow: inset 0 -2px 0 var(--accent); }

/* 标题优先换行显示，不再省略号截断；最长两行，超出才截断 */
.lg-htitle {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lg-hletter {
  display: block;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: .4px;
  margin-top: 2px;
  white-space: nowrap;
}
.lg-hcell.is-auto .lg-htitle { color: var(--text-dim); }

/* 行 */
.lg-table tbody tr { height: var(--row-h); }
.lg-table tbody tr:hover td { background: var(--row-hover); }

.lg-cell {
  padding: 0 7px;
  height: var(--row-h);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  background: var(--row-bg);
  vertical-align: middle;
}

.lg-table tbody tr:nth-child(even) .lg-cell { background: var(--row-bg-alt); }
.lg-table tbody tr:nth-child(even):hover .lg-cell { background: var(--row-hover); }

.lg-cell.is-auto {
  color: var(--auto-text);
  background: var(--auto-bg) !important;
  font-size: 11.5px;
}
.lg-table tbody tr:nth-child(even) .lg-cell.is-auto { background: var(--auto-bg-alt) !important; }

.lg-cell.type-ct { text-align: center; padding-right: 4px; font-variant-numeric: tabular-nums; }
.lg-cell.type-number { text-align: center; }

.lg-cell.is-multiline .lg-v {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 行号 */
.lg-rownum {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 46px;
  min-width: 46px;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.lg-rownum.is-sel { background: var(--rownum-sel-bg); color: var(--accent); font-weight: 700; }
/* 错误 / 提示行：整行左侧粗色条 + 行号变色 + 淡底色，一眼能找到 */
.lg-table tbody tr.has-error > .lg-rownum {
  box-shadow: inset 5px 0 0 var(--err);
  color: #fff;
  background: var(--err) !important;
  font-weight: 800;
}
.lg-table tbody tr.has-error > .lg-cell {
  background: var(--row-err-tint) !important;
}
.lg-table tbody tr.has-error > .lg-cell.is-auto {
  background: var(--row-err-tint-auto) !important;
}
.lg-table tbody tr.has-error:hover > .lg-cell {
  background: var(--row-err-tint-hover) !important;
}

.lg-table tbody tr.has-warn > .lg-rownum {
  box-shadow: inset 5px 0 0 var(--warn);
  color: #fff;
  background: var(--warn) !important;
  font-weight: 800;
}
.lg-table tbody tr.has-warn > .lg-cell {
  background: var(--row-warn-tint) !important;
}
.lg-table tbody tr.has-warn:hover > .lg-cell {
  background: var(--row-warn-tint-hover) !important;
}
/* 错误行里的具体错误格：加粗描边，最醒目 */
.lg-table tbody tr.has-error > .lg-cell.cell-error {
  box-shadow: inset 0 0 0 2px var(--err);
  font-weight: 700;
}

/* 校验着色 */
.lg-cell.cell-error {
  background: var(--cell-err-bg) !important;
  box-shadow: inset 0 0 0 1px var(--cell-err-ring);
  color: var(--cell-err-text);
}
.lg-cell.cell-warn {
  background: var(--cell-warn-bg) !important;
  box-shadow: inset 0 0 0 1px var(--cell-warn-ring);
  color: var(--cell-warn-text);
}
.lg-cell.is-positive { color: var(--pos); font-weight: 650; }
.lg-cell.is-cut { opacity: .45; }

/* ---- 混检大行的子行表现 ---- */
.lg-table tbody tr.is-sub.is-group-start > .lg-rownum {
  background: var(--rownum-sel-bg);
  color: var(--accent);
  font-weight: 700;
  vertical-align: middle;
  text-align: center;
}
/* 大行共享单元格：跨子行合并后内容垂直居中 */
.lg-table tbody tr.is-sub.is-group-start > td.is-groupcell {
  vertical-align: middle;
  background: var(--row-bg);
}
/* 子行独立的单元格（送检单位/样品信息）保持顶部对齐，方便多行文本 */
.lg-table tbody tr.is-sub > td.lg-cell:not(.is-groupcell) {
  vertical-align: middle;
}
.lg-table tbody tr:nth-child(even).is-sub.is-group-start > td.is-groupcell {
  background: var(--row-bg-alt);
}
/* 组内最后一行加粗下边框，把大行隔开 */
.lg-table tbody tr.is-group-end > td { border-bottom: 1px solid var(--line); }
/* 子行（非首行）左侧用色条暗示从属关系 */
.lg-table tbody tr.is-group-branch > .lg-cell:first-of-type {
  box-shadow: inset 2px 0 0 var(--line);
}

/* 列宽可拖拽 */
.lg-hcell { position: relative; }
.lg-colresize {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 6;
}
.lg-colresize:hover { background: var(--accent); opacity: .5; }

/* 编辑态 */
.lg-cell.is-editing { padding: 0; overflow: visible; position: relative; z-index: 8; }
.lg-editor {
  width: 100%;
  height: var(--row-h);
  min-height: var(--row-h);
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: var(--editor-bg);
  color: var(--editor-text);
  font: inherit;
  font-size: 12px;
  padding: 0 6px;
  outline: none;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .5);
  resize: none;
  position: relative;
  z-index: 9;
  font-variant-numeric: tabular-nums;
}
textarea.lg-editor {
  height: auto;
  min-height: 72px;
  padding: 5px 6px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- 选区覆盖层 */
.lg-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.lg-sel {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 2px;
  background: var(--accent-soft);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
}

.lg-active {
  position: absolute;
  background: rgba(76, 141, 255, .10);
  pointer-events: none;
}

.lg-fillhandle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border: 1.5px solid var(--handle-ring);
  border-radius: 1.5px;
  cursor: crosshair;
  pointer-events: auto;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.lg-fillhandle:hover { background: #77aaff; }

/* 填充拖拽进行中：隐藏手柄、锁定光标 */
body.is-filling { cursor: crosshair !important; user-select: none; }
body.is-filling .lg-fillhandle { opacity: .45; }

/* 列宽拖拽进行中 */
body.is-resizing { cursor: col-resize !important; user-select: none; }
body.is-resizing .lg-colresize { background: var(--accent); opacity: .6; }

.lg-fillghost {
  position: absolute;
  border: 1.5px dashed var(--accent);
  background: rgba(76, 141, 255, .08);
  pointer-events: none;
}

/* ---------------------------------------------------------------- 十字高亮（聚光灯） */
.lg-spot {
  position: absolute;
  pointer-events: none;
  background: var(--spot-color);
  border-radius: 2px;
}
/* 行带在下、列带在上，重叠处叠加更明显 */
.lg-spot-row { z-index: 0; }
.lg-spot-col { z-index: 1; }
.lg-hcell.is-spot { box-shadow: inset 0 -2px 0 var(--spot-strong); }
.lg-hcell.is-spot .lg-htitle { color: var(--spot-strong); }

/* ---------------------------------------------------------------- 下拉候选 */
.lg-dropdown {
  position: fixed;
  z-index: 9999;
  max-height: 260px;
  overflow: auto;
  background: var(--bg-raised);
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 7px;
  box-shadow: var(--shadow-strong);
  padding: 4px;
  min-width: 140px;
  font-size: 12px;
}
.lg-dd-item {
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.lg-dd-item:hover, .lg-dd-item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
/* 精确匹配项：加个小勾，方便直接回车选中 */
.lg-dd-item.is-exact::after {
  content: '✓';
  margin-left: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}
/* 关键词高亮 */
.lg-dd-hit {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 2px;
  font-weight: 700;
  padding: 0 1px;
}
.lg-dd-empty { padding: 8px 9px; color: var(--text-faint); font-size: 11px; }

/* ---------------------------------------------------------------- 提示浮层 */
.lg-toast {
  position: fixed;
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 12px;
  box-shadow: var(--shadow-strong);
  z-index: 10000;
  pointer-events: none;
  border: 1px solid var(--toast-line);
}
.lg-toast.is-warn { background: var(--toast-warn-bg); border-color: var(--toast-warn-line); }
.lg-toast.is-error { background: #7f1d1d; border-color: #991b1b; }

/* ---------------------------------------------------------------- 状态栏
   已移除 footer.lg-status：它显示的单元格地址和值，顶部的编辑栏
   （A1 + 内容）已经完整显示，重复且占掉一行高度。
   .lg-spacer 保留 —— 其他工具栏还在用它占位。 */
.lg-spacer { flex: 1; }

/* ---------------------------------------------------------------- 筛选面板 */
.lg-filter { display: flex; align-items: center; gap: 6px; }

.lg-filter-badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.lg-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.lg-filter-panel {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow: auto;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 10px;
  box-shadow: var(--shadow-panel);
  z-index: 10002;
  font-size: 12px;
}

.lg-fp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.lg-fp-head strong { font-size: 13px; }
.lg-fp-tip { color: var(--text-faint); font-size: 11px; }
.lg-fp-tip b { color: var(--accent); }
.lg-fp-x {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.lg-fp-x:hover { color: var(--text); }

.lg-fp-rows { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.lg-fp-empty { color: var(--text-faint); font-size: 12px; padding: 8px 0; }

.lg-fp-row { display: flex; align-items: center; gap: 6px; }
.lg-fp-row .lg-select { flex: 0 0 auto; }
.lg-fp-row .lg-select[data-role="col"] { width: 108px; }
.lg-fp-row .lg-select[data-role="op"] { width: 84px; }
.lg-fp-val { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.lg-fp-val .lg-input.sm { flex: 1 1 auto; min-width: 80px; }
.lg-fp-val .lg-input.sm[data-role="v2"] { flex: 0 1 90px; }
.lg-fp-del {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
}
.lg-fp-del:hover { color: var(--err); border-color: var(--err); }

.lg-fp-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
}
.lg-fp-preview { font-size: 11.5px; color: var(--text-dim); }
.lg-fp-preview.is-ok { color: var(--ok); }
.lg-fp-preview.is-bad { color: var(--err); }
.lg-fp-foot .lg-spacer { flex: 1; }

.lg-input.sm { padding: 4px 8px; font-size: 12px; }

/* ---------------------------------------------------------------- 右键菜单 */
.lg-ctx {
  position: fixed;
  z-index: 10003;
  min-width: 190px;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
  padding: 5px;
  font-size: 12px;
}
.lg-ctx-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.lg-ctx-item:hover { background: var(--accent-soft); }
.lg-ctx-item.is-danger:hover { background: rgba(239, 95, 95, .14); color: var(--err); }
.lg-ctx-item.is-disabled { opacity: .4; cursor: default; }
.lg-ctx-key { margin-left: auto; font-size: 10.5px; color: var(--text-faint); }
.lg-ctx-arrow { margin-left: auto; color: var(--text-faint); }
.lg-ctx-sep { height: 1px; background: var(--line-soft); margin: 4px 6px; }

.lg-ctx-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -5px;
  min-width: 190px;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
  padding: 5px;
}
.lg-ctx-item:hover > .lg-ctx-sub { display: block; }

/* 十字高亮按钮与设置面板 */
.lg-spot-btn {
  position: relative;
  padding-left: 20px !important;
}
.lg-spot-btn::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--spot-dot, var(--text-faint));
  opacity: .45;
}
.lg-spot-btn.is-active::before { opacity: 1; }

.lg-spot-row-toggle { margin: 10px 0; font-size: 12px; }
.lg-spot-row-toggle label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.lg-spot-swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.lg-spot-swatch {
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  opacity: .75;
}
.lg-spot-swatch.is-on { outline: 2px solid var(--text); opacity: 1; }

/* 分组表头（如 CT值 横跨 4 列） */
.lg-hgroup {
  background: var(--head-bg);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  padding: 0 6px;
  height: 26px;
  vertical-align: middle;
}
/* 双行表头：第一行贴顶，第二行紧随其后 */
.lg-table thead tr.lg-hrow-1 th { top: 0; height: 26px; }
.lg-table thead tr.lg-hrow-2 th { top: 26px; }
.lg-hcell.is-subhead { border-top: 0; }
/* 普通单行表头保持原高度 */
.lg-table thead tr.lg-hrow-single th { height: var(--head-h); }

/* ---------------------------------------------------------------- 顶部编辑栏 */
.lg-editorbar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 4px 16px 4px 0;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  min-height: 34px;
}

.lg-fx-addr {
  display: grid;
  place-items: center;
  min-width: 92px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
  border-top: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-fx-icon {
  display: grid;
  place-items: center;
  width: 26px;
  font-size: 11px;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text-faint);
  user-select: none;
}

.lg-fx-wrap { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }

.lg-fx-view {
  flex: 1 1 auto;
  min-height: 26px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: 84px;
  overflow-y: auto;
  cursor: text;
  font-variant-numeric: tabular-nums;
}
.lg-fx-view:hover { border-color: var(--accent); }
.lg-fx-view:empty::before {
  content: '（空）';
  color: var(--text-faint);
}
.lg-fx-view.is-readonly {
  color: var(--text-dim);
  background: var(--auto-bg);
  cursor: default;
}
.lg-fx-view.is-readonly:hover { border-color: var(--line); }
.lg-fx-view .lg-fx-auto {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
}

.lg-fx-input {
  flex: 1 1 auto;
  min-height: 46px;
  max-height: 100px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--editor-text);
  background: var(--editor-bg);
  border: 2px solid var(--accent);
  border-radius: 6px;
  outline: none;
  resize: vertical;
}

.lg-fx-hint { flex: 0 0 auto; align-self: center; font-size: 10.5px; color: var(--text-faint); }

/* ---------------------------------------------------------------- 填充选项浮层 */
.lg-fillopt-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9;
}

.lg-fillopt-btn {
  position: absolute;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--dropdown-bg);
  color: var(--accent);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow-strong);
  display: grid;
  place-items: center;
  transition: background .12s, transform .12s;
}
.lg-fillopt-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }

.lg-fillopt-menu {
  position: absolute;
  min-width: 210px;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
  padding: 5px;
  pointer-events: auto;
  z-index: 10;
}
/* 菜单跟随按钮定位（由 JS 设置 left/top） */
.lg-fillopt-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}
.lg-fillopt-item:hover { background: var(--accent-soft); }
.lg-fillopt-item.is-on { font-weight: 650; }
.lg-fillopt-item.is-danger:hover { background: rgba(239, 95, 95, .14); color: var(--err); }
.lg-fillopt-check { width: 14px; color: var(--accent); font-weight: 700; }
.lg-fillopt-label { flex: 0 0 auto; }
.lg-fillopt-tip { margin-left: auto; font-size: 10.5px; color: var(--text-faint); }
.lg-fillopt-sep { height: 1px; background: var(--line-soft); margin: 4px 6px; }

/* ---------------------------------------------------------------- 底部新增行（左下角，左对齐） */
.lg-table tbody tr.lg-addrow { height: 36px; }
.lg-addcell {
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  background: var(--row-bg);
  vertical-align: middle;
  padding: 0 8px 0 52px;   /* 左侧留出行号列宽度 */
  position: sticky;
  left: 0;
  z-index: 2;
}
.lg-table tbody tr:nth-child(even).lg-addrow .lg-addcell { background: var(--row-bg-alt); }
.lg-addrow:hover .lg-addcell { background: var(--row-hover); }

.lg-addbtn {
  display: inline-block;
  padding: 4px 14px;
  margin: 0 6px 0 0;
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  border: 1px dashed var(--line);
  transition: all .12s;
  user-select: none;
}
.lg-addbtn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.lg-addbtn-mixed { font-size: 11.5px; }

/* ---------------------------------------------------------------- 列显隐 */
.lg-table th[hidden],
.lg-table td[hidden] { display: none !important; }

/* "列"按钮上的数量徽标 */
.lg-cols-btn { position: relative; }
.lg-cols-btn.is-active {
  color: var(--warn);
  border-color: var(--warn);
}
.lg-cols-badge {
  display: inline-block;
  min-width: 15px;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--warn);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}
/* 筛选条里的一键恢复提示 */
.lg-hidcols-hint {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(224, 169, 74, .10);
}
.lg-hidcols-hint:hover { background: rgba(224, 169, 74, .2); }
.lg-hidcols-ico { font-size: 11px; }
.lg-hidcols-hint b { font-variant-numeric: tabular-nums; }

/* 列管理面板 */
.lg-colpanel {
  position: fixed;
  z-index: 10005;
  width: 264px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-line);
  border-radius: 9px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.lg-colpanel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--text);
}
.lg-colpanel-head strong { font-weight: 650; }
.lg-colpanel-all {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
}
.lg-colpanel-x {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.lg-colpanel-x:hover { color: var(--text); }
.lg-colpanel-search { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
.lg-colpanel-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  font: inherit;
  font-size: 11.5px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}
.lg-colpanel-search input:focus { border-color: var(--accent); }
.lg-colpanel-list { flex: 1 1 auto; overflow-y: auto; padding: 4px; }
.lg-colpanel-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--text-faint);
  cursor: pointer;
}
.lg-colpanel-item:hover { background: var(--head-hover); }
.lg-colpanel-item.is-on { color: var(--text); }
.lg-colpanel-item input { margin: 0; cursor: pointer; }
.lg-colpanel-item span { flex: 1 1 auto; }
.lg-colpanel-item em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.lg-colpanel-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid var(--line-soft);
}
.lg-colpanel-tip { margin-left: auto; font-size: 10.5px; color: var(--text-faint); }

/* ---------------------------------------------------------------- 日期 / 批次 分组边框 */
/* 内层：同日期内的批次 —— 细虚线 */
.lg-table tbody tr.is-batch-start > .lg-cell { border-top: 1px dashed var(--group-batch); }
.lg-table tbody tr.is-batch-end > .lg-cell { border-bottom: 1px dashed var(--group-batch); }

/* 外层：日期分组 —— 粗实线（用 box-shadow 画，避免影响行高） */
.lg-table tbody tr.is-day-start > .lg-cell { box-shadow: inset 0 2px 0 var(--group-day); }
.lg-table tbody tr.is-day-end > .lg-cell { box-shadow: inset 0 -2px 0 var(--group-day); }
.lg-table tbody tr.is-day-start.is-day-end > .lg-cell {
  box-shadow: inset 0 2px 0 var(--group-day), inset 0 -2px 0 var(--group-day);
}
/* 日期组首行左侧色条，强调"新的一天从这里开始" */
.lg-table tbody tr.is-day-start > .lg-rownum {
  box-shadow: inset 3px 0 0 var(--group-day);
}

.lg-keys {
  position: fixed;
  right: 20px;
  bottom: 46px;
  width: 400px;
  max-height: 70vh;
  overflow: auto;
  background: var(--bg-raised);
  border: 1px solid var(--dropdown-line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-panel);
  z-index: 10001;
}
.lg-keys h3 { margin: 0 0 12px; font-size: 13px; font-weight: 650; }
.lg-keys dl { margin: 0; display: grid; grid-template-columns: 118px 1fr; gap: 7px 12px; font-size: 12px; }
.lg-keys dt { color: var(--accent); font-weight: 600; white-space: nowrap; }
.lg-keys dd { margin: 0; color: var(--text-dim); line-height: 1.45; }
.lg-keys-note {
  margin: 14px 0 12px;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.5;
}

.lg-fatal {
  padding: 40px;
  color: var(--err);
  font-size: 14px;
}

/* 小屏适配 */
@media (max-width: 1200px) {
  .lg-hints { display: none; }
  .lg-brandtext p { display: none; }
}
