:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --line: #dfe3e8;
  --line-strong: #c6ccd4;
  --ink: #1c1f23;
  --muted: #6b7480;
  --accent: #2f6fed;
  --accent-weak: #e8f0fe;
  --danger: #c62828;
  --ok: #1e7d46;
  --warn: #9a6700;
  --head: #f1f3f6;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
button { font-family: inherit; font-size: 12.5px; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 12.5px; }

.hidden { display: none !important; }
.muted { color: #9aa0a6; }

/* ---------- 登录 ---------- */
.login {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, #eef2f8, #f8fafc 60%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 28px; box-shadow: 0 12px 40px rgba(20,30,60,.10);
}
.login-card h1 { font-size: 19px; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 20px; font-size: 12px; }
.login-card label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.login-card input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 10px;
  border: 1px solid var(--line-strong); border-radius: 6px; outline: none;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.login-card .login-remember { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: -2px 0 12px; cursor: pointer; }
.login-card .login-remember input { width: auto; margin: 0; padding: 0; }
.login-links { text-align: right; font-size: 12px; margin-top: 6px; }
.login-links a { color: var(--muted); text-decoration: none; }
.login-links a:hover { color: var(--accent); text-decoration: underline; }
.login-card button {
  width: 100%; padding: 10px; margin-top: 6px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.err { color: var(--danger); min-height: 18px; margin: 10px 0 0; font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 46px; display: flex; align-items: center; gap: 14px;
  padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.brand { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.search-wrap { position: relative; flex: 0 1 320px; }
#search {
  width: 100%; padding: 6px 10px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: #fbfcfd; outline: none;
}
#search:focus { border-color: var(--accent); background: #fff; }
.search-results {
  position: absolute; top: 34px; left: 0; right: 0; max-height: 340px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20,30,60,.12); z-index: 30;
}
.search-results div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results div:hover { background: var(--accent-weak); }
.search-results small { color: var(--muted); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who { color: var(--muted); margin: 0 4px; cursor: pointer; }

button.ghost {
  background: #fff; border: 1px solid var(--line-strong); border-radius: 5px;
  padding: 4px 9px; color: var(--ink);
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; border-radius: 5px; padding: 5px 12px; }
button.primary:hover { background: #255bd0; }
button.danger { background: #fff; border: 1px solid #e7b3b3; color: var(--danger); border-radius: 5px; padding: 4px 9px; }
button.danger:hover { background: #fdf3f3; }
button.mini {
  font-size: 11px; padding: 0 6px; line-height: 18px; border: 1px solid var(--line-strong);
  background: #fff; border-radius: 4px; color: #41474e;
}
button.mini:hover { border-color: var(--accent); color: var(--accent); }
button.mini.danger { border-color: #ecc8c8; color: var(--danger); }
button.mini.danger:hover { background: #fdf3f3; }

/* ---------- 布局 ---------- */
.layout { display: flex; height: calc(100vh - 46px); }
.sidebar {
  width: 196px; flex: 0 0 196px; background: var(--panel);
  border-right: 1px solid var(--line); overflow: auto;
}
.sidebar-title {
  padding: 10px 12px 4px; font-size: 10.5px; letter-spacing: .08em;
  color: var(--muted); text-transform: uppercase;
}
.module-list, #strainList { list-style: none; margin: 0; padding: 0 6px 10px; }
.module-list li, #strainList li {
  padding: 6px 9px; border-radius: 5px; cursor: pointer; margin-bottom: 1px;
  display: flex; justify-content: space-between; align-items: center;
}
.module-list li:hover, #strainList li:hover { background: #f2f4f7; }
.module-list li.active, #strainList li.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
#strainList li span.count { color: var(--muted); font-weight: 400; font-size: 10.5px; }
.badge {
  min-width: 18px; text-align: center; font-size: 10.5px; font-weight: 600;
  background: #f1f3f6; color: #5b6470; border-radius: 9px; padding: 0 6px; line-height: 16px;
}
.module-list li.active .badge { background: #fff; color: var(--accent); }

.main { flex: 1; overflow: auto; padding: 10px 12px 70px; }
.empty { color: var(--muted); text-align: center; margin-top: 120px; }

/* ---------- 品系头 ---------- */
.strain-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.strain-head h2 { margin: 0; font-size: 17px; }
.strain-head .desc { color: var(--muted); }
.strain-head .meta-inline { color: var(--muted); font-size: 12px; }
.strain-head .spacer { flex: 1; }

/* ---------- 筛选 ---------- */
.filters {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; margin-bottom: 8px; position: sticky; top: -10px; z-index: 10;
}
.filters input, .filters select {
  padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 4px;
  background: #fff; outline: none; height: 26px;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
#f-q, #f-gt { width: 120px; }
#f-loc { width: 110px; }
.filters input[type="date"] { width: 122px; }
.filters .tilde { color: var(--muted); }
.filters .chk { display: inline-flex; align-items: center; gap: 3px; color: #4a5158; font-size: 12px; white-space: nowrap; }
.filters .chk input { height: auto; }
.fcount { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- 笼类型分组（可折叠栏目） ---------- */
.type-group { margin: 12px 0 4px; }
.type-group .group-head {
  display: flex; align-items: center; gap: 8px;
  position: sticky; top: -1px; z-index: 4;
  padding: 5px 10px; margin: 0 0 6px; cursor: pointer; user-select: none;
  background: linear-gradient(#eef3fa, #e5edf8);
  border: 1px solid #c8d5e6; border-left: 4px solid #5b7fb0; border-radius: 5px;
  font-weight: 700; font-size: 13px; color: #2c3e57;
  box-shadow: 0 1px 3px rgba(20, 40, 80, .07);
}
.type-group .group-head:hover { background: linear-gradient(#e9f1fb, #dde7f5); }
.type-group .group-head .spacer { flex: 1; }
.group-head .gcaret { width: 12px; color: #5b7fb0; font-size: 11px; }
.group-head .gname { letter-spacing: .4px; }
.group-head .gcount { color: #5a6b80; font-weight: 400; font-size: 11.5px; }
.group-head .gfold { color: #98a4b3; font-weight: 400; font-size: 11px; }
.type-group.folded .group-head { margin-bottom: 0; }
.type-group.folded .group-body { display: none; }

/* ---------- 笼块 ---------- */
.cage-block { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 7px; overflow: hidden; }
.cage-head {
  display: flex; align-items: center; gap: 8px; padding: 3px 8px;
  background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 12px;
}
.cage-head .cage-code { font-weight: 700; font-size: 13px; }
.cage-head .meta { color: var(--muted); font-size: 11.5px; }
.cage-head .note-inline { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cage-head .spacer { flex: 1; }
.cage-head .tag {
  font-size: 10.5px; padding: 0 6px; border-radius: 9px; line-height: 16px;
  background: #eef7f1; color: var(--ok); border: 1px solid #cfe8d8;
}
.cage-head .tag.ctype { background: #eef2fb; color: #2f5ca8; border-color: #d3ddf2; }

table.grid { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
table.grid th, table.grid td {
  border: 1px solid var(--line); padding: 1px 6px; text-align: left;
  white-space: nowrap; vertical-align: middle; height: 23px;
  overflow: hidden; text-overflow: ellipsis;
}
table.grid th {
  background: var(--head); color: #41474e; font-weight: 600; font-size: 11.5px;
  padding: 2px 6px; text-align: center; position: relative;
}
table.grid th .colres {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 3; border-radius: 2px;
}
table.grid th .colres:hover { background: rgba(47, 111, 237, .22); }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing table.grid td:hover { background: inherit; }
table.grid tr:hover td { background: #fbfcfe; }
table.grid tr.selected td { background: #eef4ff; }
table.grid td.note { white-space: normal; color: #4a5158; font-size: 11.5px; line-height: 1.3; word-break: break-word; }
table.grid td.note .nw { display: block; white-space: normal; word-break: break-word; }
table.grid td.mcell { white-space: nowrap; }
table.grid td.mcell input { margin-right: 4px; vertical-align: middle; }
table.grid td.mcode a, table.grid td a.mcode { color: var(--accent); text-decoration: none; font-weight: 600; }
table.grid td.gt { cursor: text; font-family: Consolas, "Courier New", monospace; text-align: center; }
table.grid td.gt:hover { background: var(--accent-weak); }
table.grid input.cell {
  width: 100%; min-width: 60px; border: 1px solid var(--accent); border-radius: 3px;
  padding: 0 3px; font-family: Consolas, monospace;
}
table.grid td.cage-cell {
  font-weight: 700; text-align: center; white-space: nowrap;
  border-right: 1px solid var(--line-strong); background: #fcfdfe;
}
table.grid td.cage-cell .ctype-sub { font-weight: 400; font-size: 10px; color: var(--muted); }
table.grid td.loc-cell { text-align: center; white-space: nowrap; background: #fcfdfe; }
table.grid td.ops { text-align: right; white-space: nowrap; width: 92px; min-width: 92px; }
table.grid th:last-child { width: 92px; }
table.grid td.ops button { margin-left: 3px; }

.sex-m { color: #1a5fb4; }
.sex-f { color: #a51d6b; }
.st-dead { color: #9aa0a6; text-decoration: line-through; }
.st-exp { color: var(--warn); }

/* ---------- 已处死 ---------- */
.euth-grid td { height: 26px; }
.euth-banner {
  background: #fdf6f6; border: 1px solid #f0d5d5; color: #8a2f2f;
  padding: 6px 10px; border-radius: 5px; margin-bottom: 10px; font-size: 12px;
}

/* ---------- 批量条 ---------- */
.batchbar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 40;
  background: #22282f; color: #fff; padding: 7px 12px; border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22); font-size: 12.5px;
}
.batchbar b { color: #7fb0ff; }
.batchbar button { border-radius: 5px; padding: 4px 10px; font-size: 12.5px; }
.batchbar button.ghost { background: #343b44; border-color: #4b545e; color: #e6eaef; }
.batchbar button.ghost:hover { background: #3f4750; color: #fff; }

/* ---------- 抽屉 ---------- */
.drawer {
  position: fixed; top: 0; right: 0; width: 430px; height: 100vh; background: #fff;
  border-left: 1px solid var(--line); box-shadow: -12px 0 34px rgba(20,30,60,.10);
  z-index: 50; display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.drawer-body { padding: 12px; overflow: auto; }
.field { margin-bottom: 8px; }
.field label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 4px 7px; border: 1px solid var(--line-strong);
  border-radius: 4px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1; }
.section-title { font-weight: 700; margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.hist-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 8px; }
.hist-bar input[type="date"] { width: auto; }
.hist-bar #h-q { min-width: 170px; flex: 1; }
.hist-bar .tilde { color: var(--muted); }
.hist-tools { display: flex; gap: 6px; align-items: center; margin: 4px 0 6px; font-size: 12px; }
.hist-tools .spacer { flex: 1; }
.hist-table td { font-size: 12px; }
.hist-cat { display: inline-block; padding: 0 6px; border-radius: 8px; background: #eef2f8; color: #3b4a5e; font-size: 11px; }
.hist-more { text-align: center; margin: 8px 0; }
.hist-audit { margin-top: 6px; }
.hist-audit summary { cursor: pointer; font-weight: 700; font-size: 12px; margin: 8px 0 6px; }
.gt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-list li { border-bottom: 1px dashed var(--line); padding: 5px 0; font-size: 12px; }
.ev-list .t { color: var(--muted); margin-right: 6px; }
.ev-type { display: inline-block; padding: 0 6px; border-radius: 4px; background: #eef2f8; color: #3b4a5e; margin-right: 6px; font-size: 11px; }
.ml-list li { display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; }
.ml-list .ml-move { color: #2f5ca8; font-size: 11.5px; margin-right: 4px; }
.ml-list .ml-move i { font-style: normal; color: var(--muted); margin: 0 4px; }
.ml-list .ml-detail { color: #4a5563; font-size: 11.5px; margin-right: 4px; }
.ml-list .ml-op { margin-left: auto; color: var(--muted); font-size: 11px; }
.ml-note { flex-basis: 100%; margin-top: 2px; font-size: 11.5px; }
.ml-note summary { cursor: pointer; color: var(--accent); }
.ml-note-col b { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ml-note pre {
  margin: 0 0 4px; padding: 4px 6px; max-height: 160px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; background: #f7f9fc;
  border: 1px solid var(--line); border-radius: 4px;
  font-family: inherit; font-size: 11.5px; color: #3b4a5e;
}
.section-title .muted { font-weight: 400; font-size: 11.5px; margin-left: 4px; }

/* 标准事件 */
.std-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.std-chip {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 14px;
  padding: 3px 12px; font-size: 12px; color: #3b4a5e; cursor: pointer;
}
.std-chip:hover { border-color: var(--accent); color: var(--accent); }
.std-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.std-panel { border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #fafbfd; margin-bottom: 8px; }
.std-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.std-lbl { font-size: 12px; color: var(--muted); min-width: 38px; }
.std-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.std-opt {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 10px;
  padding: 1px 8px; font-size: 11.5px; color: #3b4a5e; cursor: pointer;
}
.std-opt:hover { border-color: var(--accent); }
.std-opt.active { background: #e8efff; border-color: var(--accent); color: var(--accent); }
.std-panel #std-param { flex: 1; min-width: 120px; }
.std-panel #std-stage { max-width: 110px; }
.std-panel .field-row .field { min-width: 120px; }
.ev-param { display: inline-block; padding: 0 6px; border-radius: 4px; background: #e8f3ec; color: #2f6b45; font-size: 11px; margin-right: 4px; }
.ev-stage { display: inline-block; padding: 0 6px; border-radius: 4px; background: #fff2e3; color: #9a5b16; font-size: 11px; margin-right: 4px; }
.ev-time { color: #8a94a3; font-size: 11px; margin-left: 2px; }

/* 基因型表批量填充 */
.gt-bulk {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin: 6px 0 8px; padding: 6px 8px; background: #f7f9fc;
  border: 1px solid var(--line); border-radius: 5px; font-size: 12px;
}
.gt-bulk select { max-width: 130px; }
.gt-bulk input { min-width: 140px; flex: 1; }
.gt-bulk .gt-sel-count { color: var(--muted); margin-left: auto; }
.gtable th.chk, .gtable td.chk { width: 30px; text-align: center; }
.gtable input[type="checkbox"] { width: 14px; height: 14px; padding: 0; margin: 0; vertical-align: middle; }
.gtable tr.selected td { background: #eef4ff; }
.del-link { float: right; color: var(--danger); text-decoration: none; font-size: 11px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chkline { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #4a5158; margin: 4px 0 8px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,28,40,.35); z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-card { width: 500px; max-height: 86vh; background: #fff; border-radius: 10px; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; }
.modal-body { padding: 12px; overflow: auto; }
.modal-foot { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.hint { color: var(--muted); font-size: 11.5px; margin: 4px 0 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 62px; transform: translateX(-50%);
  background: #22282f; color: #fff; padding: 8px 14px; border-radius: 8px;
  z-index: 90; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex; align-items: center; gap: 8px;
}
.toast-act {
  background: #3b6fe0; border: 0; color: #fff; border-radius: 5px;
  padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.toast-act:hover { background: #2f5fcc; }

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  .sidebar { width: 140px; flex-basis: 140px; }
  .drawer { width: 100%; }
  .search-wrap { flex: 1 1 auto; }
  .top-actions .ghost { padding: 4px 6px; }
}

/* ---------- 全局 / 统计 ---------- */
.stats { display: flex; gap: 8px; margin-bottom: 8px; }
.stat { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.stat b { font-size: 19px; display: block; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 11.5px; }
.charts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.chart { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; }
.chart-title { font-weight: 700; font-size: 12px; margin-bottom: 5px; }
.bar-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; margin: 3px 0; }
.bar-row .bl { width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3b4a5e; }
.bar-row .btrack { flex: 1; height: 7px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.bar-row .btrack i { display: block; height: 100%; background: #6f9cf0; border-radius: 4px; }
.bar-row .bn { width: 34px; text-align: right; color: var(--muted); }

/* ---------- 批量笼类型 ---------- */
.ct-list { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; padding: 4px; }
.ct-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-bottom: 1px dashed var(--line); font-size: 12px; cursor: pointer; }
.ct-row:last-child { border-bottom: 0; }
.ct-row:hover { background: #f7f9fc; }
.ct-code { font-weight: 600; min-width: 96px; }
.ct-loc { color: var(--muted); min-width: 84px; }
.ct-tag { color: #2f5ca8; background: #eef2fb; border-radius: 8px; padding: 0 6px; font-size: 11px; }
.ct-n { margin-left: auto; color: var(--muted); }

/* ---------- 历史 / 撤回 ---------- */
.undone td { color: #9aa0a6; }

/* ---------- 基因型勾选 ---------- */
.gt-btn { height: 26px; white-space: nowrap; }
.gt-pick { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; padding: 4px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; }
.gt-item { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 5px; border-radius: 4px; cursor: pointer; min-width: 0; }
.gt-item:hover { background: #f2f6fc; }
.gt-item .gv { font-family: Consolas, "Courier New", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-item .gn { margin-left: auto; color: var(--muted); font-size: 11px; }
.gt-tools { display: flex; gap: 6px; align-items: center; margin-top: 6px; }

/* ---------- 颜色标记 / 笼备注 / 基因型录入 ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px;
  vertical-align: middle; cursor: pointer; border: 1px solid rgba(0,0,0,.18); }
.cage-note { display: flex; gap: 8px; padding: 3px 9px 4px; border-top: 1px dashed var(--line);
  font-size: 11.5px; background: #fcfdfe; align-items: flex-start; }
.cage-note .cn-lbl { color: var(--muted); white-space: nowrap; line-height: 20px; }
.cage-note .cn-text { color: #3b4a5e; flex: 1; cursor: text; white-space: pre-wrap; line-height: 20px; min-height: 20px; }
.cage-note .cn-text.placeholder { color: #b3bac2; }
.cage-note textarea { flex: 1; border: 1px solid var(--accent); border-radius: 4px; padding: 2px 6px;
  font-size: 11.5px; resize: vertical; min-height: 34px; outline: none; }
.tag-swatches { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.tag-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.tag-swatch.active { border-color: #222; box-shadow: 0 0 0 2px #fff inset; }
.gwrap { max-height: 54vh; overflow: auto; border: 1px solid var(--line); border-radius: 5px; }
.gtable td { height: 26px; padding: 1px 4px; }
.gtable thead th { position: sticky; top: 0; z-index: 2; }
.gtable input { width: 88px; border: 1px solid var(--line-strong); border-radius: 3px; padding: 1px 4px;
  font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.gtable input:focus { border-color: var(--accent); outline: none; }
.gtable a.gfill { color: var(--accent); text-decoration: none; font-size: 11px; margin-left: 2px; }
.modal-card.wide { width: min(1120px, 95vw); }

/* ---------- 基因型位点列管理 ---------- */
.gt-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gt-toolbar .hint { margin: 0; }
.gcol { color: #8a94a0; text-decoration: none; font-size: 11px; margin-left: 2px; }
.gcol:hover { color: var(--accent); }

/* ---------- 位点显示名 ---------- */
.alias-mark { color: #b8860b; font-weight: 700; margin-left: 1px; }

/* ---------- 笼显示顺序（手动调整） ---------- */
.ord-mode { display: flex; gap: 18px; align-items: center; margin: 2px 0 8px; }
.ord-mode .chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
#ord-wrap { max-height: 54vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fcfdfe; }
#ord-wrap.dim .ord-row { opacity: .55; }
.ord-group { margin-bottom: 8px; }
.ord-gh { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12px; color: #3b4a5e;
  padding: 2px 4px 4px; border-bottom: 1px dashed var(--line); margin-bottom: 4px; }
.ord-gh .gcount { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.ord-list { display: flex; flex-direction: column; gap: 2px; min-height: 4px; }
.ord-row { display: flex; align-items: center; gap: 8px; padding: 2px 6px; border: 1px solid var(--line);
  border-radius: 4px; background: #fff; font-size: 12px; cursor: grab; }
.ord-row:hover { border-color: var(--accent); background: #f7faff; }
.ord-row.dragging { opacity: .45; }
.ord-handle { color: #b3bcc8; letter-spacing: -2px; font-size: 11px; }
.ord-code { font-weight: 700; min-width: 110px; }
.ord-loc { color: var(--muted); font-size: 11.5px; }
.ord-row .spacer { flex: 1; }
.ord-row .mini { padding: 0 6px; height: 20px; line-height: 18px; }
/* ---------- 用户 / 授权 ---------- */
#modalBody td .sep { color: #c3c9d2; margin: 0 4px; }
.sh-cb { width: 15px; height: 15px; }

/* ---------- 已处死：按死亡日期分栏 ---------- */
.euth-sec td { background: #f1f5fb; border-top: 1px solid var(--line-strong); color: #33445c;
  font-size: 12px; height: 28px; }
.euth-sec td b { font-size: 12.5px; }
.euth-sec td .muted { font-weight: 400; margin-left: 4px; }

/* ---------- 用户管理：授权入口按钮 ---------- */
table.grid td.u-ops { white-space: nowrap; }
table.grid.users-grid th:last-child { width: 320px; }
table.grid.users-grid td.u-ops { width: 320px; }
button.mini.auth { background: var(--accent); border-color: var(--accent); color: #fff; }
button.mini.auth:hover { background: #255bd0; border-color: #255bd0; color: #fff; }

/* ---------- 搜索：笼位分组 ---------- */
.search-results .sr-group { padding: 6px 10px 3px; font-size: 11px; color: var(--muted);
  background: #f7f9fc; border-bottom: 1px solid var(--line); cursor: default; }
.search-results .sr-group:hover { background: #f7f9fc; }
.search-results div[data-cage] b { color: #2f5ca8; }
.cage-block.flash { animation: mcFlash 1.7s ease; }
@keyframes mcFlash {
  0% { box-shadow: inset 0 0 0 2px var(--accent); }
  60% { box-shadow: inset 0 0 0 2px rgba(47, 111, 237, .5); }
  100% { box-shadow: none; }
}

/* ---------- 打印：勾选笼 ---------- */
.pp-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pp-bar .hint { margin: 0; }
.pp-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 6px; background: #fcfdfe; }
.pp-type { font-weight: 700; font-size: 12px; color: #3b4a5e; padding: 6px 4px 3px;
  border-bottom: 1px dashed var(--line); margin-bottom: 2px; }
.pp-type .muted { font-weight: 400; font-size: 11.5px; }
.pp-item { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 4px;
  font-size: 12.5px; cursor: pointer; }
.pp-item:hover { background: #f2f6fc; }
.pp-item .pp-loc { color: var(--muted); font-size: 11.5px; }
#modalBody td.c { text-align: center; }

/* ---------- 语音备注 ---------- */
.m-only { display: none !important; }
.m-nav { display: none; }
.sidebar-mask { position: fixed; inset: 0; background: rgba(16, 24, 38, .42); z-index: 55; }
.sidebar-mask.hidden { display: none; }
.me-card { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; margin-bottom: 8px;
  background: #f7f9fc; border: 1px solid var(--line); border-radius: 7px; }
.me-card b { font-size: 15px; }
.me-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.me-actions .ghost { flex: 1 1 45%; }
.v-badge { margin-left: 5px; font-size: 10.5px; color: #2f5ca8; background: #eef2fb;
  border-radius: 8px; padding: 0 5px; vertical-align: 1px; cursor: pointer; }
.v-mini-list { margin: 2px 0 4px; }
.v-mini { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 5px; background: #fcfdff; }
.v-mini audio { width: 100%; height: 30px; }
.v-mini-text { font-size: 12px; color: #3b4a5e; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.v-list { display: flex; flex-direction: column; gap: 2px; }
.v-item { border: 1px solid var(--line); border-radius: 7px; padding: 7px; margin-bottom: 6px;
  background: #fff; box-shadow: 0 1px 1px rgba(20, 30, 50, .03); }
.v-head { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 3px; flex-wrap: wrap; }
.v-head .v-by { color: #6b7787; }
.v-head .v-status { border-radius: 8px; padding: 0 6px; background: #eef2fb; color: #2f5ca8; }
.v-head .v-status.pending, .v-head .v-status.processing { background: #fff4e0; color: #a36a00; }
.v-head .v-status.failed { background: #fdecec; color: #c0392b; }
.v-head .v-status.off { background: #f0f1f3; color: #6b7280; }
.v-item audio { width: 100%; height: 32px; margin: 2px 0 4px; }
.v-text { width: 100%; font-size: 13px; line-height: 1.45; resize: vertical; }
.v-ops { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.v-ops a.mini { text-decoration: none; display: inline-flex; align-items: center; height: 22px; }
.v-err { color: var(--danger); font-size: 11px; }
.v-rec { border: 1px dashed var(--line-strong); border-radius: 8px; padding: 9px; background: #fbfcff; margin-bottom: 8px; }
.v-rec-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v-warn { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: #fff4e0;
  border: 1px solid #f0d59c; color: #8a5a00; font-size: 12px; }
#v-rec-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--danger); font-size: 13px; }
#v-rec-btn.recording { background: var(--danger); border-color: var(--danger); animation: recPulse 1.2s infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.v-preview { margin-top: 8px; }
.v-preview audio { width: 100%; height: 34px; }
.m-more { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.m-more .ghost { height: 38px; }

/* ---------- 窄屏 / 手机 ---------- */
@media (max-width: 720px) {
  body.authed { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 40; padding: 6px 8px; gap: 6px; }
  .topbar .brand { font-size: 14px; white-space: nowrap; }
  .top-actions { display: none; }
  .search-wrap { flex: 1 1 auto; min-width: 0; }
  #search { width: 100%; font-size: 14px; height: 34px; }
  .m-only { display: inline-flex !important; }
  #btnMenu { font-size: 18px; padding: 2px 8px; }
  .layout { display: block; height: calc(100vh - 46px); height: calc(100dvh - 46px); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 84%; max-width: 330px;
    z-index: 60; transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: 8px 0 24px rgba(15, 25, 40, .18); background: var(--panel); overflow: auto; }
  .sidebar.open { transform: none; }
  .main { height: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
    padding: 8px 8px calc(80px + env(safe-area-inset-bottom)); }
  .strain-head { flex-wrap: wrap; gap: 5px; padding: 6px 2px 8px; }
  .strain-head h2 { font-size: 18px; }
  .strain-head .desc { display: none; }
  .strain-head .meta-inline { font-size: 11.5px; }
  #m-filter-wrap .filters { display: none; }
  #m-filter-wrap.open .filters { display: flex; flex-wrap: wrap; gap: 4px; }
  .filters input, .filters select, .filters button { font-size: 12px; height: 31px; }
  .filters #f-q, .filters #f-loc { flex: 1 1 42%; min-width: 120px; }
  .filters .fcount { flex-basis: 100%; }
  .charts { grid-template-columns: 1fr; }
  .stats { flex-wrap: wrap; }
  .stat { flex: 1 1 44%; }
  .modal-card, .modal-card.wide { width: calc(100vw - 14px); max-height: 92vh; }
  .modal-body { padding: 10px; }
  .drawer { width: 100%; top: 0; }
  .batchbar { left: 6px; right: 6px; bottom: calc(62px + env(safe-area-inset-bottom));
    transform: none; flex-wrap: wrap; justify-content: center; gap: 4px; border-radius: 8px; }
  .batchbar button { font-size: 12px; padding: 5px 9px; }
  .m-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #fff; border-top: 1px solid var(--line); }
  .m-nav button { flex: 1; border: 0; background: transparent; color: var(--muted);
    font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .m-nav button.active { color: var(--accent); font-weight: 700; }
  body:not(.authed) .m-nav { display: none; }
  #main { overflow-x: hidden; }
  table.grid { font-size: 12px; }

  /* 卡片式品系页 */
  .m-head { display: flex; align-items: center; gap: 5px; padding: 4px 2px 8px; flex-wrap: wrap; }
  .m-head-main { min-width: 0; }
  .m-head h2 { font-size: 19px; margin: 0 0 1px; }
  .m-meta { color: var(--muted); font-size: 11.5px; }
  .m-head .ghost { font-size: 12px; padding: 4px 9px; }
  .m-group { margin-bottom: 10px; }
  .m-group-head { display: flex; align-items: baseline; gap: 8px; padding: 6px 4px 4px;
    font-size: 13px; color: #33445c; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
  .m-group-head span { color: var(--muted); font-size: 11.5px; font-weight: 400; }
  .m-cage { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
    margin-bottom: 6px; overflow: hidden; }
  .m-cage-head { display: flex; align-items: center; gap: 4px; padding: 6px 7px;
    background: #f7f9fc; border-bottom: 1px solid var(--line); }
  .m-cage-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .m-cage-title b { font-size: 13px; }
  .m-cage-title span { font-size: 11px; color: var(--muted); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .m-cage-head .m-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
  .m-icon { border: 0; background: transparent; font-size: 16px; padding: 3px 6px;
    border-radius: 6px; color: #3b4a5e; position: relative; min-width: 34px; min-height: 34px; }
  .m-icon:active { background: #e8eefb; }
  .m-icon i { font-style: normal; font-size: 9px; background: var(--accent); color: #fff;
    border-radius: 8px; padding: 0 4px; position: absolute; top: -2px; right: -1px; }
  .m-mice { display: flex; flex-direction: column; }
  .m-mouse { display: flex; align-items: flex-start; gap: 6px; padding: 7px 8px;
    border-bottom: 1px dashed var(--line); }
  .m-mouse:last-child { border-bottom: 0; }
  .m-mouse.selected { background: #eef4ff; }
  .m-mouse > input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; }
  .m-mouse .m-main { flex: 1; min-width: 0; }
  .m-mouse .m-code { font-weight: 600; font-size: 13.5px; color: var(--accent); text-decoration: none; }
  .m-mouse .m-sub { color: var(--muted); font-size: 11px; margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-mouse .m-gt { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
  .m-gt span { background: #eef2fb; color: #2f5ca8; border-radius: 8px; padding: 0 5px;
    font-size: 10.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-mouse .m-note { color: #7b848f; font-size: 11px; max-width: 34%; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .m-empty { padding: 10px 9px; color: var(--muted); font-size: 12px; }
  .m-cage-note { padding: 5px 9px; border-top: 1px dashed var(--line); background: #fcfdfe;
    color: #5c6a7c; font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
  .m-more { grid-template-columns: 1fr 1fr; }
  .toast { bottom: calc(70px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }

  /* 已处死 / 全局：手机卡片 */
  .m-eall { display: flex; margin: 2px 2px 8px; font-size: 12px; }
  .e-card { display: flex; align-items: flex-start; gap: 8px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; }
  .e-card.selected { background: #eef4ff; }
  .e-card > input { margin-top: 3px; width: 16px; height: 16px; }
  .e-card .e-main { flex: 1; min-width: 0; }
  .e-card .e-main a { font-weight: 600; font-size: 13.5px; color: var(--accent); text-decoration: none; }
  .e-card .e-why { margin-top: 3px; color: #7a4a00; background: #fff7e8; border-radius: 5px;
    padding: 2px 6px; font-size: 11px; display: inline-block; }
  .g-list { display: flex; flex-direction: column; gap: 6px; }
  .g-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
  .g-card-head { display: flex; align-items: center; gap: 4px; }
  .g-card-head a { font-weight: 600; font-size: 13.5px; color: var(--accent); text-decoration: none; }
  .g-card-head .g-strain { margin-left: auto; color: var(--muted); font-size: 11.5px;
    background: #f0f3f8; border-radius: 8px; padding: 0 6px; }
  .g-card .m-sub { margin-top: 3px; }
}