/* ===== 令牌：深色(默认) / 浅色(data-theme=light) ===== */
:root{
  color-scheme:dark light;
  --bg:#0d0f12; --surface:#14161a; --surface-2:#1a1d22; --surface-3:#21252b;
  --header-bg:rgba(13,15,18,.82);
  --border:rgba(255,255,255,.07); --border-strong:rgba(255,255,255,.13);
  --text:#e7eaee; --text-2:#a9b0ba; --text-3:#6f7782;
  --accent:#7c86e0; --accent-deep:#6b76d4; --accent-soft:rgba(124,134,224,.14); --accent-2:#5fccba;
  --good:#4fbf8f; --warn:#e2a93c; --bad:#e56a74;
  --crit:#e56a74; --imp:#e2a93c; --gen:#8b929c; --ok:#4fbf8f; --open:#8b929c;
  --crit-bg:rgba(229,106,116,.14); --imp-bg:rgba(226,169,60,.14); --gen-bg:rgba(139,146,156,.14);
  --ok-bg:rgba(79,191,143,.14); --warn-bg:rgba(226,169,60,.14);
  --grid-line:rgba(255,255,255,.02);
  --radius:8px; --radius-sm:6px; --ease:cubic-bezier(.2,.6,.2,1);
  --ring:0 0 0 2px var(--accent-soft),0 0 0 1px var(--accent);
  --shadow-xs:0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:0 1px 2px rgba(0,0,0,.35),0 4px 10px rgba(0,0,0,.35);
  --shadow-md:0 2px 6px rgba(0,0,0,.4),0 10px 24px rgba(0,0,0,.45);
  --shadow-lg:0 12px 24px rgba(0,0,0,.5),0 32px 64px rgba(0,0,0,.6);
}
[data-theme="light"]{
  color-scheme:light;
  --bg:#f7f7f8; --surface:#ffffff; --surface-2:#f1f2f4; --surface-3:#e9ebef;
  --header-bg:rgba(255,255,255,.88);
  --border:rgba(0,0,0,.08); --border-strong:rgba(0,0,0,.14);
  --text:#1f2328; --text-2:#5a626e; --text-3:#8b929c;
  --accent:#5a66c9; --accent-deep:#4a55b4; --accent-soft:rgba(90,102,201,.12); --accent-2:#3f8f8a;
  --good:#2f9e6c; --warn:#b9841f; --bad:#d64550;
  --crit:#d64550; --imp:#d98a2d; --gen:#8b929c; --ok:#2f9e6c; --open:#8b929c;
  --crit-bg:rgba(214,69,80,.12); --imp-bg:rgba(217,138,45,.12); --gen-bg:rgba(139,146,156,.12);
  --ok-bg:rgba(47,158,108,.12); --warn-bg:rgba(185,132,31,.12);
  --grid-line:rgba(0,0,0,.025);
  --shadow-xs:0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:0 1px 2px rgba(0,0,0,.04),0 2px 8px rgba(0,0,0,.05);
  --shadow-md:0 4px 14px rgba(0,0,0,.08),0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:0 12px 32px rgba(0,0,0,.18),0 4px 12px rgba(0,0,0,.12);
}
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:"Segoe UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  color:var(--text); -webkit-font-smoothing:antialiased; font-size:14px; line-height:1.55;
  background-color:var(--bg);
  background-image:linear-gradient(var(--grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--grid-line) 1px,transparent 1px);
  background-size:26px 26px;
}

.topbar{ position:sticky; top:0; z-index:10; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 22px; background:var(--header-bg); backdrop-filter:blur(10px); border-bottom:1px solid var(--border); }
.brand{ display:flex; align-items:center; gap:11px; font-size:15px; font-weight:650; letter-spacing:.2px; color:var(--text); white-space:nowrap; }
.brand-mark{ width:25px; height:25px; flex:0 0 auto; border-radius:6px; background:linear-gradient(135deg,var(--accent),var(--accent-deep)); display:flex; align-items:center; justify-content:center; box-shadow:inset 0 1px 0 rgba(255,255,255,.2); }
.brand-mark::after{ content:''; width:0; height:0; border-left:5px solid transparent; border-right:5px solid transparent; border-bottom:11px solid rgba(255,255,255,.94); transform:translateY(-1px); }
.baseline-badge{ margin-left:2px; padding:2px 9px; border-radius:6px; background:var(--crit-bg); color:var(--crit); border:1px solid var(--border); font-size:11px; font-weight:600; letter-spacing:.2px; }

.topbar nav{ display:flex; align-items:center; gap:3px; padding:3px; background:var(--surface-2); border:1px solid var(--border); border-radius:9px; }
.topbar nav a{ padding:6px 15px; border-radius:6px; color:var(--text-2); text-decoration:none; font-size:13px; font-weight:600; letter-spacing:.2px; white-space:nowrap; transition:all .15s var(--ease); }
.topbar nav a:hover{ color:var(--text); background:var(--surface-3); }
.topbar nav a.active{ background:linear-gradient(180deg,var(--accent),var(--accent-deep)); color:#fff; box-shadow:inset 0 1px 0 rgba(255,255,255,.14); }
#specialty-select{ margin-left:8px; padding:6px 10px; border:1px solid var(--border); border-radius:6px; background:var(--surface-2); color:var(--text-2); font-size:13px; }
#specialty-select:hover{ border-color:var(--border-strong); }
.theme-toggle{ width:32px; height:32px; margin-left:8px; flex:0 0 auto; border:1px solid var(--border); border-radius:6px; background:var(--surface-2); color:var(--text-2); font-size:15px; cursor:pointer; line-height:1; transition:all .15s var(--ease); }
.theme-toggle:hover{ color:var(--text); background:var(--surface-3); border-color:var(--border-strong); }
select:focus-visible,a:focus-visible,.theme-toggle:focus-visible{ outline:none; box-shadow:var(--ring); border-radius:4px; }

.page-title{ padding:22px 22px 0; }
.page-title h1{ margin:0; font-size:20px; font-weight:700; letter-spacing:.2px; }
.page-sub{ margin:7px 0 0; font-size:13px; color:var(--text-3); }

.stats-bar{ display:flex; gap:13px; padding:16px 22px 2px; }
.metric{ min-width:124px; background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:var(--radius); padding:13px 16px; transition:border-color .16s var(--ease),transform .16s var(--ease); }
.metric:hover{ border-color:var(--border-strong); transform:translateY(-1px); }
.metric-num{ font-size:26px; font-weight:750; line-height:1.1; font-variant-numeric:tabular-nums; letter-spacing:-.3px; color:var(--text); }
.metric-label{ margin-top:5px; font-size:12px; font-weight:600; color:var(--text-3); letter-spacing:.3px; }
.metric-sub{ margin-top:2px; font-size:11px; color:var(--text-3); }
.metric.crit{ border-left-color:var(--crit); }
.metric.crit .metric-num{ color:var(--crit); }
.metric.open{ border-left-color:var(--imp); }
.metric.open .metric-num{ color:var(--imp); }

.filters{ display:flex; align-items:center; gap:11px; padding:14px 22px 8px; flex-wrap:wrap; }
.filters select{ padding:7px 11px; border:1px solid var(--border); border-radius:6px; background:var(--surface-2); color:var(--text-2); font-size:13px; transition:border-color .15s var(--ease); }
.filters select:hover{ border-color:var(--border-strong); }
.legend{ display:flex; align-items:center; gap:7px; margin-left:auto; font-size:12px; color:var(--text-3); }

.matrix-scroll{ margin:12px 22px 30px; border:1px solid var(--border); border-radius:10px; background:var(--surface); overflow:auto; }
table.matrix{ border-collapse:collapse; table-layout:fixed; min-width:1200px; }
.corner{ min-width:98px; background:var(--surface-2); font-size:11px; font-weight:600; color:var(--text-3); padding:9px; border-bottom:1px solid var(--border); }
th.row-h{ position:sticky; left:0; z-index:2; background:var(--surface); text-align:right; padding:8px 11px; font-size:12px; font-weight:600; color:var(--text-2); white-space:nowrap; border-bottom:1px solid var(--border); border-right:1px solid var(--border); }
th.col-h{ position:sticky; top:0; z-index:2; background:var(--surface); height:96px; vertical-align:bottom; padding:7px 3px; border-bottom:1px solid var(--border); }
th.row-h.grp-start{ border-top:2px solid var(--border-strong); }
th.col-h.grp-start{ border-left:2px solid var(--border-strong); }
.row-link,.col-link{ color:var(--accent); text-decoration:none; font-weight:600; transition:color .15s var(--ease); }
.row-link:hover,.col-link:hover{ color:var(--accent-2); }
th.col-h span{ writing-mode:vertical-rl; text-orientation:upright; white-space:nowrap; display:inline-block; padding-bottom:6px; line-height:1.5; color:var(--text-2); }
td.cell{ border:1px solid var(--border); text-align:center; height:27px; min-width:27px; cursor:default; transition:transform .12s var(--ease),box-shadow .12s var(--ease); }
td.cell.c1{ background:var(--gen-bg); }
td.cell.c2{ background:var(--imp-bg); }
td.cell.c3{ background:var(--crit-bg); }
td.cell.none{ background:var(--surface-3); }
td.cell.c1,td.cell.c2,td.cell.c3{ cursor:pointer; }
td.cell:hover{ transform:scale(1.16); position:relative; z-index:3; box-shadow:var(--ring),0 3px 10px rgba(0,0,0,.4); }
.cnt{ font-size:11px; font-weight:700; font-variant-numeric:tabular-nums; }
td.cell.c1 .cnt{ color:var(--gen); }
td.cell.c2 .cnt{ color:var(--imp); }
td.cell.c3 .cnt{ color:var(--crit); }
td.cell.col-hl{ box-shadow:inset 0 0 0 2px var(--accent); }
table.matrix tbody tr:hover td.cell{ filter:saturate(1.12) brightness(1.05); }

.badge{ display:inline-flex; align-items:center; padding:2px 9px; border-radius:6px; font-size:11px; font-weight:600; line-height:1.5; letter-spacing:.2px; border:1px solid var(--border); }
.badge.crit{ color:var(--crit); background:var(--crit-bg); }
.badge.imp{ color:var(--imp); background:var(--imp-bg); }
.badge.gen{ color:var(--text-2); background:var(--gen-bg); }
.badge.ok{ color:var(--ok); background:var(--ok-bg); }
.badge.warn{ color:var(--warn); background:var(--warn-bg); }
.badge.open{ color:var(--text-2); background:var(--gen-bg); }

.spec-card{ margin:22px 22px 0; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:22px 24px; }
.spec-head{ display:flex; align-items:center; gap:12px; }
.spec-head h1{ margin:0; font-size:20px; font-weight:700; letter-spacing:.2px; }
.group-pill{ padding:3px 11px; border-radius:6px; background:var(--surface-2); border:1px solid var(--border); color:var(--accent); font-size:12px; font-weight:600; }
.spec-desc{ margin:11px 0 0; color:var(--text-2); font-size:14px; line-height:1.7; }
.spec-stats{ display:flex; gap:11px; margin-top:15px; }
.stat-chip{ min-width:106px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:11px 15px; }
.stat-num{ font-size:22px; font-weight:750; font-variant-numeric:tabular-nums; line-height:1.1; }
.stat-label{ margin-top:4px; font-size:12px; color:var(--text-3); }
.stat-chip.open .stat-num{ color:var(--imp); }

.closure-toggle{ display:flex; align-items:center; gap:8px; margin:16px 22px 0; font-size:13px; color:var(--text-2); cursor:pointer; user-select:none; }
.closure-toggle input{ appearance:none; -webkit-appearance:none; width:40px; height:21px; border-radius:21px; background:var(--surface-3); position:relative; transition:background .16s var(--ease); cursor:pointer; margin:0; border:1px solid var(--border); }
.closure-toggle input::before{ content:''; position:absolute; top:2px; left:2px; width:15px; height:15px; border-radius:50%; background:var(--text-2); transition:left .16s var(--ease),background .16s var(--ease); }
.closure-toggle input:checked{ background:var(--accent); border-color:var(--accent); }
.closure-toggle input:checked::before{ left:21px; background:#fff; }

.ix-section{ margin:12px 22px 22px; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:8px 22px 16px; }
.ix-section h2{ margin:14px 0 6px; font-size:14px; font-weight:700; color:var(--text); letter-spacing:.2px; }
.ix-list{ list-style:none; margin:0; padding:0; }
.ix{ border-bottom:1px solid var(--border); padding:2px 0; border-radius:6px; transition:background .14s var(--ease); }
.ix:hover{ background:var(--surface-2); }
.ix-head{ display:flex; align-items:center; gap:10px; padding:11px 6px; cursor:pointer; flex-wrap:wrap; }
.ix-title{ font-size:14px; font-weight:700; color:var(--text); }
.ix-meta{ margin-left:auto; color:var(--text-3); font-size:12px; }
.ix-meta a{ color:var(--accent); text-decoration:none; }
.ix-meta a:hover{ text-decoration:underline; }
.ix-body{ display:none; padding:6px 6px 15px 16px; margin-bottom:5px; border-left:3px solid var(--accent); }
.ix.open .ix-body{ display:block; }
.ix-content{ margin:4px 0 11px; color:var(--text-2); font-size:13px; line-height:1.8; }
.ix-remark{ color:var(--crit); font-size:12px; margin:7px 0 0; }
.empty{ list-style:none; color:var(--text-3); padding:9px 4px; }

table.params{ border-collapse:collapse; width:100%; font-size:12px; margin-top:7px; border-radius:6px; overflow:hidden; }
table.params th,table.params td{ border:1px solid var(--border); padding:6px 11px; text-align:left; }
table.params thead th{ background:var(--surface-2); color:var(--text-2); font-weight:650; }
table.params tbody tr:nth-child(even){ background:var(--surface-2); }

#panel-backdrop{ display:none; position:fixed; inset:0; z-index:19; background:rgba(0,0,0,.5); backdrop-filter:blur(2px); }
.slide-panel{ position:fixed; top:0; right:0; z-index:20; height:100vh; width:470px; max-width:92vw; background:var(--surface); box-shadow:var(--shadow-lg); border-left:1px solid var(--border); padding:20px 22px; box-sizing:border-box; overflow:auto; }
.slide-panel:not([hidden]){ animation:panelIn .24s var(--ease); }
@keyframes panelIn{ from{ transform:translateX(34px); opacity:.4; } to{ transform:none; opacity:1; } }
.panel-head{ display:flex; justify-content:space-between; align-items:flex-start; padding-bottom:13px; border-bottom:1px solid var(--border); margin-bottom:6px; }
.panel-title{ font-size:15px; font-weight:700; }
.panel-sub{ font-size:12px; color:var(--text-3); margin-top:3px; }
.panel-head button{ font-size:22px; line-height:1; border:none; background:none; cursor:pointer; color:var(--text-3); padding:0 4px; }
.panel-head button:hover{ color:var(--text); }
.panel-item{ padding:13px 0; border-bottom:1px solid var(--border); }
.panel-item-head{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.panel-item-head strong{ font-size:14px; font-weight:700; }
.panel-item p{ margin:7px 0; font-size:13px; color:var(--text-2); line-height:1.7; }

.flow-chain{ margin:16px 22px 30px; display:flex; flex-direction:column; gap:16px; }
.flow-stage{ background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:15px 20px; }
.flow-stage-title{ font-size:13px; font-weight:700; color:var(--accent); letter-spacing:.3px; margin-bottom:13px; padding-left:11px; border-left:3px solid var(--accent); }
.flow-stage-row{ display:flex; align-items:flex-start; flex-wrap:wrap; gap:11px; }
.flow-node{ max-width:222px; background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:11px 13px; cursor:pointer; transition:border-color .15s var(--ease),transform .15s var(--ease); }
.flow-node:hover{ border-color:var(--accent); transform:translateY(-2px); }
.flow-node-head{ display:flex; align-items:center; gap:7px; flex-wrap:wrap; margin-bottom:7px; }
.flow-node-item{ font-size:13px; font-weight:700; color:var(--text); }
.flow-node-dir{ font-size:11px; color:var(--text-3); line-height:1.7; }
.flow-node-dir a{ color:var(--accent); text-decoration:none; }
.flow-node-dir a:hover{ text-decoration:underline; }
.flow-arrow{ font-size:18px; color:var(--text-3); align-self:center; padding-top:7px; opacity:.7; }
.flow-note{ margin:12px 0 0; padding:9px 13px; background:var(--warn-bg); border:1px solid var(--border); border-radius:8px; font-size:12px; color:var(--warn); }

.ix-deps{ margin-top:9px; display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.dep-label{ font-size:12px; color:var(--text-3); }
.dep-chip{ font-size:12px; color:var(--accent); background:var(--accent-soft); border:1px solid var(--border); border-radius:6px; padding:2px 9px; text-decoration:none; transition:border-color .15s var(--ease); }
.dep-chip:hover{ border-color:var(--accent); }

.overview-wrap{ margin:12px 22px 30px; background:var(--surface); border:1px solid var(--border); border-radius:10px; overflow:auto; padding:14px; }
.overview-wrap svg{ display:block; background:linear-gradient(var(--grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--grid-line) 1px,transparent 1px); background-size:22px 22px; border-radius:8px; }
.edge-sample{ display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--text-3); }
.edge-sample i{ display:inline-block; width:17px; height:3px; border-radius:2px; }
.edge-line{ display:inline-block; width:17px; height:3px; border-radius:2px; }

.matrix-scroll::-webkit-scrollbar,.slide-panel::-webkit-scrollbar,.overview-wrap::-webkit-scrollbar{ width:10px; height:10px; }
.matrix-scroll::-webkit-scrollbar-thumb,.slide-panel::-webkit-scrollbar-thumb,.overview-wrap::-webkit-scrollbar-thumb{ background:var(--surface-3); border-radius:8px; border:2px solid var(--surface); }
