/* 设计模型：design-model.yaml（暖宣纸浅色、朱砂红只用于主操作和真正要注意的地方、圆角 8、最大宽度 1200） */
:root {
  --bg: #F5F3EE; --surface: #FCFBF8; --surface-muted: #EDE9E0;
  --ink: #2C2C2C; --muted: #6B6660; --dim: #786B4F;
  --accent: #C23A2E; --success: #527261; --info: #4A7B8C; --warning: #876100; --danger: #BE3A34;
  --border: rgba(120,107,79,0.18);
  --radius: 8px;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Source Code Pro", "SF Mono", Monaco, Consolas, monospace;
  --ease: cubic-bezier(.16,1,.3,1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.6 var(--sans); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-in { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 650; font-size: 16px; color: var(--ink); letter-spacing: -0.015em; }
.crumbs { color: var(--muted); font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--dim); }
.foot { color: var(--muted); font-size: 12px; padding-top: 24px; padding-bottom: 32px; }

h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; margin: 24px 0 8px; }
h2 { font-size: 18px; font-weight: 650; margin: 0 0 12px; letter-spacing: -0.015em; line-height: 1.25; }
h3 { font-size: 16px; font-weight: 650; margin: 16px 0 8px; }
p { margin: 0 0 8px; }
.lead { font-size: 16px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, code { font-family: var(--mono); font-size: 12px; color: var(--dim); overflow-wrap: anywhere; }

section.block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.state { color: var(--muted); padding: 12px 0; }
.state.bad, .error { color: var(--danger); }
.unread { color: var(--warning); }
.unread b { font-weight: 650; }

/* 表单 */
form.cond { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: start; }
.field label { display: block; font-weight: 650; margin-bottom: 4px; }
.field input, .field select, .filters select {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
button { font: inherit; border-radius: var(--radius); padding: 7px 16px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }
button:disabled { opacity: .6; cursor: progress; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, tr:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* 三项判断 */
.judges { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.judge { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: #fff; }
.judge .verdict { font-size: 18px; font-weight: 650; margin: 2px 0 6px; }
.judge ul { margin: 0; padding-left: 18px; color: var(--muted); }
.tone-ok .verdict { color: var(--success); }
.tone-warn .verdict { color: var(--warning); }
.tone-bad .verdict { color: var(--danger); }
.tone-neutral .verdict { color: var(--muted); }

/* 主数字与漏斗 */
.main-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.big { min-width: 200px; }
.big .num { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.big .what { color: var(--muted); }
.funnel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 260px; }
.stage { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; background: #fff; min-width: 88px; }
.stage .n { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stage .l { color: var(--muted); font-size: 12px; }
.arrow { color: var(--dim); }
.losses { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.loss h3 { margin-top: 0; font-size: 14px; }
.loss ul { margin: 0; padding-left: 18px; }

/* 表格 */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 650; color: var(--muted); background: var(--surface-muted); white-space: nowrap; font-size: 12px; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
tr.chain td { background: var(--bg); }
.chain-list { margin: 4px 0; padding-left: 18px; }
.chain-list li { margin: 2px 0; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 12px; margin-bottom: 12px; }
.filters label { font-size: 12px; color: var(--muted); display: block; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: var(--radius); background: var(--surface-muted); color: var(--muted); white-space: nowrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; margin: 0; }
.kv div { display: flex; gap: 8px; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; }
.toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.toggle button { border: 0; border-radius: 0; padding: 4px 12px; }
.toggle button[aria-pressed="true"] { background: var(--surface-muted); font-weight: 650; }

/* 时间图 */
.gantt { position: relative; min-width: 560px; }
.g-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; min-height: 26px; }
.g-row .g-label { font-size: 12px; color: var(--muted); padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-track { position: relative; height: 18px; border-bottom: 1px dashed var(--border); }
.g-bar { position: absolute; top: 2px; height: 14px; border-radius: 3px; background: var(--info); opacity: .85; min-width: 2px; }
.g-bar.custody { background: var(--dim); }
.g-bar.custody.alt { background: var(--success); }
.g-bar.plan { top: 15px; height: 4px; background: var(--dim); opacity: .45; }
.g-bar.plan.tail { background: var(--warning); opacity: .8; }
.g-bar.plan.ext { background: transparent; border-top: 2px dashed var(--danger); opacity: 1; height: 0; }
.g-head { font-size: 12px; font-weight: 650; color: var(--ink); margin: 8px 0 2px; }
.g-axis { position: relative; height: 18px; font-size: 12px; color: var(--muted); }
.g-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
/* 左右各让出 8px，和 .gantt 的内边距对齐，标记线才和色条对得上 */
.g-marks { position: absolute; top: 0; bottom: 0; left: 128px; right: 8px; pointer-events: none; }
.g-mark { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--accent); }
.g-mark.flip span { left: auto; right: 3px; }
.g-mark span { position: absolute; top: -2px; left: 3px; font-size: 12px; color: var(--accent); background: var(--surface); white-space: nowrap; padding: 0 2px; }
.g-pad { padding-top: 18px; position: relative; }

.recheck-result { margin-left: 4px; }
.ok-text { color: var(--success); }
.bad-text { color: var(--danger); }
details summary { cursor: pointer; color: var(--muted); }
details[open] summary { margin-bottom: 8px; }

/* 复制为新实验、与基准场对比 */
.lineage { color: var(--dim); }
.cmp-no { margin-top: 12px; color: var(--danger); }
.cmp-diffs { margin: 8px 0; }
.cmp-diffs ul { margin: 0; padding-left: 18px; color: var(--muted); }
tr.diff td { background: var(--surface-muted); }
.cmp-groups { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.cmp-groups button { padding: 4px 12px; font-size: 12px; }
.cmp-groups button[aria-pressed="true"] { background: var(--surface-muted); font-weight: 650; }
fieldset.knobs { border: 1px solid var(--border); border-radius: var(--radius); margin: 12px 0 0; padding: 8px 12px 12px; background: #fff; }
fieldset.knobs legend { font-weight: 650; padding: 0 4px; }
label.knob { display: block; padding: 3px 0; cursor: pointer; }
label.knob.none { margin-top: 8px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 12px; margin-top: 12px; }
.card ul { padding-left: 18px; margin: 8px 0; }
.card .field input, .card .field select { width: 100%; }

@media (max-width: 640px) {
  h1 { font-size: 20px; }
  section.block { padding: 12px; }
  .g-row { grid-template-columns: 96px 1fr; }
  .g-marks { left: 104px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 多份试卷（v1.1 条目 17） */
.cmp-lead { margin: 10px 0; font-size: 15px; line-height: 1.6; }
table.cmp-range th[colspan] { text-align: center; border-bottom: 1px solid var(--border, #ddd); }
.busy::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy::before { animation: none; } }
table.cmp-range td:first-child { min-width: 12em; }
table.cmp-range td.n, table.cmp-range th.n { white-space: nowrap; }
table.cmp-range td.small { min-width: 9em; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.pair table { width: 100%; }
/* 模板页（v1.1:76 给人用的那一版）：卡片、业务块的小表、手写 SVG 小图 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.tpl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tpl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tpl-name { font-size: 16px; font-weight: 650; color: var(--ink); }
.tpl-line { color: var(--ink); margin: 0; }
.tpl-card .actions { margin-top: 4px; flex-wrap: wrap; }
.tpl-card select { max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-muted); color: var(--dim); white-space: nowrap; }
details.fold { margin-top: 6px; }
details.fold > summary { font-size: 13px; }
details.fold.inline { display: inline-block; margin: 0 0 0 6px; vertical-align: baseline; }
details.fold.inline > summary { font-size: 12px; }
.main-actions { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.main-actions .actions { margin: 4px 0; flex-wrap: wrap; }
.blk h3 { margin-top: 12px; }
table.rows { width: 100%; table-layout: fixed; }
table.rows th:first-child, table.rows td:first-child { width: 26%; }
table.rows td { vertical-align: top; overflow-wrap: anywhere; }
table.points td.n, table.points th.n { width: 22%; }
table.points tr.big td { background: #F6E7C8; }
table.mini { width: auto; }
table.mini td, table.mini th { padding: 2px 10px 2px 0; }
svg.chart { width: 100%; max-width: 420px; height: auto; display: block; }
svg.chart.map { max-width: 460px; }
svg.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
svg.chart .base { stroke: var(--muted); stroke-dasharray: 4 3; stroke-width: 1; }
svg.chart .band { fill: #F6E7C8; }
svg.chart .tick, svg.chart .seg-label { font-size: 10px; fill: var(--muted); }
svg.chart .seg { fill: #DCE9EE; stroke: var(--info); stroke-width: 0.5; }
svg.chart .seg.dim { fill: var(--surface-muted); stroke: var(--border); }
svg.chart .seg.alt { fill: #F6E7C8; stroke: var(--warning); }
svg.chart .seg-label { fill: var(--ink); }
svg.chart .st { fill: var(--info); }
svg.chart .st.added { fill: var(--accent); }
svg.chart .st-label { font-size: 9px; fill: var(--ink); }
svg.chart .hot { fill: rgba(194,58,46,0.12); stroke: var(--accent); stroke-width: 1; }
svg.chart .hot-label { font-size: 10px; fill: var(--accent); }
.legend { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.legend .key { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.line-key { background: var(--accent); } .base-key { border-top: 1px dashed var(--muted); height: 0 !important; } .band-key { background: #F6E7C8; }
.st-key { background: var(--info); width: 8px !important; border-radius: 50% !important; } .hot-key { background: rgba(194,58,46,0.25); border: 1px solid var(--accent); }
@media (max-width: 640px) { table.rows th:first-child, table.rows td:first-child { width: 34%; } .tpl-grid { grid-template-columns: 1fr; } }
.tpl-card .actions { display: flex; align-items: center; gap: 10px; }
.tpl-card .cmp-row { color: var(--muted); font-size: 13px; }
.tpl-card .cmp-row select { flex: 1 1 auto; min-width: 0; }
.tpl-line { min-height: 2.6em; }
svg.chart.map { max-width: 560px; }
.seg-list { margin: 2px 0 0; padding-left: 20px; color: var(--muted); }
.blk > details.fold { margin: -4px 0 6px; }
tr.chart-row td { border-top: none; padding-top: 0; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; }
.pick-grid label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.pick-grid select { max-width: 100%; }

/* 开始页顶上去"照新框架开一场"的入口（v1.1:83） */
.lab-entry { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 20px 0 0; padding: 12px 16px; border-radius: var(--radius); background: var(--accent); color: #fff; }
.lab-entry:hover { text-decoration: none; filter: brightness(1.06); }
.lab-entry b { font-size: 16px; }
.lab-entry span { font-size: 13px; opacity: .9; }

/* 结论页头一屏（v1.1 修订 90）：四个数、没接的单卡在哪的比例条、出了岔子、四个去处。手机宽、平板宽都不横向滚动 */
.head1 .htrouble { border: 2px solid var(--danger); border-radius: var(--radius); padding: 8px 12px; color: var(--danger); margin: 0 0 12px; overflow-wrap: anywhere; }
.head1 .lead { font-size: 17px; overflow-wrap: anywhere; }
.hnums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.hnum { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; min-width: 0; }
.hnum .hwhat { font-size: 13px; color: var(--muted); }
.hnum .hn { font-size: 22px; font-weight: 600; }
.hstuck { border-bottom: 1px dashed var(--border); padding: 6px 0; }
.hstuck summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; cursor: pointer; }
.hstuck .hst { overflow-wrap: anywhere; }
.hstuck .hsc { white-space: nowrap; color: var(--muted); }
.hbar { grid-column: 1 / -1; display: block; height: 6px; background: var(--surface-muted); border-radius: 3px; overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--accent); }
.hgoto { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.hgoto button { min-width: 0; white-space: normal; }
/* 窄的时候两行两列（不出现三个加一个） */
@media (max-width: 640px) { .hnums, .hgoto { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
details.go { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
details.go > summary { font-size: 18px; font-weight: 600; color: var(--ink); cursor: pointer; }
details.go > summary .muted { font-size: 13px; font-weight: 400; }
