:root {
  --paper: #f5f3ec;
  --card: #fffdf8;
  --ink: #1f2a25;
  --ink-2: #4c5852;
  --muted: #7d8781;
  --line: #e2ddd0;
  --line-2: #cfc8b7;
  --accent: #2e6a4c;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee6;
  --rust: #a8472c;
  --rust-soft: #f6e4dc;
  --fn: #2e6a4c;   --fn-soft: #e3eee6;
  --loc: #2f5d86;  --loc-soft: #e2ebf3;
  --exp: #9a6a12;  --exp-soft: #f5ecd6;
  --radius: 10px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
  --serif: 'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', serif;
  --sans: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.65 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar { background: var(--ink); color: #eef1ec; position: sticky; top: 0; z-index: 20; }
.topbar .inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; height: 56px; }
.brand { display: flex; align-items: baseline; gap: 10px; color: #fff; white-space: nowrap; }
.brand b { font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.brand span { font-size: 12px; color: #a8b6ad; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #c9d3cc; padding: 6px 11px; border-radius: 7px; white-space: nowrap; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.who { position: relative; }
.who > button { background: none; border: 1px solid rgba(255,255,255,.22); color: #eef1ec; border-radius: 999px; padding: 4px 12px; cursor: pointer; white-space: nowrap; font-size: 13px; }
.who .menu { position: absolute; right: 0; top: 40px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 150px; padding: 6px; }
.who .menu a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.who .menu a:hover { background: var(--paper); text-decoration: none; }

/* ---------- 布局 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 26px 20px 80px; }
h1 { font-family: var(--serif); font-size: 26px; margin: 0 0 4px; font-weight: 700; letter-spacing: .02em; }
h2 { font-family: var(--serif); font-size: 18px; margin: 0; font-weight: 700; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.section { margin-top: 22px; }
.section > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.section > .head .count { color: var(--muted); font-size: 13px; margin-left: 8px; font-family: var(--sans); font-weight: 400; }
.section > .body { padding: 6px 18px 12px; }
.empty { color: var(--muted); padding: 14px 0; font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--card); border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: 14px; white-space: nowrap; line-height: 1.4; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--rust); border-color: #e3c3b7; }
.btn.danger:hover { background: var(--rust-soft); }
.btn.sm { padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.link-btn.danger { color: var(--rust); }
.link-btn:hover { text-decoration: underline; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 6px; }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: 8px 11px; outline: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.row.r3 { grid-template-columns: 1fr 1fr 1fr; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.hint.warn { color: var(--exp); }
.err { color: var(--rust); font-size: 13.5px; margin: 0 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg label { padding: 6px 14px; cursor: pointer; border-left: 1px solid var(--line-2); font-size: 14px; background: #fff; }
.seg label:first-child { border-left: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-pick button { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 13px; }
.chips-pick button.on { background: var(--loc); border-color: var(--loc); color: #fff; }
.chips-pick.stage button.on { background: var(--exp); border-color: var(--exp); }

/* ---------- 搜索栏 ---------- */
.searchbar { padding: 16px; display: grid; gap: 12px; }
.searchbar .q { position: relative; }
.searchbar .q input { padding: 11px 14px 11px 40px; font-size: 16px; border-radius: 10px; }
.searchbar .q svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select { width: auto; min-width: 120px; padding: 6px 10px; font-size: 14px; }
.filters label.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); cursor: pointer; }

/* ---------- 列表 ---------- */
.list { margin-top: 16px; }
.list .meta { color: var(--muted); font-size: 13px; margin: 0 0 8px 2px; }
.item { display: block; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.item:last-child { border-bottom: 0; }
a.item:hover { background: #fbf9f3; text-decoration: none; }
.item .t { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item .gid { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.item .nm { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.item .sum { color: var(--ink-2); font-size: 14px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.counts { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.counts b { font-weight: 600; color: var(--ink-2); }
.more { text-align: center; padding: 14px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; font-size: 12px; line-height: 1.5; padding: 0 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag.fn { background: var(--fn-soft); border-color: transparent; color: var(--fn); }
.tag.loc { background: var(--loc-soft); border-color: transparent; color: var(--loc); }
.tag.exp, .tag.stage { background: var(--exp-soft); border-color: transparent; color: var(--exp); }
.tag.warn { background: var(--rust-soft); border-color: transparent; color: var(--rust); }
.tag.role-admin { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag.role-editor { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.mol { font-family: var(--mono); font-size: 11px; }

/* ---------- 详情页 ---------- */
.hero { padding: 22px 24px; }
.hero .idline { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero .bigid { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.hero .bigname { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.hero .facts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.hero .facts span b { color: var(--muted); font-weight: 400; margin-right: 6px; }
.hero .summary { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.hero .bar { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.notice { background: var(--exp-soft); color: #6b4b0d; padding: 9px 14px; border-radius: 8px; font-size: 14px; margin-top: 14px; }
.paper-title { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.45; margin: 0; }

.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 12px 10px; cursor: pointer; font-size: 15px; color: var(--muted); border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabs button .n { font-size: 12px; margin-left: 4px; color: var(--muted); font-weight: 400; }

.finding { padding: 13px 0; border-bottom: 1px solid var(--line); }
.finding:last-child { border-bottom: 0; }
.finding .c { display: flex; gap: 8px; align-items: baseline; }
.finding .c .tx { flex: 1; }
.finding .chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.finding .ev { font-size: 13px; color: var(--ink-2); margin-top: 6px; display: grid; gap: 2px; }
.finding .ev b { font-weight: 400; color: var(--muted); margin-right: 6px; }
.finding .src { font-size: 13px; margin-top: 6px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.finding .ops { display: flex; gap: 12px; }
.genegroup { padding: 12px 0 4px; }
.genegroup > .gh { font-weight: 600; margin-bottom: 2px; }

.rel { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.rel:last-child { border-bottom: 0; }
.rel .arrow { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.rel .note { grid-column: 2; font-size: 13.5px; color: var(--ink-2); }
.rel .src { grid-column: 2; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid2 > .section { margin-top: 22px; }

/* ---------- 编辑记录 ---------- */
.logrow { padding: 11px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 14px; }
.logrow:last-child { border-bottom: 0; }
.logrow .when { color: var(--muted); font-size: 13px; }
.logrow .what { font-size: 14px; }
.logrow .act { font-weight: 600; margin-right: 6px; }
.act-create { color: var(--accent); } .act-update { color: var(--loc); } .act-delete { color: var(--rust); } .act-restore { color: var(--exp); }
.diff { margin-top: 6px; font-size: 13px; background: var(--paper); border-radius: 8px; padding: 8px 12px; display: grid; gap: 4px; }
.diff .k { color: var(--muted); margin-right: 8px; }
.diff del { color: var(--rust); background: var(--rust-soft); text-decoration: line-through; padding: 0 3px; border-radius: 3px; }
.diff ins { color: var(--accent); background: var(--accent-soft); text-decoration: none; padding: 0 3px; border-radius: 3px; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-weight: 600; color: var(--muted); font-size: 13px; }
.tbl tr:last-child td { border-bottom: 0; }

/* ---------- 弹窗 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(24, 32, 28, .42); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.modal .mh { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal .mh h2 { font-size: 17px; }
.modal .mh .x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal .mb { padding: 18px 22px 6px; }
.modal .mf { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.modal .ctx { background: var(--paper); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 14px; color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }
.toast.bad { background: var(--rust); }

/* ---------- 登录 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .card { width: 100%; max-width: 400px; padding: 30px 30px 22px; }
.auth h1 { font-size: 24px; text-align: center; }
.auth .lead { text-align: center; color: var(--muted); margin: 4px 0 24px; font-size: 14px; }
.auth .btn.primary { width: 100%; justify-content: center; padding: 10px; font-size: 15px; margin-top: 4px; }
.auth .foot { text-align: center; margin-top: 16px; font-size: 13px; }
.mark { width: 42px; height: 42px; margin: 0 auto 12px; display: block; }

.loading { color: var(--muted); padding: 40px 0; text-align: center; }

@media (max-width: 760px) {
  .topbar .inner { gap: 4px 12px; padding: 8px 12px 0; height: auto; flex-wrap: wrap; }
  .brand { flex: 1; }
  .brand b { font-size: 17px; }
  .brand span { display: none; }
  .nav { order: 3; flex: 0 0 100%; padding-bottom: 6px; }
  main { padding: 18px 12px 60px; }
  .row, .row.r3, .grid2 { grid-template-columns: 1fr; }
  .grid2 { gap: 0; }
  .hero { padding: 18px; }
  .hero .bigid { font-size: 21px; }
  .hero .bigname { font-size: 20px; }
  .logrow { grid-template-columns: 1fr; gap: 2px; }
  .item, .section > .head, .section > .body { padding-left: 14px; padding-right: 14px; }
  .who > button { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
