:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e1e5eb;
  --line-strong: #c9d0da;
  --ink: #12161c;
  --ink-2: #4a5361;
  --ink-3: #7a8494;
  --brand: #184f95;
  --brand-ink: #ffffff;
  --brand-soft: #e8f0fb;
  --accent: #2a78d6;
  --s-a: #2a78d6;
  --s-b: #eb6834;
  --s-c: #1baf7a;
  --s-d: #eda100;
  --s-e: #e87ba4;
  --s-f: #008300;
  --s-g: #4a3aa7;
  --s-h: #e34948;
  --s-out: #8a8f98;
  --s-plan: #12161c;
  --good: #0f7b3e;
  --good-soft: #e3f4ea;
  --warn: #9a6200;
  --warn-soft: #fff3d6;
  --bad: #c0352f;
  --bad-soft: #fde8e6;
  --seq-0: #f0f4fa;
  --seq-1: #cde2fb;
  --seq-2: #86b6ef;
  --seq-3: #3987e5;
  --seq-4: #1c5cab;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1d222a;
    --line: #2a313b;
    --line-strong: #3a4350;
    --ink: #edf0f4;
    --ink-2: #b4bcc8;
    --ink-3: #8590a0;
    --brand: #3987e5;
    --brand-ink: #ffffff;
    --brand-soft: #182a42;
    --accent: #3987e5;
    --s-a: #3987e5;
    --s-b: #d95926;
    --s-c: #199e70;
    --s-d: #c98500;
    --s-e: #d55181;
    --s-f: #008300;
    --s-g: #9085e9;
    --s-h: #e66767;
    --s-out: #8a8f98;
    --s-plan: #edf0f4;
    --good: #4cc27f;
    --good-soft: #15301f;
    --warn: #e0a83a;
    --warn-soft: #33270c;
    --bad: #f07a73;
    --bad-soft: #3a1a18;
    --seq-0: #1d222a;
    --seq-1: #184f95;
    --seq-2: #256abf;
    --seq-3: #3987e5;
    --seq-4: #86b6ef;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216; --surface: #171b21; --surface-2: #1d222a; --line: #2a313b; --line-strong: #3a4350;
  --ink: #edf0f4; --ink-2: #b4bcc8; --ink-3: #8590a0; --brand: #3987e5; --brand-ink: #fff; --brand-soft: #182a42;
  --accent: #3987e5; --s-a: #3987e5; --s-b: #d95926; --s-c: #199e70; --s-d: #c98500; --s-e: #d55181; --s-f: #008300; --s-g: #9085e9; --s-h: #e66767; --s-out: #8a8f98; --s-plan: #edf0f4;
  --good: #4cc27f; --good-soft: #15301f; --warn: #e0a83a; --warn-soft: #33270c; --bad: #f07a73; --bad-soft: #3a1a18;
  --seq-0: #1d222a; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef; --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
b { font-weight: 600; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.logo { width: 34px; height: 34px; flex: none; }
.logo rect:first-child { fill: var(--brand); }
.logo path { fill: #fff; }
.logo .bar { fill: #86b6ef; }
.brand-name { font-weight: 650; font-size: 16px; letter-spacing: .2px; }
.brand-sub { color: var(--ink-3); font-size: 12px; }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav a { color: var(--ink-2); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.site-nav .nav-cta { background: var(--brand); color: var(--brand-ink); display: inline-flex; gap: 6px; align-items: center; }
.site-nav .nav-cta:hover { background: var(--brand); color: var(--brand-ink); opacity: .92; }
.site-nav .nav-cta[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.new-tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; background: #f5c451; color: #3a2a00; border-radius: 4px; padding: 0 5px; line-height: 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.source-tools { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.source-tools label { font-weight: 650; color: var(--ink-2); }
.source-tools select { font: inherit; max-width: 150px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; }
.source-files { position: relative; }
.source-files summary { cursor: pointer; color: var(--accent); list-style: none; font-weight: 600; }
.source-files summary::-webkit-details-marker { display: none; }
.source-files summary::after { content: " ▾"; }
.source-files > div { position: absolute; right: 0; top: 26px; z-index: 30; width: 300px; max-height: calc(100vh - 90px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); display: grid; gap: 2px; }
.source-files > div a { display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.source-files > div a:hover { background: var(--surface-2); }
.source-files > div p { margin: 6px 8px 2px; font-size: 12px; }
.source-files > div a.xlsx { margin-top: 4px; background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 12px; white-space: nowrap;
}
.pill.on::before, .pill.off::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.pill.off::before { background: var(--ink-3); }
.pill.demo { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

/* 布局 */
.layout {
  display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 20px;
  padding: 20px 24px 40px; max-width: 1600px; margin: 0 auto; align-items: start;
}
.agent {
  position: sticky; top: 78px; display: flex; flex-direction: column;
  height: calc(100vh - 98px); min-height: 520px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.agent-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.agent-head h2 { margin: 0; font-size: 15px; }
.thread { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { padding: 10px 12px; border-radius: 10px; max-width: 100%; overflow-wrap: anywhere; }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin-bottom: 0; }
.msg ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); max-width: 88%; }
.msg.bot { background: var(--surface-2); border: 1px solid var(--line); }
.msg.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.msg .meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.trace li { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; padding: 6px 4px; border-radius: 6px; align-items: start; }
.trace .dot { width: 10px; height: 10px; border-radius: 50%; margin: 5px 4px 0; background: var(--line-strong); }
.trace li.running .dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.trace li.done .dot { background: var(--good); }
.trace li.error .dot { background: var(--bad); }
.trace .t-title { font-weight: 600; font-size: 13px; }
.trace .t-tool { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 6px; font-weight: 400; }
.trace .t-detail { font-size: 12px; color: var(--ink-2); }
.trace .t-ms { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 2px; }
@keyframes pulse { 50% { opacity: .35; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.composer { display: flex; gap: 8px; padding: 10px 16px 6px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px;
  background: var(--surface); min-height: 44px; max-height: 140px; line-height: 1.45;
}
.composer textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.context-line { padding: 0 16px 12px; font-size: 12px; color: var(--ink-3); min-height: 18px; }

button.primary {
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px; padding: 10px 18px;
  font-weight: 600; cursor: pointer; height: 44px;
}
button.primary:disabled { opacity: .5; cursor: progress; }
button.ghost { background: transparent; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.small { padding: 3px 10px; font-size: 12px; }

/* 流程条 */
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.flow {
  list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.flow li { position: relative; text-align: center; padding: 4px 6px; min-width: 0; }
.flow li:not(:last-child)::after {
  content: ""; position: absolute; top: 19px; left: calc(50% + 18px); right: calc(-50% + 18px); height: 2px; background: var(--line);
}
.flow li.done:not(:last-child)::after { background: var(--good); }
.flow .node {
  width: 32px; height: 32px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid var(--line-strong); color: var(--ink-3); font-weight: 700; font-size: 13px;
  position: relative; z-index: 1;
}
.flow li.running .node { border-color: var(--accent); color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.flow li.done .node { background: var(--good); border-color: var(--good); color: #fff; }
.flow li.warn .node { background: var(--warn); border-color: var(--warn); color: #fff; }
.flow .label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.flow .value { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow li.done .value { color: var(--ink); }

/* 空态 */
.empty {
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 36px 20px; text-align: center; color: var(--ink-2);
}
.empty-art { color: var(--line-strong); width: 220px; margin: 0 auto 8px; }
.empty h3 { margin: 4px 0; color: var(--ink); font-size: 16px; }
.empty p { margin: 0; font-size: 13px; }
.empty .empty-hint { margin-top: 14px; color: var(--ink-2); }
.link-btn { font: inherit; background: none; border: 0; color: var(--accent); font-weight: 650; cursor: pointer; padding: 0 2px; }
.link-btn:hover { text-decoration: underline; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k { font-size: 12px; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.summary { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.summary h3 { margin: 0 0 6px; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.summary .headline { font-size: 15px; margin: 0 0 10px; }
.summary .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.summary h4 { margin: 0 0 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.summary ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--ink-2); font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:disabled { color: var(--ink-3); opacity: .55; cursor: not-allowed; }
.tabs .count { font-weight: 500; color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.panel { display: flex; flex-direction: column; gap: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .sub { margin: 0 0 12px; color: var(--ink-3); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }

/* 表格 */
.table-wrap { max-width: 100%; overflow-x: auto; }
.factory-table table { min-width: max-content; }
.factory-table th:first-child, .factory-table td:first-child { min-width: 120px; white-space: nowrap; }
.factory-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.factory-label .swatch { margin-right: 0; flex: none; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--ink-3); font-weight: 600; font-size: 12px; background: var(--surface-2); white-space: nowrap; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 650; border-top: 1px solid var(--line-strong); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.heat { text-align: center; font-variant-numeric: tabular-nums; font-size: 12px; border: 2px solid var(--surface); border-radius: 6px; padding: 6px 4px; }

/* 图表 */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hover-band { fill: var(--ink); opacity: .05; }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); min-width: 140px;
}
.tooltip .tt-title { font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }

/* 利润 */
.cost-list { display: flex; flex-direction: column; gap: 6px; }
.cost-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 92px; gap: 10px; align-items: center; font-size: 13px; }
.cost-bar { height: 12px; border-radius: 0 4px 4px 0; background: var(--seq-3); min-width: 2px; }
.cost-bar.neg { background: var(--good); }
.cost-row .amt { text-align: right; font-variant-numeric: tabular-nums; }
.gauge { position: relative; height: 54px; margin: 36px 4px 6px; }
.gauge .track { position: absolute; top: 22px; left: 0; right: 0; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, var(--good-soft) 0, var(--good-soft) var(--t), var(--warn-soft) var(--t), var(--warn-soft) var(--b), var(--bad-soft) var(--b)); }
.gauge .mark { position: absolute; top: 14px; width: 2px; height: 26px; background: var(--ink); transform: translateX(-1px); }
.gauge .mark span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; white-space: nowrap; color: var(--ink-2); }
.gauge .mark.tier2 span { top: -34px; }
.gauge .mark.cur { background: var(--brand); width: 3px; }
.gauge .mark.cur span { color: var(--brand); font-weight: 650; top: 30px; }
.gauge .ticks { position: absolute; top: 40px; left: 0; right: 0; display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }

/* 派单 */
.notice-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.notices { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.notice.sent { border-color: var(--good); }
.notice.wide { grid-column: 1 / -1; }
.notice-head { display: flex; gap: 10px; align-items: flex-start; }
.notice-head input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.notice .to { font-size: 12px; color: var(--ink-3); }
.notice .subject { font-weight: 650; }
.notice .body { font-size: 13px; color: var(--ink-2); margin: 0; }
.notice table { font-size: 12px; }
.notice th, .notice td { padding: 5px 6px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); margin-right: 6px; font-weight: 600; }

/* 基础数据 */
.master-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.edit { width: 92px; text-align: right; border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--surface); font-variant-numeric: tabular-nums; }
.edit:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.edit.changed { border-color: var(--warn); background: var(--warn-soft); }

.doc { max-width: 880px; }
.doc h4 { margin: 16px 0 6px; font-size: 14px; }
.doc p, .doc li { color: var(--ink-2); }
.doc code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.roadmap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.roadmap div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.roadmap b { display: block; margin-bottom: 4px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .topbar { padding: 10px 16px; position: static; flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .source-files > div { right: 0; left: auto; max-width: calc(100vw - 32px); }
  .top-right .solver, .top-right .demo { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 32px; gap: 14px; }
  .agent { position: static; height: auto; min-height: 0; }
  .thread { max-height: 52vh; }
  .flow { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 12px; }
  .flow li:nth-child(4)::after { display: none; }
  .summary .cols { grid-template-columns: minmax(0, 1fr); }
  .notices { grid-template-columns: minmax(0, 1fr); }
  .roadmap { grid-template-columns: minmax(0, 1fr); }
  .cost-row { grid-template-columns: minmax(96px, 130px) 1fr 80px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-sub { display: none; }
  .kpi .v { font-size: 19px; }
}

/* ===== 独立页面（技术架构 / 用我的数据）===== */
.page-main { max-width: 1200px; margin: 0 auto; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 28px; }
.page-foot { max-width: 1200px; margin: 0 auto; padding: 20px 24px 36px; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line); }
.page-foot a { color: var(--ink-2); }
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 24px; align-items: stretch; }
.hero-copy { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; box-shadow: var(--shadow); }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.hero h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.25; letter-spacing: .5px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.hero-aside { background: var(--brand-soft); border-radius: var(--radius); padding: 22px 24px; border: 1px solid transparent; }
.aside-title { font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.hero-aside ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; line-height: 1.75; }
.quote { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.8; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.toc a { font-size: 12px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.toc a:hover { border-color: var(--accent); color: var(--accent); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; font-size: 14px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary-link { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary-link:hover { color: var(--brand-ink); opacity: .92; }
.btn.text { border-color: transparent; background: none; color: var(--accent); padding-left: 4px; }
.btn.big { padding: 12px 22px; font-size: 15px; }
.btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

.step, .arch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.step-head, .arch-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.step-head h2, .arch-head h2, .run-card h2 { margin: 0 0 4px; font-size: 18px; }
.step-head p, .arch-head p, .run-card p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.step-no { flex: none; font: 700 13px/1 var(--mono); color: var(--brand); background: var(--brand-soft); border-radius: 8px; padding: 8px 9px; }
.ws-expiry { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* 上传 */
.upload-layout { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 1.6fr); gap: 16px; }
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 28px 16px; cursor: pointer; text-align: center; background: var(--surface-2); min-height: 220px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--brand-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { font-size: 30px; color: var(--accent); }
.drop small { color: var(--ink-3); }
.table-checklist { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cl-head { padding: 8px 12px; background: var(--surface-2); font-weight: 650; font-size: 13px; border-bottom: 1px solid var(--line); }
.cl-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); align-items: start; font-size: 13px; }
.cl-row:last-child { border-bottom: 0; }
.cl-row small { display: block; color: var(--ink-3); font-size: 12px; }
.cl-row small.rel { color: var(--accent); }
.arch-map { margin-bottom: 16px; }
.cl-mark { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-3); margin-top: 1px; }
.cl-row.done .cl-mark { background: var(--good); color: #fff; }
.cl-src { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.req, .opt { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; margin-left: 6px; }
.req { background: var(--bad-soft); color: var(--bad); }
.opt { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.ws-message { margin-top: 12px; font-size: 13px; color: var(--ink-2); min-height: 18px; }
.ws-message.ok { color: var(--good); }
.ws-message.bad { color: var(--bad); }

/* 识别确认 */
.src { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; vertical-align: 1px; margin: 0 2px; }
.src.rule { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong); }
.src.ai { background: #efe9ff; color: #4a3aa7; }
.src.user { background: var(--good-soft); color: var(--good); }
.sheet-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.sheet-card.dim { opacity: .7; background: var(--surface-2); }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; cursor: pointer; list-style: none; }
.sheet-head::-webkit-details-marker { display: none; }
.sheet-name::before { content: "▸"; display: inline-block; width: 14px; color: var(--ink-3); transition: transform .15s; }
details[open] > .sheet-head .sheet-name::before { transform: rotate(90deg); }
.sheet-card { padding: 10px 16px; }
.sheet-card[open] { padding-bottom: 14px; }
.sheet-name b { font-size: 15px; margin-right: 8px; }
.sheet-name .muted { font-size: 12px; }
.sheet-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sheet-controls select, .field select { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); max-width: 100%; }
.how { font-size: 12px; color: var(--ink-3); }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; min-width: 0; }
.f-label { color: var(--ink-2); font-weight: 600; }
.f-label i { color: var(--bad); font-style: normal; margin-left: 2px; }
.field em { font-style: normal; color: var(--ink-3); font-size: 11px; }
.field em.bad { color: var(--bad); font-weight: 600; }
.field.missing select { border-color: var(--bad); }
.preview { margin-top: 10px; font-size: 12px; }
.preview summary { cursor: pointer; color: var(--accent); }
.preview table { font-size: 12px; margin-top: 6px; }

/* 体检 */
.check-status { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.check-status.ok { color: var(--good); }
.check-status.bad { color: var(--bad); }
.check-status span { font-weight: 500; color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.tile span { display: block; font-size: 12px; color: var(--ink-3); }
.tile b { font-size: 20px; font-variant-numeric: tabular-nums; }
.step h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink-2); }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.issues li { padding: 6px 10px; border-radius: 8px; }
.issues li.bad { background: var(--bad-soft); color: var(--bad); }
.issues li.warn { background: var(--warn-soft); color: var(--warn); }
.issues .where { font-weight: 700; margin-right: 8px; }
.run-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.run-card .step-no { display: inline-block; margin-bottom: 8px; }
.danger { display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; border: 1px solid var(--bad-soft); border-radius: var(--radius); padding: 16px 20px; }
.danger p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.danger-btn { background: var(--bad); color: #fff; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 600; cursor: pointer; }

/* 架构 */
.tiers { display: flex; flex-direction: column; gap: 6px; }
.tier { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface-2); }
.tier.host { background: var(--brand-soft); border-color: transparent; }
.tier-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--ink-3); margin-bottom: 8px; }
.tier-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.tier-row.ext { margin-top: 6px; }
.tier-arrow { text-align: center; font-size: 12px; color: var(--ink-3); position: relative; padding: 2px 0; }
.tier-arrow::before { content: "↓ "; color: var(--accent); }
.node { flex: 1 1 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.node b { display: block; font-size: 13px; }
.node small { color: var(--ink-3); font-size: 12px; }
.node.accent { border-color: var(--accent); }
.node.wide { flex-basis: 100%; }
.node.store { border-style: dashed; }
.node.ext { background: var(--surface-2); border-style: dashed; }
.link { align-self: center; color: var(--ink-3); }
.modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.module { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); }
.module.core { border-color: var(--brand); }
.module.accent { border-color: var(--accent); }
.module small { display: block; color: var(--ink-3); font-size: 12px; }
.tag, .role { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-right: 4px; vertical-align: 1px; }
.tag.code, .role.code { background: var(--brand-soft); color: var(--brand); }
.tag.ai, .role.ai { background: #efe9ff; color: #4a3aa7; }
.tag.user, .role.user { background: var(--good-soft); color: var(--good); }
.role.no { background: var(--bad-soft); color: var(--bad); }
.note { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.toolchain, .flow-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toolchain li, .flow-steps li { counter-increment: s; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 44px; position: relative; background: var(--surface); }
.toolchain li::before, .flow-steps li::before { content: counter(s); position: absolute; left: 12px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.toolchain li.core, .flow-steps li.core { border-color: var(--brand); }
.flow-steps li.user { border-color: var(--good); }
.toolchain code { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-right: 6px; }
.toolchain b, .flow-steps b { font-size: 14px; }
.toolchain small, .flow-steps small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; line-height: 1.6; }
.flow-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.loop-note { margin-top: 12px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.model-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.model-grid h3 { font-size: 14px; margin: 0 0 8px; }
.model-grid h3:not(:first-child) { margin-top: 14px; }
.model-grid code { font-family: var(--mono); font-size: 12px; }
.formula { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.small { font-size: 13px; color: var(--ink-2); margin: 0; line-height: 1.7; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.facts div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.facts b { display: block; font-size: 22px; color: var(--brand); }
.facts span { font-size: 12px; color: var(--ink-2); }
.data-model td:first-child { white-space: nowrap; }
.boundary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.boundary ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.degrade { padding: 0; overflow: hidden; }
.degrade .row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.degrade .row:last-child { border-bottom: 0; }
.degrade .row.head { background: var(--surface-2); font-weight: 650; color: var(--ink-3); font-size: 12px; }
.roadmap .phase { font-size: 11px; font-weight: 700; color: var(--accent); }
.roadmap small { display: block; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.not-doing { margin-top: 12px; }
.chips.static { padding: 8px 0 0; }
.chips.static span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .src.ai, :root:not([data-theme="light"]) .tag.ai, :root:not([data-theme="light"]) .role.ai { background: #2a2350; color: #b7aef5; }
}
:root[data-theme="dark"] .src.ai, :root[data-theme="dark"] .tag.ai, :root[data-theme="dark"] .role.ai { background: #2a2350; color: #b7aef5; }

@media (max-width: 900px) {
  .page-main { padding: 14px 16px 36px; gap: 16px; }
  .hero, .upload-layout, .model-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-copy { padding: 20px; }
  .hero h1 { font-size: 24px; }
  .step, .arch { padding: 16px; }
  .step-head, .arch-head { flex-wrap: wrap; }
  .ws-expiry { margin-left: 0; }
  .modules, .boundary, .toolchain, .flow-steps { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .degrade .row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ===== 数据关系图（datamap.js）===== */
.dm { container-type: inline-size; }
.dm-map { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@container (max-width: 1240px) {
  .dm-map { grid-template-columns: minmax(0, 1fr); }
  .dm-detail { position: static; }
}
.dm-overview { margin: 4px 0 8px; padding-left: 18px; color: var(--ink-2); line-height: 1.8; }
.dm-canvas { min-width: 0; }
.dm-svg { width: 100%; height: auto; display: block; }
.dm-svg text { font-family: inherit; }
.dm-node { cursor: pointer; outline: none; }
.dm-node rect:first-child { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; transition: stroke .15s, fill .15s; }
.dm-node:hover rect:first-child, .dm-node:focus-visible rect:first-child { stroke: var(--accent); }
.dm-node.sel rect:first-child { stroke: var(--brand); stroke-width: 2.4; fill: var(--brand-soft); }
.dm-node.virtual rect:first-child { stroke-dasharray: 5 4; fill: var(--surface-2); }
.dm-node.off { opacity: .35; }
.dm-node .t1 { font-size: 15px; font-weight: 700; fill: var(--ink); }
.dm-node .t1 .opt { font-size: 11px; font-weight: 500; fill: var(--ink-3); }
.dm-node .t2 { font-size: 11.5px; fill: var(--ink-2); }
.dm-node .t3 { font-size: 11px; fill: var(--good); font-weight: 600; }
.dm-edge { color: var(--line-strong); }
.dm-edge path { fill: none; stroke: currentColor; stroke-width: 1.6; }
.dm-edge text { font-size: 11.5px; fill: var(--ink-3); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.dm-edge.on { color: var(--brand); }
.dm-edge.on path { stroke-width: 2.4; }
.dm-edge.on text { fill: var(--brand); font-weight: 700; }
.dm-edge.off { opacity: .3; }
.dm-svg .lg { font-size: 11.5px; fill: var(--ink-3); }
.dm-detail { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); font-size: 13px; position: sticky; top: 90px; }
.dm-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dm-detail-head b { font-size: 16px; }
.dm-lane { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; border-radius: 4px; padding: 1px 7px; }
.dm-row1 { margin: 0 0 8px; }
.dm-fields { margin: 0 0 8px; display: grid; gap: 2px; }
.dm-fields dt { font-weight: 650; color: var(--ink); margin-top: 4px; }
.dm-fields dd { margin: 0; color: var(--ink-2); }
.dm-affects { margin: 8px 0; padding: 8px 10px; background: var(--surface); border-radius: 8px; border-left: 3px solid var(--brand); }
.dm-links { margin: 6px 0; color: var(--ink-2); line-height: 1.9; }
.dm-link, .dm-tag { font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; border-radius: 6px; padding: 0 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.dm-link:hover, .dm-tag:hover { border-color: var(--accent); color: var(--accent); }
.dm-tag { border-left: 3px solid var(--lane); margin-right: 4px; }
.dm-src { margin: 6px 0 0; font-size: 12px; }
.dm-sample { margin-top: 10px; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.dm-sample > div { margin-top: 2px; max-height: 160px; overflow: auto; }
.dm-lanes { display: none; }
.dm-lane-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dm-chip { font: inherit; text-align: left; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 5px 9px; font-weight: 650; font-size: 13px; cursor: pointer; }
.dm-chip small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; }
.dm-chip.sel { border-color: var(--brand); background: var(--brand-soft); }

.dm-walk { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.dm-walk-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.dm-walk-head h3 { margin: 0; font-size: 15px; }
.dm-walk-head h3 .muted { font-weight: 500; font-size: 13px; }
.dm-walk-controls { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.dm-walk-controls select, .dm-walk-controls input { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); margin-left: 4px; }
.dm-walk-controls input { width: 110px; }
.walk { list-style: none; counter-reset: w; margin: 0; padding: 0; display: grid; gap: 8px; }
.walk > li { counter-increment: w; position: relative; padding: 10px 14px 10px 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.walk > li::before { content: counter(w); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.walk > li.walk-key { border-color: var(--brand); background: var(--brand-soft); }
.walk > li.walk-key::before { background: var(--brand); color: #fff; }
.walk b { font-size: 14px; }
.walk p, .walk ul { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.walk ul { padding-left: 18px; }
.walk mark { background: var(--warn-soft); color: var(--ink); padding: 0 4px; border-radius: 4px; font-weight: 650; }
.walk-tags { float: right; display: flex; gap: 4px; margin-left: 8px; }

@media (max-width: 900px) {
  .dm-map { grid-template-columns: minmax(0, 1fr); }
  .dm-detail { position: static; }
}
@media (max-width: 640px) {
  .dm-canvas { display: none; }
  .dm { display: flex; flex-direction: column; }
  .dm-lanes { display: block; order: -1; margin-bottom: 10px; }
  .walk-tags { float: none; margin: 0 0 4px; flex-wrap: wrap; }
  .walk > li { padding-left: 40px; }
}

/* 零件档案 */
.part-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.part-pill { font: inherit; font-weight: 650; font-size: 13px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.part-pill.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.part-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); padding: 10px 12px; background: var(--surface-2); border-radius: 10px; margin-bottom: 4px; }
.part-facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.part-h { margin: 16px 0 6px; font-size: 14px; }
.part-h .muted { font-weight: 500; font-size: 12px; margin-left: 4px; }
.part-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.small-code { font-size: 11px; font-family: var(--mono); }
tr.no-route td { color: var(--ink-3); background: var(--surface-2); }
.nowrap { white-space: nowrap; }
#part-card .edit { width: 76px; }

/* ===== 简化版结果区 ===== */
.summary .headline { margin: 0; font-size: 15px; line-height: 1.75; }
.summary-src { margin-top: 8px; font-size: 11px; color: var(--ink-3); }
.more { margin-top: 8px; font-size: 13px; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.more .cols { margin-top: 8px; }
.actions { padding: 6px 0 0; overflow: hidden; }
.act { border-bottom: 1px solid var(--line); }
.act > summary, .act.none { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 16px; gap: 12px; align-items: center; padding: 13px 18px; list-style: none; cursor: pointer; }
.act.none { cursor: default; grid-template-columns: 56px minmax(0, 1fr); color: var(--ink-3); border-bottom: 1px solid var(--line); }
.act > summary::-webkit-details-marker { display: none; }
.act > summary:hover { background: var(--surface-2); }
.act-dept { font-weight: 700; color: var(--brand); font-size: 13px; }
.act.none .act-dept { color: var(--ink-3); }
.act-line { font-size: 14px; min-width: 0; }
.act-chev { color: var(--ink-3); font-size: 18px; transition: transform .15s; }
.act[open] .act-chev { transform: rotate(90deg); }
.act-notice { padding: 0 18px 14px 86px; font-size: 13px; }
.act-notice p { margin: 4px 0 8px; color: var(--ink-2); }
.act-notice table { font-size: 12px; }
.act-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; flex-wrap: wrap; font-size: 12px; }
.fold > summary { cursor: pointer; font-weight: 650; color: var(--ink-2); list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸ "; color: var(--ink-3); }
.fold[open] > summary::before { content: "▾ "; }
.fold h4 { margin: 16px 0 6px; font-size: 13px; }
.fold[open] > summary { margin-bottom: 4px; }
.data-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: none; color: var(--ink-2); padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.small-note { font-size: 12px; }
.dm[data-show="walk"] .dm-map, .dm[data-show="walk"] .dm-lanes { display: none; }
.dm[data-show="walk"] .dm-walk { margin-top: 0; border-top: 0; padding-top: 0; }
.trace-box > summary { cursor: pointer; font-size: 12px; color: var(--ink-3); font-weight: 600; list-style: none; }
.trace-box > summary::-webkit-details-marker { display: none; }
.trace-box > summary::before { content: "▸ "; }
.trace-box[open] > summary::before { content: "▾ "; }
.trace-box[open] > summary { margin-bottom: 6px; }
.empty { padding: 28px 20px; }
@media (max-width: 640px) {
  .act > summary { grid-template-columns: 40px minmax(0, 1fr) 14px; padding: 12px 14px; }
  .act > summary .badge { display: none; }
  .act.none { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 14px; }
  .act-notice { padding: 0 14px 12px; }
}

/* ===== 首页（未运行订单时）===== */
.home { display: flex; flex-direction: column; gap: 16px; }
.home .kpis { margin-bottom: 0; }
.home-story .eyebrow { margin-bottom: 6px; }
.home-lead { margin: 0; font-size: 16px; line-height: 1.75; font-weight: 600; }
.home-pain { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.75; }
.home-today { margin-top: 14px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.home-try { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--brand); border-radius: 12px; background: var(--brand-soft); }
.home-try .muted { display: block; font-size: 12px; margin-bottom: 2px; }
.home-try b { font-size: 15px; }
.home-try .primary { height: 40px; }
.home-load h3 { margin: 0 0 12px; font-size: 15px; }
.home-load h3 .muted { font-weight: 500; font-size: 12px; margin-left: 8px; }
.load-rows { display: grid; gap: 10px; }
.load-row { display: grid; grid-template-columns: minmax(110px, 1.1fr) minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(90px, .8fr); gap: 16px; align-items: center; font-size: 13px; }
.load-name { font-weight: 650; white-space: nowrap; }
.load-cell { display: flex; align-items: center; gap: 8px; }
.load-cell b { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.load-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.load-bar i { display: block; height: 100%; background: var(--seq-3); border-radius: 0 4px 4px 0; }
.load-free { color: var(--ink-2); text-align: right; white-space: nowrap; }
.home-foot { margin: 14px 0 0; font-size: 13px; }
@media (max-width: 640px) {
  .load-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .load-cell { grid-column: 1 / -1; }
  .load-free { grid-row: 1; grid-column: 2; }
  .home-try .primary { width: 100%; }
}

/* ===== 右侧：基础数据 / 计算结果 ===== */
.pane-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pane-seg button { padding: 8px 20px; font-size: 14px; }
.pane-seg button:disabled { opacity: .45; cursor: not-allowed; }
.pane-seg .count { font-size: 11px; font-weight: 600; color: var(--warn); margin-left: 6px; }
.relation-btn { display: inline-flex; align-items: center; gap: 12px; padding: 8px 16px 8px 10px; border-radius: 12px; border: 1.5px solid var(--brand);
  background: var(--brand-soft); color: var(--brand); cursor: pointer; font: inherit; text-align: left; }
.relation-btn:hover { background: var(--brand); color: var(--brand-ink); }
.relation-btn:hover small { color: inherit; opacity: .85; }
.rel-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 16px; }
.relation-btn:hover .rel-icon { background: var(--brand-ink); color: var(--brand); }
.rel-text b { display: block; font-size: 14px; }
.rel-text small { display: block; font-size: 12px; color: var(--ink-2); }
#data-pane, #result-pane { display: flex; flex-direction: column; gap: 14px; }
.edit-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; background: var(--warn-soft); color: var(--warn); border-radius: 10px; font-size: 13px; }
.stale { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
.small-btn { height: 34px; padding: 0 14px; font-size: 13px; }
.load-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.load-cell b { font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; font-size: 12px; }
.load-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; min-width: 60px; }
.load-bar i { display: block; height: 100%; background: var(--seq-3); }

/* ===== 数据关系弹窗 ===== */
.relations { width: min(1180px, 96vw); max-height: 90vh; border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.relations::backdrop { background: rgba(10, 18, 30, .45); }
.rel-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.rel-head h2 { margin: 0; font-size: 18px; }
.rel-head p { margin: 2px 0 0; font-size: 12px; }
.rel-head > div:first-child { flex: 1 1 220px; }
.rel-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; padding: 16px 20px 20px; }
.rel-graph { min-width: 0; }
.rel-svg { width: 100%; height: auto; display: block; }
.rel-svg .col-title { font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.rel-link { fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
.rel-link.on { stroke: var(--brand); stroke-width: 2.4; }
.rel-link.off { opacity: .25; }
.rel-label { font-size: 11px; fill: var(--brand); font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.rel-node { cursor: pointer; outline: none; }
.rel-node .box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.2; }
.rel-node:hover .box, .rel-node:focus-visible .box { stroke: var(--accent); }
.rel-node.on .box { stroke: var(--brand); stroke-width: 1.8; }
.rel-node.sel .box { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2.4; }
.rel-node.off { opacity: .35; }
.rel-node .n1 { font-size: 13.5px; font-weight: 700; fill: var(--ink); }
.rel-node .n2 { font-size: 11px; fill: var(--ink-3); }
.rel-detail { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; font-size: 13px; align-self: start; }
.rel-detail h3 { margin: 0 0 4px; font-size: 16px; }
.rel-detail p { margin: 0 0 8px; line-height: 1.6; }
.rel-detail table { font-size: 12.5px; }
.rel-detail th, .rel-detail td { padding: 6px 6px; }
.rel-list section { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.rel-list h4 { margin: 0 0 6px; }
.rel-list ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.8; }
.rel-list li span { display: block; color: var(--ink-3); font-size: 12px; }
@media (max-width: 900px) {
  .rel-body { grid-template-columns: minmax(0, 1fr); }
  .relation-btn { width: 100%; }
}
@media (max-width: 640px) {
  .relations { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; margin: 0; }
  .rel-head { padding: 12px 14px; }
  .rel-body { padding: 12px 14px 20px; }
  #rel-tabs button { font-size: 12px; padding: 6px 10px; }
}
