/* ===================================================================
   合规与合同智能审查智能体 V5 · 界面样式
   设计取向：法务纸张质感 —— 米白底、墨黑字、朱砂点睛、细边框、直角
   =================================================================== */

:root {
  --paper: #f4f1ea;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --ink: #191817;
  --ink-2: #4b4843;
  --ink-3: #837e73;
  --line: #ddd6c6;
  --line-2: #cec5b1;
  --accent: #8c1d18;
  --accent-2: #a8332b;
  --accent-soft: #f2e5e1;
  --high: #a12b24;
  --medium: #a0701b;
  --low: #3d6a61;
  --ok: #3d6a61;
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.06);
  --accent-solid: #8c1d18;
  --high-bg: #a12b24;
  --medium-bg: #a0701b;
  --low-bg: #3d6a61;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --serif: "Songti SC", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
}

[data-theme="dark"] {
  --paper: #14140f;
  --surface: #1b1b16;
  --surface-2: #202019;
  --ink: #ece7dc;
  --ink-2: #b9b3a5;
  --ink-3: #8b8474;
  --line: #33322a;
  --line-2: #454336;
  --accent: #d4645a;
  --accent-2: #e08278;
  --accent-soft: #2b1d1a;
  --high: #e0756b;
  --medium: #d6a24a;
  --low: #6fb3a6;
  --ok: #6fb3a6;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --accent-solid: #9c2f27;
  --high-bg: #8b3a33;
  --medium-bg: #7d5b14;
  --low-bg: #2c554d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 3px solid var(--paper); border-radius: 6px; }

/* ---------------- 布局 ---------------- */
.app { display: grid; grid-template-columns: 208px 1fr; height: 100vh; overflow: hidden; }

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; flex-direction: column;
  padding: 22px 0 14px;
}
.brand { padding: 0 20px 20px; border-bottom: 1px solid var(--line); }
.brand .mark {
  font-family: var(--serif);
  font-size: 17px; letter-spacing: 1px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.brand .mark::before {
  content: ""; width: 4px; height: 18px; background: var(--accent); display: inline-block;
}
.brand .sub {
  font-size: 11px; color: var(--ink-3); margin-top: 7px; letter-spacing: 0.5px;
}

.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 10.5px; letter-spacing: 1.2px; color: var(--ink-3); padding: 12px 10px 6px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin-bottom: 1px;
  font-size: 13.2px; color: var(--ink-2);
  border-left: 2px solid transparent;
}
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active {
  color: var(--accent); border-left-color: var(--accent);
  background: var(--surface); font-weight: 600;
}
.nav a .ico { width: 15px; text-align: center; opacity: 0.8; font-size: 12px; }
.nav a svg {
  flex: 0 0 15px; width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 1.25;
  stroke-linecap: round; stroke-linejoin: round; opacity: .8;
}
.nav a.active svg { opacity: 1; }

.side-foot { padding: 12px 20px 0; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); line-height: 1.7; }

.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 54px; flex: 0 0 54px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; background: var(--surface);
}
.topbar h1 { font-family: var(--serif); font-size: 15px; font-weight: 700; margin: 0; letter-spacing: 0.5px; }
.topbar .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }

.view { flex: 1; overflow-y: auto; padding: 24px 26px 60px; }
.view.wide { padding: 0; }

/* ---------------- 通用元素 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--surface);
  padding: 6px 13px; cursor: pointer; font-size: 12.6px;
  color: var(--ink-2); border-radius: 2px; transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.btn.primary:hover { background: #a8332b; border-color: #a8332b; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 11.6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { color: var(--high); border-color: var(--high); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 2px; box-shadow: var(--shadow);
}
.card-h {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-h h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.4px; }
.card-h .hint { font-size: 11.4px; color: var(--ink-3); }
.card-b { padding: 16px; }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g2, .g3 { grid-template-columns: 1fr; } }

.stat { padding: 15px 16px; }
.stat .k { font-size: 11.4px; color: var(--ink-3); letter-spacing: .4px; }
.stat .v { font-family: var(--serif); font-size: 27px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.stat .v small { font-family: var(--sans); font-size: 11.5px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.stat .d { font-size: 11.4px; color: var(--ink-3); margin-top: 6px; }

.badge {
  display: inline-block; padding: 1px 6px; font-size: 11px; line-height: 1.6;
  border: 1px solid var(--line-2); border-radius: 2px; color: var(--ink-2);
  background: var(--surface-2); white-space: nowrap;
}
.badge.high { color: #fff; background: var(--high-bg); border-color: var(--high-bg); }
.badge.medium { color: #fff; background: var(--medium-bg); border-color: var(--medium-bg); }
.badge.low { color: #fff; background: var(--low-bg); border-color: var(--low-bg); }
.badge.soft { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 11.4px;
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); background: var(--surface-2);
  letter-spacing: .3px; white-space: nowrap;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tr:hover td { background: var(--surface-2); }
table.tbl tr.rowlink { cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11.4px; }
.mut { color: var(--ink-3); }
.small { font-size: 11.6px; }
.nowrap { white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); font-size: 12.6px; }

/* ---------------- 上传区 ---------------- */
.drop {
  border: 1px dashed var(--line-2); border-radius: 2px; padding: 26px;
  text-align: center; background: var(--surface-2); cursor: pointer; transition: all .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-family: var(--serif); font-size: 15px; margin-bottom: 6px; }
.drop .sm { font-size: 11.8px; color: var(--ink-3); }

/* ---------------- 流水线 ---------------- */
.pipe { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--line); background: var(--surface); }
.pipe .step {
  flex: 1; padding: 10px 12px; border-right: 1px solid var(--line); position: relative;
}
.pipe .step:last-child { border-right: none; }
.pipe .step .nm { font-size: 11.6px; color: var(--ink-3); letter-spacing: .5px; }
.pipe .step .nm::before { content: "○"; margin-right: 5px; font-size: 10px; }
.pipe .step.done .nm::before { content: "●"; color: var(--ok); }
.pipe .step.active .nm::before { content: "◐"; color: var(--accent); }
.pipe .step .st { font-size: 12.6px; font-weight: 600; margin-top: 4px; }
.pipe .step.done { background: var(--surface-2); }
.pipe .step.done .st { color: var(--ok); }
.pipe .step.active { background: var(--accent-soft); }
.pipe .step.active .st { color: var(--accent); }
.pipe .step.active::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent);
  animation: scan 1.4s linear infinite; width: 40%;
}
@keyframes scan { 0% { left: 0 } 100% { left: 60% } }

.log {
  font-family: var(--mono); font-size: 11.4px; line-height: 1.85;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 10px 12px; max-height: 168px; overflow-y: auto; color: var(--ink-2);
}
.log .t { color: var(--ink-3); margin-right: 6px; }
.log .s-L1 { color: #6b7f9a } .log .s-L2 { color: #7d6b9a }
.log .s-L3 { color: #9a6b7d } .log .s-L4 { color: #9a856b } .log .s-L5 { color: var(--ok) }

/* ---------------- 条款双栏 ---------------- */
.split { display: grid; grid-template-columns: 348px 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.clause-list { max-height: calc(100vh - 300px); overflow-y: auto; }
.clause-item {
  padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-left: 2px solid transparent;
}
.clause-item:hover { background: var(--surface-2); }
.clause-item.active { background: var(--accent-soft); border-left-color: var(--accent); }
.clause-item .h {
  display: flex; align-items: center; gap: 6px; justify-content: space-between;
  font-size: 12.4px; font-weight: 600; margin-bottom: 4px;
}
.clause-item .h .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clause-item .p { font-size: 11.4px; color: var(--ink-3); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clause-item .meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; }

.conf { width: 44px; height: 3px; background: var(--line); position: relative; }
.conf i { position: absolute; left: 0; top: 0; height: 100%; background: var(--ink-3); display: block; }
.conf.low i { background: var(--high); }

.doc-text {
  font-family: var(--serif); font-size: 14.6px; line-height: 2.05; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
.doc-text mark {
  background: var(--accent-soft); color: inherit; border-bottom: 2px solid var(--accent);
  padding: 1px 1px; scroll-margin: 80px;
}
.doc-text mark.med { border-bottom-color: var(--medium); background: rgba(160,112,27,.13); }

.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 12px; font-size: 12.4px; }
.kv .k { color: var(--ink-3); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2);
}

/* ---------------- 风险项 ---------------- */
.finding {
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
  background: var(--surface); padding: 11px 13px; margin-bottom: 8px; cursor: pointer;
}
.finding:hover { background: var(--surface-2); }
.finding.high { border-left-color: var(--high); }
.finding.medium { border-left-color: var(--medium); }
.finding.low { border-left-color: var(--low); }
.finding .top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.finding .ttl { font-size: 13px; font-weight: 600; }
.finding .bd { font-size: 12.4px; color: var(--ink-2); line-height: 1.75; }
.finding .quote {
  font-family: var(--serif); font-size: 12.4px; color: var(--ink-2);
  border-left: 2px solid var(--line-2); padding: 2px 0 2px 9px; margin-top: 7px;
  background: var(--surface-2);
}
.finding .fix {
  font-size: 11.6px; color: var(--ink-3); margin-top: 6px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.finding .chain { font-family: var(--mono); font-size: 10.8px; color: var(--ink-3); margin-top: 7px; word-break: break-all; }

/* 人工复核：被判定误报的条目保留可追溯，但视觉上退到背景 */
.finding.dismissed { opacity: .62; border-left-color: var(--line-2); }
.finding .rv-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: 11px;
}
.finding .rv-bar .mut { font-size: 11px; }
.badge.ok { color: #fff; background: var(--ok, #2f7d55); border-color: var(--ok, #2f7d55); }
.badge.warn { color: var(--warn, #a06a1c); border-color: var(--warn, #a06a1c); background: transparent; }

/* ---------------- 分页标签 ---------------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 9px 15px; cursor: pointer; font-size: 13px; color: var(--ink-3);
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .cnt { font-size: 10.6px; opacity: .7; margin-left: 4px; }

/* ---------------- 指标条 ---------------- */
.metric-row { display: flex; gap: 22px; flex-wrap: wrap; }
.metric { min-width: 128px; }
.metric .k { font-size: 11px; color: var(--ink-3); }
.metric .v { font-family: var(--mono); font-size: 17px; margin-top: 3px; }
.metric .v.ok { color: var(--ok); }

/* ---------------- 条形图 ---------------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 108px 1fr 42px; gap: 10px; align-items: center; font-size: 12.2px; }
.bar-track { height: 6px; background: var(--line); position: relative; }
.bar-fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); opacity: .75; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.8px; color: var(--ink-3); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-2);
  background: var(--surface); border-radius: 2px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .note { font-size: 11px; color: var(--ink-3); margin-top: 4px; line-height: 1.6; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 单选项（设置页 · 判定通道） */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; gap: 9px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 2px; padding: 9px 11px;
  background: var(--surface); transition: border-color .12s, background .12s;
}
.opt:hover { border-color: var(--ink-3); }
.opt.on { border-color: var(--accent); background: var(--accent-soft, rgba(178,58,49,.05)); }
.opt input { margin-top: 3px; accent-color: var(--accent-solid); }
.opt span { display: flex; flex-direction: column; gap: 2px; line-height: 1.55; }
.opt b { font-size: 12.4px; font-weight: 600; }
.opt i { font-style: normal; font-size: 11px; color: var(--ink-3); }

/* ---------------- Toast / Modal ---------------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast {
  background: var(--ink); color: var(--paper); padding: 9px 14px; font-size: 12.4px;
  border-left: 3px solid var(--accent); max-width: 360px; animation: slide .18s ease-out;
}
[data-theme="dark"] .toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
@keyframes slide { from { transform: translateY(8px); opacity: 0 } }

#modal { position: fixed; inset: 0; background: rgba(20,18,14,.42); display: none; align-items: center; justify-content: center; z-index: 95; padding: 20px; }
#modal.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--line-2); width: 620px; max-width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.modal-h { padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-h h3 { margin: 0; font-size: 13.4px; font-family: var(--serif); }
.modal-b { padding: 18px; }
.modal-f {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: var(--surface); z-index: 2;
}
.x { background: none; border: none; cursor: pointer; color: var(--ink-3); font-size: 17px; line-height: 1; }

/* ---------------- 报告 ---------------- */
.report {
  font-family: var(--serif); font-size: 14px; line-height: 2.05; max-width: 860px;
}
.report h2 { font-size: 15px; margin: 26px 0 10px; padding-left: 10px; border-left: 3px solid var(--accent); font-weight: 700; }
.report h2:first-child { margin-top: 0; }
.report p { margin: 0 0 10px; white-space: pre-wrap; text-align: justify; }
.report .lead { font-size: 15px; background: var(--surface-2); border: 1px solid var(--line); padding: 14px 16px; }

/* ---------------- 图谱 ---------------- */
.node-card { border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; margin-bottom: 10px; }
.node-card.superseded { opacity: .62; }
.node-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.node-card .id { font-family: var(--mono); font-size: 10.8px; color: var(--ink-3); }
.node-card .lbl { font-size: 13px; font-weight: 600; margin: 3px 0 5px; }
.node-card .body { font-size: 12.2px; color: var(--ink-2); line-height: 1.7; }
.node-card .win { font-family: var(--mono); font-size: 10.6px; color: var(--ink-3); margin-top: 6px; }
.chain { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.chain .n { border: 1px solid var(--line-2); padding: 3px 8px; background: var(--surface-2); font-family: var(--mono); font-size: 11px; }
.chain .arw { color: var(--ink-3); font-size: 11px; }

.tag-type { font-size: 10.6px; letter-spacing: .5px; padding: 1px 5px; border: 1px solid var(--line-2); color: var(--ink-3); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg) } }

/* ---------------- 案例库 ---------------- */
.case-item {
  border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .14s, background .14s;
}
.case-item:hover { border-color: var(--line-2); background: var(--surface-2); }
.case-hd { display: flex; gap: 10px; align-items: flex-start; }
.case-badge {
  flex: none; font-size: 10.4px; letter-spacing: .6px; padding: 2px 6px; margin-top: 2px;
  border: 1px solid var(--accent); color: var(--accent); font-family: var(--mono);
}
.case-ttl { font-size: 13.4px; font-weight: 600; line-height: 1.5; }
.case-sub { font-size: 12.2px; color: var(--ink-2); margin-top: 3px; line-height: 1.6; }
.case-time { flex: none; font-size: 11px; color: var(--ink-3); }
.case-focus {
  font-size: 12px; color: var(--ink-2); margin: 9px 0 8px; padding-left: 10px;
  border-left: 2px solid var(--accent-soft); line-height: 1.72;
}
.case-ft { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 10.8px; padding: 1px 6px; border: 1px solid var(--line-2);
  color: var(--ink-3); background: var(--surface-2); white-space: nowrap;
}
.caselink { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.caselink:hover { color: var(--accent-2); }

/* 案例详情 */
.sec-t {
  font-size: 11px; letter-spacing: 1.2px; color: var(--accent); margin: 18px 0 7px;
  padding-bottom: 4px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.sec-p { font-size: 13.2px; line-height: 1.92; color: var(--ink-2); margin: 0; text-align: justify; font-family: var(--serif); }
.sec-p.lesson { background: var(--surface-2); border-left: 2px solid var(--accent); padding: 10px 13px; color: var(--ink); }
.sec-ol { margin: 0; padding-left: 20px; font-size: 13.2px; line-height: 1.92; color: var(--ink-2); font-family: var(--serif); }
.sec-ol li { margin-bottom: 4px; text-align: justify; }
.link-row {
  display: flex; gap: 9px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.link-row:last-child { border-bottom: none; }

/* 风险清单里的判例引用 */
.caseline { margin-top: 4px; }
.caseref { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); }
.caseref:hover { color: var(--accent-2); }

/* ---------------- 能力与合作 ---------------- */
.req-quote {
  margin: 0; padding: 14px 18px; background: var(--surface-2);
  border-left: 3px solid var(--accent); font-family: var(--serif);
  font-size: 14.2px; line-height: 1.95; color: var(--ink);
}
.cap-lead {
  font-size: 12.6px; line-height: 1.85; color: var(--ink-2);
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.cap-item {
  border: 1px solid var(--line); background: var(--surface);
  padding: 12px 14px; margin-bottom: 10px;
}
.cap-item:last-child { margin-bottom: 0; }
.cap-hd { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cap-status.ok { border-color: var(--ok); color: var(--ok); }
.cap-status.mid { border-color: var(--medium); color: var(--medium); }
.cap-title { font-size: 13.2px; font-weight: 600; }
.cap-req {
  font-size: 10.8px; color: var(--ink-3); margin-left: auto;
  letter-spacing: .3px; white-space: nowrap;
}
.cap-how { font-size: 12.6px; line-height: 1.9; color: var(--ink-2); margin-top: 7px; text-align: justify; }
.cap-ev { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.cap-partner {
  margin-top: 9px; padding: 8px 10px; font-size: 12.2px; line-height: 1.8;
  background: var(--accent-soft); color: var(--ink); border-left: 2px solid var(--accent);
  text-align: justify;
}
.cap-partner b { color: var(--accent); letter-spacing: .5px; }
.cap-files {
  margin-top: 8px; font-family: var(--mono); font-size: 10.6px;
  color: var(--ink-3); word-break: break-all;
}

/* 风险清单：建议改法（可直接替换的示范表述） */
.finding .sugline {
  font-size: 12.2px; line-height: 1.85; margin-top: 7px; padding: 8px 11px;
  background: var(--surface-2); border-left: 2px solid var(--accent);
  color: var(--ink); text-align: justify;
}
.finding .sugline b { color: var(--accent); font-weight: 700; letter-spacing: .5px; }

/* ---------------- 移动端适配 ---------------- */
/* 汉堡按钮：桌面端不显示，窄屏才出现 */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-right: 10px;
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 2px; cursor: pointer; color: var(--ink-2);
}
.nav-toggle svg { width: 16px; height: 16px; }
.nav-toggle:hover { border-color: var(--ink-3); color: var(--ink); }

.nav-scrim {
  position: fixed; inset: 0; background: rgba(28, 24, 20, .38);
  z-index: 40; backdrop-filter: blur(1px);
}

@media (max-width: 760px) {
  /* 整体改为单列纵向，允许页面自然滚动 */
  .app {
    grid-template-columns: minmax(0, 1fr);
    height: auto; min-height: 100vh;
    overflow: visible;
  }

  /* 侧栏变抽屉：默认移出屏幕，点汉堡滑入 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 258px; max-width: 82vw;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 2px 0 18px rgba(28, 24, 20, .16);
    overflow-y: auto;
  }
  .app.nav-open .sidebar { transform: translateX(0); }

  .nav-toggle { display: inline-flex; }

  .main { overflow: visible; }
  .topbar {
    height: 50px; flex: 0 0 50px;
    padding: 0 14px;
    position: sticky; top: 0; z-index: 30;
  }
  .topbar h1 { font-size: 14px; }
  .topbar .right { gap: 8px; }
  .topbar .right .small { display: none; }

  .view { padding: 14px 14px 48px; overflow: visible; }
  .view.wide { padding: 0 0 40px; }

  /* 所有网格改单列 */
  .g2, .g3, .g4 { grid-template-columns: 1fr !important; }
  .split { grid-template-columns: 1fr !important; }

  /* 表格：横向滚动而不是压扁 */
  .card-b { padding: 13px; }
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table thead, table tbody { display: table; width: 100%; min-width: 520px; }
  table thead tr, table tbody tr { display: table-row; }

  /* 条形图/统计卡在窄屏更紧凑 */
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 23px; }

  /* 条款列表高度限制在移动端放开，避免双滚动 */
  .clause-list { max-height: none; }

  /* 弹窗适配 */
  .modal-box { width: 94vw !important; max-height: 86vh; overflow-y: auto; }

  /* 按钮组换行，避免挤出屏幕 */
  .row { flex-wrap: wrap; }

  /* 触摸目标略放大，符合移动端习惯 */
  .btn { padding: 8px 14px; }
  .btn.sm { padding: 5px 10px; }
  .nav a { padding: 11px 10px; font-size: 14px; }
}

/* 横屏手机 / 小平板 */
@media (min-width: 761px) and (max-width: 1024px) {
  .app { grid-template-columns: 176px 1fr; }
  .view { padding: 18px 18px 50px; }
  .brand .mark { font-size: 15px; }
}

/* 移动端防溢出：grid/flex 子项默认 min-width:auto，长内容会把布局撑破 */
.main, .view, .card, .card-b, .split > * { min-width: 0; }
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  /* 长串（链接、哈希、英文单词）在窄屏强制换行，避免横向滚动 */
  .view { overflow-wrap: anywhere; }
  /* 代码块横向滚动而不是撑破页面 */
  pre, code { max-width: 100%; overflow-x: auto; }
}

/* 移动端表格：右侧渐隐，暗示可以左右滑动 */
@media (max-width: 760px) {
  .card-b:has(table) {
    position: relative;
  }
  .card-b:has(table)::after {
    content: "";
    position: absolute; right: 0; top: 0; bottom: 0; width: 20px;
    background: linear-gradient(to right, transparent, var(--surface));
    pointer-events: none;
    border-radius: 0 2px 2px 0;
  }
  /* 表格本身已有 overflow-x:auto，这里保证滚动条不占布局高度 */
  table::-webkit-scrollbar { height: 3px; }
  table::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }
}

/* 厂商预设的「协同」态：底色 + 描边都用实红，否则 --accent-soft(#f2e5e1) 在浅底上几乎看不见 */
.btn.collab {
  border: 1.5px solid var(--accent);
  color: var(--accent-solid);
  background: rgba(140, 29, 24, .13);
  font-weight: 600;
}
.btn.collab:hover {
  background: rgba(140, 29, 24, .2);
  border-color: var(--accent-solid);
}
[data-theme="dark"] .btn.collab {
  color: #f0b5ae;
  background: rgba(212, 100, 90, .2);
  border-color: #d4645a;
}
[data-theme="dark"] .btn.collab:hover { background: rgba(212, 100, 90, .3); }

/* 主判/协同角标 */
.chip-tag {
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  padding: 2px 4px;
  margin-left: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .3);
  letter-spacing: .3px;
}
.btn.collab .chip-tag {
  background: rgba(140, 29, 24, .16);
  color: var(--accent-solid);
}

/* 多选标签组（公司要求的适用条款类型） */
.chks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r);
  font-size: 12.5px; cursor: pointer; background: var(--card);
  transition: border-color .15s, background .15s, color .15s;
}
.chk:hover { border-color: var(--ink-3); }
.chk input { accent-color: var(--accent-solid); margin: 0; }
.chk:has(input:checked) {
  border-color: var(--accent); color: var(--accent-solid);
  background: rgba(140, 29, 24, .1); font-weight: 600;
}

/* ==================== 视觉优化层 ====================
   这一层统一收口标签、表格、卡片的观感。
   放在文件末尾是有意的：同特异性下后写生效，避免回头改前面几十处散落的规则。 */

/* ---- 标签：此前只有 .tag-type，.tag 从未定义，
       导致「高/中/低」「合法/存疑」全是裸文字挤在一起 ---- */
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.8px; line-height: 1; font-weight: 600;
  padding: 3px 6px; border-radius: 2px;
  background: var(--surface-2); color: var(--ink-3);
  border: 1px solid var(--line-2);
  white-space: nowrap; letter-spacing: .2px;
}
.tag.high   { color: var(--high);   background: color-mix(in srgb, var(--high) 8%, var(--surface));   border-color: color-mix(in srgb, var(--high) 26%, var(--line)); }
.tag.medium { color: var(--medium); background: color-mix(in srgb, var(--medium) 9%, var(--surface)); border-color: color-mix(in srgb, var(--medium) 26%, var(--line)); }
.tag.low    { color: var(--low);    background: color-mix(in srgb, var(--low) 8%, var(--surface));    border-color: color-mix(in srgb, var(--low) 24%, var(--line)); }
.tag.ok     { color: var(--ok);     background: color-mix(in srgb, var(--ok) 8%, var(--surface));     border-color: color-mix(in srgb, var(--ok) 24%, var(--line)); }

/* ---- 卡片：加大留白，阴影分两层做出轻微浮起感 ---- */
.card {
  box-shadow: 0 1px 1px rgba(30, 25, 15, .04), 0 2px 10px rgba(30, 25, 15, .035);
  transition: box-shadow .18s;
}
.card:hover { box-shadow: 0 1px 2px rgba(30, 25, 15, .05), 0 4px 16px rgba(30, 25, 15, .05); }
.card-h { padding: 13px 18px; }
.card-b { padding: 18px; }

/* ---- 表格：加行高与内边距，让密排的数字和标签能喘口气 ---- */
table.tbl th { padding: 10px 12px; }
table.tbl td { padding: 12px; line-height: 1.55; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .12s; }

/* ---- 输入类控件：统一高度与聚焦态，避免各页面高低不齐 ---- */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  transition: border-color .14s, box-shadow .14s;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ---- 危险按钮：默认不该抢戏，只在悬停时露出红色 ---- */
.btn.danger { color: var(--ink-3); border-color: var(--line-2); background: transparent; }
.btn.danger:hover { color: var(--high); border-color: var(--high); background: color-mix(in srgb, var(--high) 7%, transparent); }

/* ---- 公司要求表格：名称与元信息分行，属性标签成组 ---- */
.cr-table td { vertical-align: middle; }
.cr-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.cr-meta { margin-top: 3px; font-size: 11.4px; }
.cr-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.cr-acts { display: flex; gap: 6px; }

/* ---- 空状态：给个更柔和的样子，而不是干巴巴一行字 ---- */
.empty {
  padding: 44px 16px; text-align: center; color: var(--ink-3); font-size: 12.6px;
  border-radius: 2px;
}

/* ---- 页面顶部标题区与内容之间的呼吸 ---- */
.view > .card + .card,
.view > .grid + .card,
.view > .card + .grid { margin-top: 16px; }

/* ---- 运行统计条：给长表单页一个视觉落点 ---- */
.stat-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  margin-bottom: 4px;
}
@media (max-width: 1100px) { .stat-strip { grid-template-columns: repeat(3, 1fr); } }
.stat-cell {
  background: var(--surface-2); padding: 11px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-cell b {
  font-size: 17px; font-weight: 700; line-height: 1.15;
  font-family: var(--mono); color: var(--ink);
  display: flex; align-items: baseline; gap: 2px;
}
.stat-cell b i { font-style: normal; font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.stat-cell b.ok { color: var(--ok); }
.stat-cell b.warn { color: var(--medium); }
.stat-cell b.bad { color: var(--high); }
.stat-cell span { font-size: 10.8px; color: var(--ink-3); letter-spacing: .2px; }

/* ==================== 动效与微交互层 ====================
   补齐设计规范里最容易遗漏的部分：状态反馈。
   原则：动效只用于传达信息（层级变化、操作反馈），不做装饰。
   同时遵守 prefers-reduced-motion —— 用户关掉动画时全部失效。 */

:root {
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-decelerate: cubic-bezier(0, 0, .2, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
}

/* 按钮：按下时轻微下沉，给点击一个物理反馈 */
.btn { transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary:active:not(:disabled) { filter: brightness(.94); }

/* 小按钮保证可点：原 3px 内边距太扁，鼠标容易点空 */
.btn.sm { min-height: 26px; padding: 4px 10px; }

/* 页面切换：淡入 + 轻移，避免内容"啪"地闪现 */
.view { animation: viewIn var(--dur-base) var(--ease-decelerate); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 表格行：hover 已变色，补一个按下反馈 */
table.tbl tbody tr:active td { background: var(--line); }

/* 输入框聚焦环已有；补一个 invalid 态的视觉提示 */
input:invalid:not(:placeholder-shown) { border-color: var(--high); }

/* 尊重系统的"减少动效"设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---- 条款列表：左侧色条标示最高风险等级，扫一眼就知道先改哪条 ---- */
.clause-item { border-left-width: 3px; transition: background .12s, border-color .12s; }
.clause-item.risk-high   { border-left-color: var(--high); }
.clause-item.risk-medium { border-left-color: var(--medium); }
.clause-item.risk-low    { border-left-color: var(--low); }
/* 选中态用背景区分，左侧继续显示风险色——风险等级比"当前选中"更重要 */
.clause-item.active { background: var(--accent-soft); }
.clause-item.active.risk-high,
.clause-item.active.risk-medium,
.clause-item.active.risk-low { border-left-color: inherit; }
.clause-item.active.risk-high { border-left-color: var(--high); }
.clause-item.active.risk-medium { border-left-color: var(--medium); }
.clause-item.active.risk-low { border-left-color: var(--low); }
.clause-item.active:not([class*="risk-"]) { border-left-color: var(--accent); }

/* 无风险条款弱化，让有风险的更突出 */
.clause-item:not([class*="risk-"]) .ttl { color: var(--ink-3); font-weight: 500; }

/* ---- 折叠菜单：把"导出/审批/删除"这类低频操作收起来，顶部只留主操作 ---- */
.menu { position: relative; }
.menu > summary { list-style: none; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after {
  content: ""; width: 0; height: 0; margin-left: 2px;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor; opacity: .55;
}
.menu[open] > summary { border-color: var(--ink-3); color: var(--ink); }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 5px); z-index: 40;
  min-width: 158px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 2px 4px rgba(30,25,15,.06), 0 8px 24px rgba(30,25,15,.12);
  display: flex; flex-direction: column;
}
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; font-size: 12.4px; line-height: 1.4;
  color: var(--ink-2); background: none; border: none;
  cursor: pointer; text-decoration: none; font-family: inherit;
  transition: background .1s, color .1s;
}
.menu-item:hover { background: var(--surface-2); color: var(--ink); }
.menu-item.danger { color: var(--high); }
.menu-item.danger:hover { background: color-mix(in srgb, var(--high) 8%, transparent); }

/* ---- 判定链路条：默认收起。五层架构对答辩有用，日常看审查结果时是干扰 ---- */
.pipe-wrap { margin-bottom: 12px; }
.pipe-wrap > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; background: var(--surface);
  border: 1px solid var(--line); font-size: 11.6px;
  transition: border-color .12s, background .12s;
}
.pipe-wrap > summary::-webkit-details-marker { display: none; }
.pipe-wrap > summary:hover { border-color: var(--line-2); background: var(--surface-2); }
.pipe-title { font-weight: 600; color: var(--ink-2); letter-spacing: .3px; }
.pipe-brief { color: var(--ink-3); }
.pipe-more { margin-left: auto; color: var(--accent); font-size: 11px; }
.pipe-wrap[open] > summary { border-bottom-color: transparent; }
.pipe-wrap[open] .pipe-more { color: var(--ink-3); }
.pipe-wrap[open] .pipe-more::after { content: "（已展开）"; }
.pipe-wrap .pipe { margin-top: 0; border-top: none; }

/* ==================== 移动端适配补丁 ====================
   处理手机上的三类具体故障：
   ① 六个 Tab 在 375px 宽度下被挤成竖排（每个字一行）
   ② 「更多」下拉菜单用 right:0 定位，父按钮换行后菜单溢出到屏幕外
   ③ 按钮高度 26px，手指点不准 —— 人工复核按钮"点了没反应"多半是这个原因 */

@media (max-width: 760px) {
  /* ① Tab 横向滑动，绝不换行 */
  .tabs {
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 12px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button {
    white-space: nowrap; flex: 0 0 auto;
    padding: 10px 13px; font-size: 13px;
  }

  /* ② 菜单改成底部抽屉：不依赖父元素位置，永远不会横向溢出 */
  .menu-body {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    max-height: 62vh; overflow-y: auto;
    border: none; border-top: 1px solid var(--line-2);
    box-shadow: 0 -6px 28px rgba(30, 25, 15, .18);
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .menu-item { padding: 15px 12px; font-size: 14px; }
  .menu-item.danger { margin-top: 6px; border-top: 1px solid var(--line); }

  /* ③ 触控尺寸：44px 是人体工学下限，这里取 36/32 兼顾密度 */
  .btn { min-height: 36px; }
  .btn.sm { min-height: 32px; padding: 6px 12px; font-size: 12.2px; }

  /* 顶部操作区：允许换行，每个按钮平分宽度，避免挤成两行参差 */
  #actions { flex-wrap: wrap; width: 100%; gap: 8px; }
  #actions > .btn, #actions > .menu { flex: 1 1 calc(50% - 4px); }
  #actions .menu > summary { width: 100%; justify-content: center; }

  /* 卡片内边距收紧，给内容留出更多横向空间 */
  .card-h { padding: 10px 12px; }
  .card-b { padding: 12px; }
  .card-h h2 { font-size: 12.5px; }
  .card-h .hint { font-size: 10.8px; }

  /* 条款列表在手机上不该独占一屏，压到 38vh 让右侧内容可见 */
  .clause-list { max-height: 38vh; }

  /* 审查详情头部信息更紧凑 */
  .pipe-wrap > summary { padding: 8px 10px; }
  .pipe-brief { font-size: 10.8px; }
}

/* ---- 复核按钮的进行中/已完成状态：让"点了有没有反应"一眼可见 ---- */
.btn.busy { opacity: .65; cursor: wait; }
.btn.done {
  border-color: var(--ok); color: var(--ok);
  background: color-mix(in srgb, var(--ok) 9%, transparent);
  cursor: default;
}
.btn.done:hover { border-color: var(--ok); color: var(--ok); }

/* ---- 移动端提示：改到顶部，避免被手掌和拇指挡住 ---- */
@media (max-width: 760px) {
  #toasts {
    top: calc(8px + env(safe-area-inset-top, 0px));
    bottom: auto; left: 12px; right: 12px;
    align-items: stretch;
  }
  .toast {
    font-size: 13px; padding: 11px 14px;
    max-width: none; box-shadow: 0 4px 16px rgba(30,25,15,.2);
    animation: dropIn .2s ease-out;
  }
  @keyframes dropIn { from { transform: translateY(-10px); opacity: 0 } }

  /* 复核结果条：手机上按钮铺满，减少误触 */
  .rv-bar { gap: 6px; }
  .rv-bar .btn.sm { flex: 1 1 calc(50% - 3px); justify-content: center; }
}

/* ---- 新版本提示条：SPA 长时间开着会一直跑旧 JS，这里主动提示刷新 ---- */
#updateBar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--accent-solid); color: #fff;
  padding: 10px 16px; text-align: center; font-size: 12.6px;
  display: none; box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

/* ===================================================================
   知识图谱画布
   取色遵循全文的朱砂体系：法条最重（朱砂）、法规赭石、制度墨绿、
   风险点紫檀、基线青灰、条款类型卡其、案例靛蓝。
   颜色全部走变量，深色主题下自动换一套提亮版本。
   =================================================================== */
:root {
  --g-law: #8c1d18;
  --g-reg: #a0701b;
  --g-int: #3d6a61;
  --g-risk: #7c3f5d;
  --g-base: #58697f;
  --g-type: #7d6e4f;
  --g-case: #3f6b8c;
  --g-edge: #b9b3a5;
}

[data-theme="dark"] {
  --g-law: #d4645a;
  --g-reg: #d6a24a;
  --g-int: #6fb3a6;
  --g-risk: #c08fb8;
  --g-base: #8fa3bd;
  --g-type: #b8a888;
  --g-case: #7fb0d4;
  --g-edge: #55523f;
}

.gc { display: flex; flex-direction: column; }

.gc-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); flex-wrap: wrap;
}
.gc-seg { display: inline-flex; border: 1px solid var(--line-2); }
.gc-seg button {
  border: 0; background: var(--surface); color: var(--ink-2);
  font-size: 11.6px; padding: 4px 10px; cursor: pointer;
  border-right: 1px solid var(--line);
}
.gc-seg button:last-child { border-right: 0; }
.gc-seg button:hover { background: var(--surface-2); color: var(--ink); }
.gc-seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.gc-sep { width: 1px; height: 16px; background: var(--line); }
.gc-spacer { flex: 1; }
.gc-btn {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 11.6px; padding: 4px 9px; cursor: pointer;
}
.gc-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.gc-zoom {
  font-family: var(--mono); font-size: 10.8px; color: var(--ink-3);
  min-width: 38px; text-align: center;
}

.gc-stage {
  position: relative; width: 100%;
  height: clamp(520px, 60vh, 700px);
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 26px 26px,
    var(--surface);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.gc-stage:active { cursor: grabbing; }
.gc-svg { display: block; width: 100%; height: 100%; }

/* 边 */
.gc-edge { stroke-linecap: round; transition: opacity .14s; }
.gc-edge.gc-dim { opacity: .07; }
.gc-edge.gc-lit { stroke-opacity: 1 !important; stroke-width: 1.7; }
.gc-edge.gc-hidden { display: none; }
/* 同心分层时边会全部穿过圆心，压太实就成了蛛网；压淡一档，层次才看得出来 */
.gc-group .gc-edge:not(.gc-lit) { stroke-opacity: .34; }

/* 依据链高亮层 */
.gc-pathline {
  stroke-width: 2.1; fill: none; stroke-opacity: .95;
  stroke-dasharray: 6 4; animation: gcFlow 1.1s linear infinite;
}
@keyframes gcFlow { to { stroke-dashoffset: -20 } }

/* 节点 */
.gc-node { cursor: pointer; }
.gc-node circle { transition: opacity .14s, r .14s; }
.gc-node .gc-halo { stroke-opacity: 0; transition: stroke-opacity .16s; }
.gc-node:hover .gc-halo { stroke-opacity: .55; }
.gc-node.gc-focus .gc-halo { stroke-opacity: .9; }
.gc-node.gc-dim { opacity: .1; }
.gc-node.gc-dim .gc-label { opacity: 0; }
.gc-node.gc-hidden { display: none; }
.gc-node.gc-dead { opacity: .42; }

.gc-label {
  font-family: var(--sans); font-size: 10.6px; fill: var(--ink-2);
  opacity: 0; pointer-events: none; transition: opacity .16s;
  paint-order: stroke; stroke: var(--surface); stroke-width: 4.4px; stroke-linejoin: round;
}
.gc-node.gc-has-label .gc-label { opacity: 1; }
.gc-node.gc-focus .gc-label { font-weight: 700; fill: var(--ink); opacity: 1; }
.gc-node.gc-near .gc-label { opacity: 1; }
/* 高亮某个节点时，其余标签必须让干净，否则依旧糊成一片（写在后面才能盖住上面三条） */
.gc-node.gc-dim .gc-label { opacity: 0; }

/* 图例：放到画布外面横排。之前压在画布左下角，正好盖住一两颗节点，
   想点它们得先把图例关掉——不如一开始就别占画布。 */
.gc-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 3px;
  padding: 7px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.gc-lg {
  display: flex; align-items: center; gap: 6px; border: 1px solid transparent;
  background: none; font-size: 11.2px; color: var(--ink-2);
  padding: 2px 6px; cursor: pointer; text-align: left;
}
.gc-lg:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }
.gc-lg i { width: 8px; height: 8px; flex: none; }
.gc-lg b { font-family: var(--mono); font-size: 10px; color: var(--ink-3); font-weight: 400; }
.gc-lg.off { opacity: .35; text-decoration: line-through; }

/* 悬停卡 */
.gc-tip {
  position: absolute; top: 0; left: 0; pointer-events: none;
  max-width: 280px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 4px 16px rgba(30, 25, 15, .12);
  padding: 7px 10px; font-size: 11.8px; line-height: 1.55;
  opacity: 0; transition: opacity .12s; z-index: 3;
}
.gc-tip.show { opacity: 1; }
.gc-tip b { display: block; font-size: 12.2px; margin-bottom: 3px; line-height: 1.45; }
.gc-tip-m { display: flex; align-items: center; gap: 5px; color: var(--ink-3); font-size: 11px; }
.gc-tip-m i { width: 7px; height: 7px; display: inline-block; }
.gc-tip-warn { display: block; color: var(--high); font-size: 11px; margin-top: 2px; }

.gc-hint {
  position: absolute; right: 12px; bottom: 12px;
  font-size: 10.8px; color: var(--ink-3); pointer-events: none;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 3px 8px;
}

/* ---- 图谱页：筛选行 + 画布/详情分栏 ---- */
.gc-filter {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.gc-filter input, .gc-filter select {
  padding: 5px 9px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 12.4px;
}
.gc-filter #q { width: 240px; }

.graph-split { display: flex; align-items: stretch; }
.graph-split > #canvasHost { flex: 1 1 auto; min-width: 0; }

.graph-panel {
  display: none; width: 358px; flex: none;
  border-left: 1px solid var(--line); background: var(--surface-2);
  overflow-y: auto; padding: 14px 16px 18px;
}
.graph-panel.open { display: block; }
.gp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.gp-type {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.8px; letter-spacing: .4px; padding: 1px 6px;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface);
}
.gp-type i { width: 7px; height: 7px; }
.gp-x { margin-left: auto; border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 13px; }
.gp-x:hover { color: var(--ink); }
.gp-title { font-family: var(--serif); font-size: 15px; font-weight: 700; line-height: 1.5; margin-bottom: 9px; }
.gp-meta { display: flex; flex-direction: column; gap: 3px; font-size: 11.2px; color: var(--ink-3); margin-bottom: 12px; line-height: 1.5; word-break: break-all; }
.gp-body {
  font-family: var(--serif); font-size: 12.6px; line-height: 1.92; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); padding: 10px 12px;
  max-height: 230px; overflow-y: auto; text-align: justify; margin-bottom: 4px;
}
.gp-sec {
  font-size: 10.6px; letter-spacing: 1px; color: var(--accent); font-weight: 700;
  border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 15px 0 6px;
}
.gp-edge {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left;
  border: 1px solid transparent; background: none; padding: 4px 5px;
  cursor: pointer; font-size: 11px; color: var(--ink-2);
}
.gp-edge:hover { background: var(--surface); border-color: var(--line); }
.gp-edge i { width: 6px; height: 6px; flex: none; }
.gp-edge-t { flex: none; color: var(--ink-3); }
.gp-edge-id { margin-left: auto; color: var(--ink-2); font-size: 11px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.gp-foot { margin-top: 16px; display: flex; gap: 6px; }
.gp-load { padding: 50px 0; text-align: center; }

.node-card { cursor: pointer; transition: border-color .14s, background .14s; }
.node-card:hover { border-color: var(--line-2); }
.node-card.active { border-color: var(--accent); background: var(--surface-2); }

.gc-node.gc-type-dim { opacity: .1; }
.gc-node.gc-hit .gc-halo { stroke-opacity: .8; stroke-dasharray: 3 2; }

@media (max-width: 760px) {
  .gc-bar { padding: 8px 10px; gap: 6px; }
  /* 380 在 6.1 寸屏上图形只剩指甲盖大，抬到 440 才看得清社群结构 */
  .gc-stage { height: 440px; }
  .gc-legend { display: none; }
  .gc-hint { display: none; }
  .gc-seg button { padding: 4px 7px; font-size: 11px; }
  /* 窄屏放不下左右分栏，详情面板改成排在画布下方 */
  .graph-split { flex-direction: column; }
  .graph-panel { width: 100%; border-left: 0; border-top: 1px solid var(--line); max-height: 420px; }
  .gc-filter #q { width: 100%; }
}
#updateBar.show { display: block; }
#updateBar a { color: #fff; font-weight: 700; text-decoration: underline; cursor: pointer; }
#updateBar .close { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); opacity: .75; cursor: pointer; }

/* ============================================================
   移动端内容密度（≤760px 覆盖）
   ------------------------------------------------------------
   760 以下原本把所有网格一刀切成单列（.g2/.g3/.g4 → 1fr !important），
   连带指标卡也单列 —— 工作台 4 张卡、案例库 4 张统计卡各占一整屏，
   用户要滑三次才见到正文。这里只对「指标卡」和「筛选器」放宽成两列，
   表单类网格仍保持单列（两列会把输入框挤到没法填）。
   ============================================================ */
@media (max-width: 760px) {
  /* ① 指标卡两列：内容只有「标签 + 数字 + 一行说明」，390px 放得开 */
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .g4 > .card { padding: 12px 13px; }
  .stat { padding: 12px 13px; }
  .stat .k { font-size: 10.8px; letter-spacing: .2px; }
  .stat .v { font-size: 22px; margin-top: 4px; }
  .stat .d { font-size: 10.4px; margin-top: 4px; line-height: 1.5; }

  /* ② 筛选器两列，别让四个下拉框各占一行 */
  .row.filters { gap: 8px; }
  .row.filters > input, .row.filters > select {
    flex: 1 1 calc(50% - 4px); min-width: 0; width: auto !important;
  }
  .row.filters > #q { flex-basis: 100%; }
  .row.filters > #cnt { flex-basis: 100%; margin-left: 0 !important; text-align: right; }

  /* ③ 图谱页筛选同样收成两列 */
  .gc-filter { gap: 6px; padding: 9px 10px; }
  .gc-filter > select, .gc-filter > input[type="date"] {
    flex: 1 1 calc(50% - 3px); min-width: 0; width: auto !important;
  }
  /* 「规范时点」四个字在窄屏纯占位（日期框自己也带提示），藏掉让日期与类型并排 */
  .gc-filter > span.small.mut:not([id]) { display: none; }
  .gc-filter > #clear { flex: 0 0 auto; }
  .gc-filter > #stat { flex: 1 1 auto; margin-left: 0 !important; text-align: right; }

  /* ④ 卡片头：标题允许换行，提示文字掉到下一行，别和标题抢同一条基线 */
  .card-h { flex-wrap: wrap; row-gap: 2px; align-items: baseline; }
  .card-h .hint { flex-basis: 100%; }

  /* ⑤ 说明性小字在手机上普遍偏小，抬一档 */
  .note, .card-h .hint, .gc-hint { font-size: 11.6px; line-height: 1.6; }

  /* ⑥ 风险卡片：头部徽标 + 标题 + 多个标签 + 条款号，窄屏必定挤成一坨，允许换行 */
  .finding .top { flex-wrap: wrap; row-gap: 4px; }
  .finding .ttl { flex: 1 1 auto; min-width: 0; }
  /* 依据链/判例/交叉校验是等宽小字，手机上 10.8px 基本看不清 */
  .finding .chain { font-size: 11.6px; line-height: 1.7; }
  .finding .fix, .finding .sugline { font-size: 11.8px; line-height: 1.72; }
  .finding .bd { font-size: 12.8px; line-height: 1.8; }
  /* 复核按钮：5 个按钮若每个占一行要吃掉半屏，收成两列 */
  .finding .rv-bar { flex-wrap: wrap; row-gap: 6px; }
  .finding .rv-bar > .btn { flex: 1 1 calc(50% - 4px); }
  .finding .rv-bar > .mut { flex-basis: 100%; }
}
