/* ============================================================================
   检测台账 · 样式
   设计取向：长时间录入，低刺激底色 + 高对比表格 + 清晰的选区块
   主题：深色（默认） / 日间浅色，通过 <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: 68px; }

/* 顶部：实验室信息 + 账号卡片，两行堆叠 */
.lg-sb-head {
  padding: 12px 10px 10px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.lg-sb-lab {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.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-user { display: block; }
.lg-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: background .14s, border-color .14s, transform .1s;
}
.lg-user-card:hover {
  background: var(--head-hover);
  border-color: var(--line);
}
.lg-user-card:active { transform: scale(.985); }
.lg-user-card.is-readonly { border-color: rgba(224, 169, 74, .32); }

.lg-user-av {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a7fd6, #2f6fe0);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(47, 111, 224, .3);
}
.lg-user-card.is-readonly .lg-user-av {
  background: linear-gradient(145deg, #c9a24a, #a8832f);
}

.lg-user-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lg-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: normal;
}
.lg-user-role {
  font-size: 10px;
  color: var(--text-faint);
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lg-user-caret {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  opacity: .5;
}

/* ============================================================
 * 折叠态
 * 文字不隐藏，只收窄字号——图标下面/旁边仍能认出来是哪个模块
 * ============================================================ */
.lg-sidebar.is-collapsed .lg-sb-head {
  padding: 10px 6px 8px;
  align-items: center;
}
.lg-sidebar.is-collapsed .lg-sb-lab {
  flex-direction: column;
  gap: 3px;
  width: 100%;
}
.lg-sidebar.is-collapsed .lg-sb-title {
  align-items: center;
  width: 100%;
}
.lg-sidebar.is-collapsed .lg-sb-title b {
  font-size: 9px;
  text-align: center;
  letter-spacing: 0;
}
.lg-sidebar.is-collapsed .lg-sb-title span { display: none; }

/* 账号卡片：竖排，头像在上、名字在下 */
.lg-sidebar.is-collapsed .lg-user-card {
  flex-direction: column;
  gap: 3px;
  padding: 6px 2px;
  align-items: center;
  border-color: transparent;
  background: transparent;
}
.lg-sidebar.is-collapsed .lg-user-card:hover {
  border-color: var(--line);
  background: var(--head-hover);
}
.lg-sidebar.is-collapsed .lg-user-meta {
  align-items: center;
  gap: 0;
}
.lg-sidebar.is-collapsed .lg-user-name {
  font-size: 9px;
  max-width: 100%;
  text-align: center;
}
.lg-sidebar.is-collapsed .lg-user-role,
.lg-sidebar.is-collapsed .lg-user-caret { display: none; }
.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-sb-label 整个 display:none，折叠后只剩一个符号，认不出来）
 * ---------------------------------------------------------------------- */
.lg-sidebar.is-collapsed .lg-sb-item {
  flex-direction: column;
  gap: 3px;
  padding: 7px 4px;
  text-align: center;
}
.lg-sidebar.is-collapsed .lg-sb-item .lg-sb-icon {
  font-size: 15px;
  width: auto;
}
.lg-sidebar.is-collapsed .lg-sb-item .lg-sb-label {
  font-size: 9.5px;
  line-height: 1.2;
  max-width: 100%;
  text-align: center;
  letter-spacing: 0;
}
.lg-sidebar.is-collapsed .lg-sb-collapse {
  flex-direction: column;
  gap: 2px;
  padding: 6px 4px;
  text-align: center;
}
.lg-sidebar.is-collapsed .lg-sb-collapse .lg-sb-label { font-size: 9px; }
.lg-sidebar.is-collapsed .lg-sb-collapse .lg-sb-icon { transform: rotate(180deg); font-size: 13px; }
/* ---------------------------------------------------------------- 顶栏 */
/* 顶栏：统计 + 起止日期 + 操作，全部挤在一行
 * 原来统计独占一整行（约 28px），并进来后表格多显示一行多 */
.lg-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px 6px 10px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  min-height: 46px;
  overflow: hidden;
}

.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); }

/* 顶栏里的日期字段排成横排（标签在左、输入框在右），
 * 这样整行只有 28px 高，顶栏能压到 40px 出头 */
.lg-week .lg-field {
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.lg-week .lg-field input[type="date"] {
  height: 28px;
}

.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: center;
  gap: 0;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  padding-right: 4px;
}

.lg-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 10px;
  white-space: nowrap;
  border-right: 1px solid var(--line-soft);
  height: 26px;
}
.lg-stat.grow {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line-soft);
  padding-right: 8px;
}
.lg-stat:last-child { border-right: 0; }

.lg-stat-k { font-size: 10.5px; color: var(--text-faint); letter-spacing: .2px; }
.lg-stat-v { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.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); }

/* 统计条在窄屏时逐步隐藏次要项，保证起止日期和按钮不被挤掉 */
@media (max-width: 1500px) {
  .lg-stat.grow { display: none; }
}
@media (max-width: 1240px) {
  .lg-stat:nth-child(5) { display: none; }   /* 提示行 */
}
@media (max-width: 1080px) {
  .lg-stat:nth-child(4) { display: none; }   /* 错误行 */
}

.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 }`，
 * 会把登录页、账号管理等处的输入框一起压成 150px，和 100% 宽的按钮对不齐。
 * 已删除 —— 筛选面板里的输入框用的是 `.lg-input.sm`，
 * 宽度由 `.lg-fp-val .lg-input.sm { flex: 1 1 auto }` 控制，不依赖那条规则。 */

.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-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); }

/* ---------------------------------------------------------------- 顶部编辑栏 */
/* 顶部编辑栏：高度固定，内容超长时内部滚动
 *
 * 为什么必须固定高度
 *   原来只写了 min-height，选中多行内容的单元格时整个栏会被撑高，
 *   下面的表格跟着往下跳；在两列不同行数的单元格之间来回点，
 *   界面就会一大一小地抖。
 *   现在固定 34px，多行内容在里面滚动，表格位置纹丝不动。
 *   要看全时点右侧展开按钮（Ctrl+Shift+E），展开高度是用户主动选的，
 *   不会因为点了别的单元格而变化。
 */
.lg-editorbar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 3px 6px 3px 0;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  height: 34px;
  min-height: 34px;
  overflow: hidden;
  transition: height .12s ease;
}
/* 展开态：编辑栏拉高，内容按行换行并竖向滚动
 * 高度是用户主动选的，不会因为切换单元格而变化 */
.lg-editorbar.is-expanded {
  height: 112px;
}
.lg-editorbar.is-expanded .lg-fx-wrap { align-items: stretch; }
.lg-editorbar.is-expanded .lg-fx-view {
  height: auto;
  min-height: 0;
  max-height: 106px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
  overflow-y: auto;
}
.lg-editorbar.is-expanded .lg-fx-addr { align-self: stretch; }
.lg-editorbar.is-expanded .lg-fx-expand-ico { transform: rotate(180deg); }

/* 展开按钮 */
.lg-fx-expand {
  flex: 0 0 auto;
  width: 22px;
  align-self: center;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.lg-fx-expand:hover {
  background: var(--head-hover);
  color: var(--text);
  border-color: var(--line);
}
.lg-fx-expand-ico { display: block; transition: transform .15s; }

.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;
  height: 26px;
  min-height: 26px;
  max-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;
  /* 不换行：内容和 Excel 编辑栏一样只显示一行，超出的部分靠滚动 */
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
  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;
}

/* 收起态单行（与 fxView 同高）；展开态可到 104px */
.lg-fx-input {
  flex: 1 1 auto;
  min-height: 26px;
  max-height: 26px;
  padding: 3px 9px;
  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: none;
  overflow-y: auto;
}
/* 编辑栏展开时输入框同步放大 */
.lg-editorbar.is-expanded .lg-fx-input {
  min-height: 100px;
  max-height: 104px;
}

.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-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; }
}

/* ---------------------------------------------------------------- 周次选择
 * 顶部「年份 + 周次」两个下拉，一周固定周日到周六。
 * 原来的两个日期输入框容易被填成非整周，改成下拉更稳妥。
 */
.lg-week { display: flex; align-items: center; gap: 8px; }
.lg-week-sel {
  height: 28px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  color-scheme: dark;
}
.lg-week-sel:focus { border-color: var(--accent); }
#pickYear { width: 76px; }
#pickWeek { width: 128px; }
.lg-week-range {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 2px;
}

/* ---------------------------------------------------------------- 加载提示 */
.lg-loading {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  padding: 7px 16px;
  border-radius: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  font-size: 12px;
  color: var(--text-dim);
}
.lg-loading[hidden] { display: none; }

/* ---------------------------------------------------------------- 总览（台账检索） */
.lg-ov {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px 20px 0;
  box-sizing: border-box;
}

.lg-ov-head { flex: 0 0 auto; }
.lg-ov-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 650; color: var(--text); }
.lg-ov-head p { margin: 0 0 12px; font-size: 12px; color: var(--text-dim); }

/* 筛选条 */
.lg-ov-filters {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.lg-ov-f { display: flex; align-items: center; gap: 6px; }
.lg-ov-f-grow { flex: 1 1 200px; min-width: 160px; }
.lg-ov-flabel { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.lg-ov-dash { color: var(--text-faint); font-size: 11px; }

.lg-ov-date { width: 132px; }
.lg-ov-sel { width: 118px; }
.lg-ov-text { width: 168px; }
.lg-ov-f-grow .lg-ov-text { width: 100%; }

.lg-ov-labbtn {
  min-width: 96px;
  text-align: left;
  cursor: pointer;
}
.lg-ov-labbtn.is-on { border-color: var(--accent); color: var(--accent); }

.lg-ov-actions { display: flex; gap: 6px; margin-left: auto; }

/* 实验室多选面板 */
.lg-ov-labpanel {
  flex: 0 0 auto;
  margin-top: 8px;
  padding: 10px 12px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 260px;
  overflow: auto;
}
.lg-ov-labpanel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}
.lg-ov-labpanel-head b { color: var(--text); font-weight: 650; }

.lg-ov-labgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px 14px;
}
.lg-ov-labgroup-t {
  font-size: 10.5px;
  color: var(--text-faint);
  margin: 4px 0 3px;
  font-weight: 650;
}
.lg-ov-labitem {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 1px 0;
}
.lg-ov-labitem:hover { color: var(--text); }
.lg-ov-labitem input { margin: 0; }

/* 统计卡 */
.lg-ov-stats {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 8px;
  flex-wrap: wrap;
}
.lg-ov-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}
.lg-ov-stat b { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lg-ov-stat span { font-size: 11px; color: var(--text-dim); }
.lg-ov-stat.is-warn { border-color: var(--err); }
.lg-ov-stat.is-warn b { color: var(--err); }
.lg-ov-range { font-size: 11.5px; color: var(--text-faint); margin-left: auto; }

/* 结果表 */
.lg-ov-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}
.lg-ov-tablewrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.lg-ov-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.lg-ov-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-raised);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.lg-ov-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.lg-ov-table tbody tr:hover td { background: var(--row-hover); }
.lg-ov-table tbody tr.is-pos td { background: rgba(220, 80, 80, .06); }

.lg-ov-c-num { width: 46px; text-align: right; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.lg-ov-c-date { width: 92px; font-variant-numeric: tabular-nums; }
.lg-ov-c-lab { width: 92px; }
.lg-ov-c-mi { width: 38px; text-align: center; }
.lg-ov-c-unit { width: 130px; }
.lg-ov-c-st { width: 84px; }
.lg-ov-c-info { width: 160px; }
.lg-ov-c-mix { width: 32px; text-align: center; }
.lg-ov-c-ct { width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.lg-ov-c-tg { width: 130px; color: var(--text-dim); font-size: 11px; }
.lg-ov-c-pos { width: 44px; text-align: center; }
.lg-ov-c-kit { width: 110px; }
.lg-ov-c-man { width: 68px; }

.lg-ov-pos { color: var(--err); font-weight: 700; }
.lg-ov-dim { color: var(--text-faint); font-size: 11.5px; }

.lg-ov-more {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px 0;
}
.lg-ov-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

/* 总览页占满整个模块区，不要通用内边距 */
.lg-module-root[data-module="overview"] { padding: 0; }
.lg-module-root[data-module="overview"] > .lg-view { height: 100%; }

/* 缺靶标的老行：结果列显示「?」而不是「-」，提示算不准 */
.lg-ov-unk { color: var(--text-faint); font-weight: 600; }

.lg-ov-stat.is-dim { border-color: var(--line); opacity: .75; }
.lg-ov-stat.is-dim b { color: var(--text-dim); }

/* ---------------------------------------------------------------- 侧栏台账项的实验室副行
 * 台账项变成两行：上面是模块名，下面是当前实验室 + 箭头。
 * 箭头点开切换，右键整项也能切换。
 * ---------------------------------------------------------------------- */
.lg-sb-item.has-labsub {
  flex-wrap: wrap;
  row-gap: 1px;
}

.lg-sb-labsub {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  padding-left: 27px;          /* 对齐到图标右边的文字起始位置 */
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-faint);
  min-width: 0;
}
.lg-sb-item.is-active .lg-sb-labsub { color: var(--accent); opacity: .85; }

.lg-sb-labsub.is-pickable { cursor: pointer; border-radius: 4px; }
.lg-sb-labsub.is-pickable:hover {
  color: var(--text);
  background: rgba(127, 127, 127, .12);
}
.lg-sb-item.is-active .lg-sb-labsub.is-pickable:hover { color: var(--accent); }

.lg-sb-labsub-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-sb-labsub-caret {
  flex: 0 0 auto;
  font-size: 8px;
  opacity: .7;
  transition: transform .12s;
}
.lg-sb-labsub.is-pickable:hover .lg-sb-labsub-caret { transform: translateY(1px); opacity: 1; }

/* ---------------------------------------------------------------- 折叠态
 *
 * 折叠后侧栏只有 68px，宽 55px 的菜单项里再塞「平南实验室」五个字
 * 必然是挤爆的。所以折叠态换一套做法：
 *
 *   - 实验室名整行隐藏（放进 title，悬停就能看）
 *   - 只在菜单项右上角保留一个小小的 ▾
 *     既是"这里能切"的提示，也不占地方
 *   - 位置用 absolute，不参与 flex 排版，
 *     免得再出现"flex-basis 在 column 方向变成高度"那种溢出
 *     （之前副行就是这么被撑到 44px、右边界跑到 75px，超出 68px 的侧栏）
 * ---------------------------------------------------------------------- */
.lg-sidebar.is-collapsed .lg-sb-item.has-labsub {
  position: relative;
  flex-wrap: nowrap;
}
.lg-sidebar.is-collapsed .lg-sb-labsub {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 0;
  width: 14px;
  height: 14px;
  margin: 0;
  justify-content: center;
  border-radius: 4px;
}
/* 只留箭头，名字隐藏 */
.lg-sidebar.is-collapsed .lg-sb-labsub-name { display: none; }
.lg-sidebar.is-collapsed .lg-sb-labsub-caret {
  display: block;
  font-size: 9px;
  opacity: .55;
  line-height: 14px;
}
.lg-sidebar.is-collapsed .lg-sb-labsub.is-pickable:hover {
  background: var(--accent-soft);
}
.lg-sidebar.is-collapsed .lg-sb-labsub.is-pickable:hover .lg-sb-labsub-caret {
  opacity: 1;
  color: var(--accent);
}

/* ============================================================================
 * 飞书式筛选器
 * ==========================================================================*/
.lg-fb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.lg-fb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, color .12s;
}
.lg-fb-btn:hover { border-color: var(--accent); color: var(--text); }
.lg-fb-btn.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.lg-fb-ico { font-size: 12px; }

.lg-fb-count {
  min-width: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 15px;
  text-align: center;
  font-weight: 700;
}

.lg-fb-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.lg-fb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 320px;
  padding: 3px 4px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-raised);
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.lg-fb-chip b { color: var(--text); font-weight: 600; }
.lg-fb-chip-op { color: var(--text-faint); font-size: 10.5px; }
.lg-fb-chip-v {
  color: var(--accent);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lg-fb-join {
  color: var(--text-faint);
  font-style: normal;
  font-size: 10px;
  margin-right: 1px;
}
.lg-fb-chip-x {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 0 3px;
  cursor: pointer;
  border-radius: 3px;
}
.lg-fb-chip-x:hover { background: rgba(220, 80, 80, .18); color: var(--err); }

.lg-fb-clear {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 3px 4px;
}
.lg-fb-clear:hover { color: var(--err); }

/* ---------------------------------------------------------------- 浮层 */
.lg-fb-panel {
  position: fixed;
  z-index: 9300;
  width: 556px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .30);
  overflow: hidden;
}

.lg-fb-panel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 14px 8px;
  flex: 0 0 auto;
}
.lg-fb-panel-head strong { font-size: 13px; font-weight: 650; color: var(--text); }
.lg-fb-panel-sub { font-size: 11px; color: var(--text-faint); }

.lg-fb-panel-join {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px 9px;
  font-size: 11.5px;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.lg-fb-join-sel {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  padding: 2px 6px;
  cursor: pointer;
}

.lg-fb-rows {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lg-fb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lg-fb-fld, .lg-fb-op {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  padding: 4px 5px;
  cursor: pointer;
  max-width: 120px;
}
.lg-fb-op { max-width: 96px; color: var(--text-dim); }

.lg-fb-val {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.lg-fb-input {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  padding: 4px 7px;
}
.lg-fb-input:focus { outline: 0; border-color: var(--accent); }
.lg-fb-tilde { color: var(--text-faint); font-size: 10px; flex: 0 0 auto; }
.lg-fb-noval { color: var(--text-faint); font-size: 11.5px; padding-left: 2px; }

.lg-fb-del {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 4px;
}
.lg-fb-del:hover { background: rgba(220, 80, 80, .16); color: var(--err); }

.lg-fb-add {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 6px 14px 0;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 11.5px;
  padding: 5px 10px;
  cursor: pointer;
}
.lg-fb-add:hover { border-color: var(--accent); color: var(--accent); }

.lg-fb-panel-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

/* 总览页的筛选栏容器 */
.lg-ov-filterbar { flex: 0 0 auto; padding: 0 0 6px; }
.lg-ov-head { display: flex; align-items: flex-start; gap: 10px; }
