/* 容器页 / 数据集配置页。只用 tokens.css 的 v3 token，零十六进制。 */
.dc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; padding: 12px 16px 16px; }
tr.is-dragging { opacity: .5; }
tr.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
tr.is-flash, .is-flash { outline: 2px solid var(--warn); outline-offset: -2px; }
.dc-layout table input { min-width: 64px; }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* 数据集配置页 */
.dc-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 0 16px; }
.dc-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 12px 16px 0; }
.dc-full { padding: 12px 16px 0; }
.dc-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--panel); min-width: 0; }
.dc-panel h4 { margin: 0 0 8px; font-size: var(--fs-sm); color: var(--ink); }
.dc-panel .dc-scroll { max-height: 420px; overflow: auto; }
/* series routes: seven columns; the number fields stay narrow so the row fits, and scroll when it does not */
.dc-panel .dc-series-table .input-box { width: 7.5em; min-width: 0; }
.dc-panel .dc-series-table select.filter-select { width: auto; max-width: 16em; }
tr.dc-src-head td, tr.dc-slot-head td { background: var(--panel-deep); color: var(--ink-2); font-weight: 600; }
tr.dc-dim { cursor: pointer; }
td.dc-dim-name { color: var(--ink-2); }
tr.dc-dim.is-selected td { background: var(--accent-soft); color: var(--ink); }
tr.dc-dim.is-written td { color: var(--ink-3); background: var(--panel-deep); }
tr.dc-drop.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
tr.dc-drop.is-drop-overwrite { outline-color: var(--warn); }
tr.dc-drop.is-drop-overwrite td:last-child::after { content: '  → 覆盖'; color: var(--warn); font-weight: 600; }
.dc-stream-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
/* .btn.ghost sets its background with !important (matrix.css), so the picked tab needs it too. */
.dc-stream-tabs button.active { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--on-accent) !important; font-weight: 600; }
.dc-stream-tabs .dc-undo { margin-left: auto; }
.dc-tgen { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.dc-tgen label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); }
.dc-tbar { display: flex; gap: 1px; margin: 6px 0; flex-wrap: wrap; }
.dc-tbar span { display: inline-block; width: 6px; height: 14px; background: var(--accent); }
.dc-tbar span.is-null { background: var(--line-soft); }
.dc-grid-wrap { margin-top: 8px; }
.dc-grid-wrap svg.cg { max-width: 100%; height: auto; display: block; }
.cg text { font-family: var(--font-mono); font-size: 9px; fill: var(--ink-2); }
.cg .cg-slot { fill: var(--ink); font-weight: 600; }
.cg-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--fs-xs); color: var(--ink-2); margin-top: 6px; }
.cg-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -2px; }
.dc-t0 { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.dc-t0 input[type=range] { flex: 1; }
#dc-container-view { max-height: 260px; }

/* 样本预览 */
.dc-preview-block { margin-top: 10px; }
.dc-preview-block h4 { margin-bottom: 6px; }
.dc-preview-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pv-cams { display: flex; flex-wrap: wrap; gap: 10px; }
.pv-cam { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.pv-cam img { width: 160px; height: 160px; object-fit: contain; background: var(--panel-deep); border: 1px solid var(--line); border-radius: 4px; }
.pv-cam figcaption, .pv-cam-empty { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); }
.pv-cam-empty { width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--panel-deep); border: 1px dashed var(--line); border-radius: 4px; color: var(--ink-3); }
.pv-charts { display: flex; flex-wrap: wrap; gap: 12px; }
.pv-chart { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
svg.pv { max-width: 100%; height: auto; display: block; }
.pv text { font-family: var(--font-mono); font-size: 9px; fill: var(--ink-2); }
.pv .pv-slot { fill: var(--ink); font-weight: 600; }
.pv .pv-frame { stroke: var(--line); }
.pv .pv-line { stroke-width: 1.5; }
.pv .pv-off { fill: var(--panel); stroke-width: 1; }
.pv .pv-nan { fill: var(--warn); font-size: 10px; }
.pv-dims { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--fs-xs); font-family: var(--font-mono); color: var(--ink-2); }
.pv-dims i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.pv-table-wrap { max-height: 320px; overflow: auto; }
.pv-table td.is-masked, .pv-meta tr.is-masked td { color: var(--ink-3); background: var(--panel-deep); }
.pv-params td { vertical-align: top; font-size: var(--fs-xs); }
.pv-params tr.is-masked td { background: var(--panel-deep); color: var(--ink-3); }
.pv-params .pv-bad { color: var(--fail); font-weight: 600; }
@media (max-width: 1100px) { .dc-preview-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .dc-layout, .dc-two { grid-template-columns: minmax(0, 1fr); } }
.dc-overlay { position: fixed; inset: 0; z-index: 1100; overflow-y: auto; background: var(--bg); padding: 16px; box-sizing: border-box; }
.cp-fx-bad { color: var(--danger); }
.dc-video-canvas { white-space: nowrap; }
#dc-videos-panel { overflow-x: auto; }

/* User ops (userop.js): the dataset-config editor's 算子 panel, its picker, the 算子 page, step 2's read-only row. */
.uo-k { font-weight: 600; font-size: var(--fs-sm); }
.uo-k small { display: block; font-weight: 400; opacity: 0.7; }
.uo-ms { display: block; font-weight: 400; font-size: var(--fs-xs); }
.uo-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.uo-chip { border: 1px solid var(--accent-line); border-radius: 8px; font-size: var(--fs-sm); max-width: 100%; }
.uo-chip[open] { flex-basis: 100%; }
.uo-chip.is-missing { border-style: dashed; }
.uo-chip summary { display: flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; cursor: pointer; list-style: none; }
.uo-chip summary::-webkit-details-marker { display: none; }
.uo-chip summary[data-uo-sort] { cursor: grab; user-select: none; touch-action: none; }
body.uo-sorting, body.uo-sorting * { cursor: grabbing !important; user-select: none; }
.uo-chip .uo-x { width: 22px; height: 22px; font-size: var(--fs-md); }
.uo-warn { margin-left: 8px; font-size: var(--fs-xs); }
.uo-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 10px; padding: 6px 10px 10px; }
.uo-param { display: flex; flex-direction: column; font-size: var(--fs-xs); gap: 2px; }
.uo-param input[type="checkbox"] { align-self: flex-start; }
.uo-plus { border: 1px dashed currentColor; border-radius: 8px; padding: 2px 12px; min-width: 32px; background: none; color: inherit; opacity: 0.75; cursor: pointer; font-size: var(--fs-sm); }
.uo-sum { padding-top: 8px; font-size: var(--fs-sm); border-top: 1px solid var(--line); }
.uo-legacy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); }
.uo-tag-new { font-size: var(--fs-xs); font-weight: 600; background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
tr.dc-src-head.is-op td, tr.dc-dim.is-op td { background: var(--accent-soft); }
tr.dc-dim.is-op.is-selected td { background: var(--accent-line); }
.uo-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-start; justify-content: center; z-index: 1200; padding: 60px 16px; }  /* above the dc overlay (1100) */
.uo-modal[hidden] { display: none; }
.uo-modal-card { background: var(--panel); color: inherit; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-overlay, none); width: min(640px, 100%); max-height: 80vh; display: flex; flex-direction: column; padding: 14px 16px; box-sizing: border-box; }
.uo-modal-card.is-many { width: min(920px, 100%); }
.uo-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.uo-modal-card .input-box { width: 100%; box-sizing: border-box; }
.uo-x { border: 0; background: none; color: var(--ink-3); font-size: var(--fs-lg); line-height: 1; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; flex: none; }
.uo-x:hover { background: var(--wash); color: var(--ink); }
/* Left: the library, each op with 「+」. Right (pickMany): the draft, top to bottom = run order. */
.uo-picker-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-height: 0; flex: 1; }
.is-many .uo-picker-body { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
.uo-picker-left { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.uo-picker-list { overflow-y: auto; min-height: 0; max-height: calc(80vh - 170px); }
.uo-pick { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.uo-pick:first-child { border-top: 0; }
.uo-pick-main { flex: 1; min-width: 0; }
.uo-pick-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uo-ver { font: inherit; font-size: var(--fs-sm); padding: 1px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg, var(--panel)); color: inherit; }
.uo-meta { font-size: var(--fs-xs); }
.uo-doc { margin-top: 2px; font-size: var(--fs-sm); }
.uo-add { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-lg); line-height: 1; cursor: pointer; }
.uo-add:hover { background: var(--accent); color: var(--on-accent); }
.uo-count { flex: none; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: var(--fs-xs); text-align: center; line-height: 18px; }
.uo-count[hidden] { display: none; }
.uo-draft { border-left: 1px solid var(--line); padding-left: 16px; min-height: 0; overflow-y: auto; max-height: calc(80vh - 130px); font-size: var(--fs-sm); }
.uo-draft[hidden] { display: none; }
.uo-draft-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.uo-draft-head .tm-muted { font-size: var(--fs-xs); }
.uo-draft-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.uo-draft-list:empty { border: 1px dashed var(--line); border-radius: 8px; }
.uo-draft-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: grab; user-select: none; touch-action: none; }
.uo-draft-list li:hover { border-color: var(--line-hi); }
.uo-grip { color: var(--ink-3); cursor: grab; user-select: none; }
.uo-num { color: var(--accent); font-family: var(--font-mono); font-size: var(--fs-xs); }
.uo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-dragging { opacity: 0.4; }
.is-drop-target { outline: 2px solid var(--accent); outline-offset: 1px; }
.uo-modal-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
.uo-modal-foot[hidden] { display: none; }
@media (max-width: 720px) {
  .is-many .uo-picker-body { grid-template-columns: minmax(0, 1fr); }
  .uo-draft { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 10px; max-height: none; }
  .uo-picker-list { max-height: 40vh; }
}
.uo-tag { margin-left: 8px; font-size: var(--fs-xs); }
.uo-pad { padding: 6px 0; font-size: var(--fs-sm); }
.uo-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; font-size: var(--fs-sm); }
/* The 「算子」 page: Tutorial in the page's strongest contrast (ink on panel, inverted), one row of
   search and kind, and one button per op that opens it in a window (userop.js openOp). */
.btn.uo-tutorial { background: var(--ink); color: var(--panel); border: 1px solid var(--ink); font-weight: 600; }
.btn.uo-tutorial:hover { opacity: 0.85; }
.uo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.uo-search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 420px; }
.uo-search .input-box { flex: 1; min-width: 0; }
#section-userops .uo-filter { margin: 0; }
.uo-admin { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--ink-2); }
.uo-lib-head, .uo-lib-row { display: grid; grid-template-columns: minmax(0, 3fr) 120px 110px minmax(0, 1fr) 96px; gap: 12px; padding: 8px 12px; align-items: center; }
.uo-lib-head { font-size: var(--fs-xs); color: var(--ink-3); background: var(--panel-deep); border-bottom: 1px solid var(--line); padding-block: 7px; }
.uo-lib-row { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: inherit; font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.uo-lib-row:hover { background: var(--wash); }
.uo-lib-row > span { min-width: 0; overflow-wrap: anywhere; }
.uo-lib-name { display: flex; flex-direction: column; gap: 2px; }
.uo-lib-doc { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uo-lib-doc.is-none { color: var(--ink-3); }
/* The op window: the newest version, or two versions side by side. */
.mx-modal.uo-op-modal { width: min(920px, 100%); }
.mx-modal.uo-op-modal.mx-modal-wide { width: min(1280px, 100%); }
.uo-op-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: var(--fs-sm); }
.uo-op-ver { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); }
.uo-op-meta { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.uo-op-doc { white-space: pre-line; line-height: 1.6; color: var(--ink); max-width: 80ch; }
.uo-params-table { width: auto; min-width: 60%; border: 1px solid var(--line); border-radius: 6px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.uo-params-table td, .uo-params-table th { padding: 5px 12px; }
.uo-src-box { border-top: 1px solid var(--line); }
.uo-src-box > summary { padding: 10px 0; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.uo-src { max-height: 60vh; overflow: auto; font-size: var(--fs-xs); white-space: pre; margin: 0; }
/* Opened from a tm's 结构图: the params that dc wrote, above the op's own meta. */
.uo-use { margin-bottom: 10px; padding: 10px 12px; border-left: 2px solid var(--accent-line); background: var(--sel); font-size: var(--fs-sm); }
.uo-use-head { margin-bottom: 6px; overflow-wrap: anywhere; }
.uo-use-table { width: auto; border-collapse: collapse; font-size: var(--fs-sm); }
.uo-use-table th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 2px 14px 4px 0; }
.uo-use-table td { padding: 2px 14px 2px 0; vertical-align: top; overflow-wrap: anywhere; }
/* 参数名和标记不折行；只有值可以在格内折。 */
.uo-use-table td:first-child, .uo-use-table td:last-child { white-space: nowrap; }
.uo-use-table .uo-tag, .uo-use-table .uo-warn { margin-left: 0; }
.uo-use-table tr.is-written td { color: var(--ink); }
.uo-use-table tr:not(.is-written) td { color: var(--ink-3); }
.uo-diff-pick { display: flex; align-items: center; gap: 6px; }
.uo-diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.uo-diff-sum { margin-bottom: 6px; font-size: var(--fs-sm); }
.uo-diff-add { color: var(--pass); font-weight: 600; }
.uo-diff-del { color: var(--fail); font-weight: 600; }
.uo-diff-wrap { max-height: 65vh; overflow: auto; border: 1px solid var(--border); border-radius: 5px; background: var(--code-bg); }
.uo-diff { width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.5; }
.uo-diff-nocol { width: 3.2em; }
.uo-diff td { padding: 0 6px; vertical-align: top; border: 0; }
.uo-diff-no { text-align: right; color: var(--ink-3); user-select: none; }
.uo-diff-code { white-space: pre-wrap; overflow-wrap: anywhere; }
.uo-diff td.uo-diff-code + .uo-diff-no { border-left: 1px solid var(--border); }
.uo-diff .is-add { background: var(--pass-soft); }
.uo-diff .uo-diff-no.is-add { background: var(--pass-line); color: var(--ink); }
.uo-diff .is-del { background: var(--fail-soft); }
.uo-diff .uo-diff-no.is-del { background: var(--fail-line); color: var(--ink); }
.uo-diff .is-empty { background: var(--panel-deep); }
.uo-diff-fold td { padding: 0; }
.uo-diff-fold button { width: 100%; border: 0; border-block: 1px solid var(--border); background: var(--accent-soft); color: var(--accent); font: inherit; padding: 2px 0; cursor: pointer; }
@media (max-width: 720px) {
  .uo-row { grid-template-columns: 1fr; }
  .uo-lib-head, .uo-lib-row { grid-template-columns: minmax(0, 1fr) auto; }
  .uo-lib-head > span:nth-child(n+3), .uo-lib-row > span:nth-child(n+3) { display: none; }
  .uo-diff-nocol { width: 2.4em; }
  .uo-diff td { padding: 0 3px; }
}
.dc-src-search { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.dc-src-search input { flex: 1; min-width: 0; }
.dc-busy { position: fixed; inset: 0; z-index: 1101; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 70%, transparent); cursor: progress; }
.dc-busy[hidden] { display: none; }
.dc-busy-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-overlay, none); cursor: default; }
.dc-slots-hint { font-size: var(--fs-xs); margin-bottom: 6px; }
/* manifest_id / dataset_name: fixed by the wizard, so the select is disabled; a click on it reaches
   the label, which copies the value (index.html, data-copy-from). */
.dc-copy-field { cursor: pointer; }
.dc-copy-field select:disabled { pointer-events: none; }
/* A container or dataset config the viewer cannot change: 保存 derives a copy instead. */
.cm-readonly { margin: 8px 12px 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--accent-soft); color: var(--ink); font-size: var(--fs-sm); }
#cp-publish[hidden], #cp-delete[hidden], #cp-state[hidden], #dc-delete[hidden], #dc-quaplat-mark[hidden], .cm-readonly[hidden] { display: none; }

/* quaplat：dc 抬头的质检状态与「标记质检」表单 */
#dc-quaplat:empty { display: none; }
.qp-mark-form { display: grid; gap: var(--space-2); }
.qp-mark-form[hidden] { display: none; }

/* 数据集配置的表单：分组用一条上边线和标题，不画整框；裸输入框和全站输入框同一个样子。 */
.dc-layout fieldset { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 12px 0 8px; margin: 4px 0 0; min-width: 0; }
.dc-layout legend { padding: 0 8px 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.dc-layout input:not([type=checkbox]):not([type=range]):not([type=radio]),
.dc-layout select, .dc-layout textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; min-height: 30px;
  color: var(--ink); font: var(--fs-sm)/1.4 var(--font-sans); }
.dc-layout textarea { font-family: var(--font-mono); font-size: var(--fs-xs); }
.dc-layout input:hover, .dc-layout select:hover { border-color: var(--line-hi); }
.dc-layout input:focus, .dc-layout select:focus, .dc-layout textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dc-layout input:disabled { background: var(--panel-deep); color: var(--ink-3); }
.dc-layout .btn.ghost { color: var(--accent); }

/* ---------- 容器页 ----------
   The page reads as one sample, top to bottom, on the paper: four groups under serif titles, a stream's
   slots drawn to scale above their rows. A field looks like text until the pointer reaches its row.
   A kind of slot with nothing in it is one line. The JSON stays beside the form. */
.cp-page { margin-bottom: 24px; }
.cp-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 4px 0 6px; min-height: 40px; }
.cp-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.cp-head-left .panel-title { color: var(--ink-3); font-size: var(--fs-sm); }
#cp-spec-select { max-width: min(320px, 100%); min-width: 0; background: var(--sel); border-color: transparent; border-radius: var(--radius-pill); padding-left: 14px; font-size: var(--fs-xs); color: var(--ink-2); }
#cp-spec-select:hover { background: var(--sel-hi); }
.cp-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 2px 0 14px; }
.cp-title {
  flex: 0 1 auto; field-sizing: content; min-width: 10em; max-width: 100%; box-sizing: border-box; margin-left: -8px; padding: 2px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; outline: none;
  font: 500 var(--fs-xl)/1.3 var(--font-serif); letter-spacing: -0.01em; color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
}
.cp-title:hover { border-color: var(--line); }
.cp-title:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cp-title::placeholder { color: var(--ink-3); }
#cp-id:empty { display: none; }
#section-container .cm-readonly { margin: 0 0 14px; border: 0; background: var(--sel); }

.cp-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 40px; align-items: start; }
.cp-form { min-width: 0; }
.cp-group { padding: 18px 0 26px; border-top: 1px solid var(--line); min-width: 0; }
.cp-group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; min-height: 30px; margin-bottom: 10px; }
.cp-group-head h3 { margin: 0; margin-right: auto; font-size: var(--fs-md); color: var(--ink); }

.cp-sec { min-width: 0; }
.cp-sec + .cp-sec { margin-top: 18px; }
.cp-sec:has(tbody:empty) + .cp-sec { margin-top: 2px; }
.cp-sec:has(tbody:empty) .cp-scroll { display: none; }
.cp-sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; min-height: 30px; }
.cp-key { margin: 0; font: 500 var(--fs-sm)/1.4 var(--font-mono); color: var(--ink); }
.cp-sec:has(tbody:empty) .cp-key { font-weight: 400; color: var(--ink-3); }
.cp-key[title] { cursor: help; }
.cp-sum { font: var(--fs-xs)/1.4 var(--font-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cp-sec-head .cp-add { margin-left: auto; }

.cp-param { display: inline-flex; align-items: center; gap: 6px; font: var(--fs-xs)/1.4 var(--font-mono); color: var(--ink-3); }
.cp-param label { display: inline-flex; align-items: center; gap: 6px; }
span.cp-param { gap: 14px; }
.cp-param .input-box, .cp-param .filter-select, .cp-table .input-box, .cp-table .filter-select {
  min-height: 26px; padding: 2px 6px; border-color: transparent; background: transparent; font-size: var(--fs-sm); box-shadow: none;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.cp-param .input-box { width: 5.5em; background: var(--sel); }
.cp-param .filter-select { max-width: 200px; background: var(--sel); }
.cp-param .input-box:hover, .cp-param .filter-select:hover { background: var(--sel-hi); border-color: transparent; }
#section-container input[type=number]::-webkit-inner-spin-button, #section-container input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cp-table tr:hover .input-box, .cp-table tr:hover .filter-select { border-color: var(--line); }
.cp-table .input-box:focus, .cp-table .filter-select:focus, .cp-param .input-box:focus, .cp-param .filter-select:focus {
  border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.cp-table .input-box:disabled { color: var(--ink-3); cursor: not-allowed; -webkit-text-fill-color: var(--ink-3); opacity: 1; }
.cp-table tr:hover .input-box:disabled { border-color: transparent; }
.cp-check { gap: 6px; cursor: pointer; }

.cp-add {
  display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 26px; padding: 2px 8px 2px 6px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--accent); font: var(--fs-xs)/1.4 var(--font-sans); cursor: pointer; transition: background var(--t);
}
.cp-add:hover { background: var(--accent-soft); }
.cp-add .ic { width: 13px; height: 13px; }
.cp-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-3); cursor: pointer; transition: background var(--t), color var(--t), opacity var(--t);
}
.cp-icon:hover { background: var(--sel-hi); color: var(--ink); }
.cp-icon .ic { width: 14px; height: 14px; }
.cp-add:focus-visible, .cp-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A stream's slots to scale: one fill, the gap is the boundary. A name may be wider than its slot, so names sit
   on their own line under the bar, in the same order. The slot under the pointer is the dark piece. */
.cp-bar { display: flex; gap: 2px; margin: 6px 0 0; }
.cp-bar:empty, .cp-legend:empty { display: none; }
.cp-seg { flex: 1 1 0; min-width: 1px; height: 10px; border-radius: 3px; background: var(--sel-hi); cursor: default; transition: background var(--t); }
.cp-seg.is-hot { background: var(--primary-bg); }
.cp-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 6px 0 2px; font: var(--fs-xs)/1.5 var(--font-mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cp-leg { cursor: default; white-space: nowrap; }
.cp-leg b { font-weight: 500; color: var(--ink-2); transition: color var(--t); }
.cp-leg.is-hot, .cp-leg.is-hot b { color: var(--ink); }

.cp-scroll { overflow-x: auto; }
.cp-table { width: 100%; border-collapse: collapse; }
.cp-table thead th { padding: 6px 6px 4px; background: none; border-bottom: 1px solid var(--line); font: 400 var(--fs-xs)/1.4 var(--font-mono); color: var(--ink-3); text-align: left; white-space: nowrap; position: static; text-transform: none; letter-spacing: 0; }
.cp-table td { padding: 2px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: var(--fs-sm); }
.cp-table tbody tr:last-child td { border-bottom: 0; }
.cp-table tbody tr:hover, .cp-table tbody tr.is-hot { background: var(--wash); }
.cp-table td .input-box { width: 100%; min-width: 72px; box-sizing: border-box; }
.cp-table td .filter-select { max-width: 100%; }
.cp-table td input[data-field$="slot"], .cp-table td input[data-field="meta-field"] { min-width: 120px; }
.cp-col-grip, .cp-table .cp-handle { width: 22px; padding: 0; }
.cp-col-num { width: 84px; }
.cp-col-name { width: 200px; }
.cp-col-read, .cp-table td.cp-col-read { width: 56px; text-align: center; }
.cp-col-first { width: 222px; }
.cp-col-del, .cp-table td.cp-col-del { width: 28px; padding: 0; text-align: right; }
.cp-handle { cursor: grab; color: var(--ink-3); text-align: center; user-select: none; opacity: 0; transition: opacity var(--t); }
.cp-handle .ic { width: 14px; height: 14px; vertical-align: -2px; }
.cp-table td.cp-off { padding-left: 7px; color: var(--ink-3); }
#cp-fornax-links td.mono { padding: 4px 12px 4px 6px; overflow-wrap: anywhere; }
.cp-table td.cp-col-del .cp-icon { opacity: 0; }
.cp-table tr:hover .cp-handle, .cp-table tr:hover td.cp-col-del .cp-icon, .cp-table td.cp-col-del .cp-icon:focus-visible { opacity: 1; }
@media (hover: none) { .cp-handle, .cp-table td.cp-col-del .cp-icon { opacity: 1; } }
.cp-desc { min-width: 40px; }
.cp-desc-piece, .cp-fx-slot { display: inline-flex; align-items: center; gap: 2px; margin-right: 4px; vertical-align: middle; }
.cp-table td .cp-desc-piece .input-box { width: 96px; min-width: 0; }
.cp-table td .cp-fx-dims { width: 64px; min-width: 0; }
.cp-desc .cp-icon { width: 22px; height: 22px; vertical-align: middle; }
.cp-shape { display: inline-flex; align-items: center; gap: 2px; }
.cp-shape i { font-style: normal; font-size: var(--fs-xs); color: var(--ink-3); }
.cp-table td .cp-shape .input-box { width: 58px; min-width: 0; text-align: center; }
#cp-fornax-links input[type=number] { width: 56px; min-width: 0; display: inline-block; }
#cp-tensors select { min-width: 92px; }

/* Beside the form while it scrolls: whether the body is valid, then the body. */
.cp-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: calc(100vh - 96px); }
#cp-problems { margin: 0; font-size: var(--fs-xs); overflow-y: auto; flex: 0 1 auto; max-height: 40vh; }
#cp-problems.tm-contract-ok { color: var(--pass); }
#cp-problems.tm-contract-ok::before { content: '结构校验通过'; }
.cp-json-head { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
#cp-json {
  flex: 1 1 auto; min-height: 240px; width: 100%; box-sizing: border-box; padding: 12px 14px; resize: none;
  border: 0; border-radius: var(--radius); background: var(--code-bg); color: var(--ink-2); outline: none;
  font: var(--fs-xs)/1.6 var(--font-mono); tab-size: 2;
}
#cp-json:focus { box-shadow: 0 0 0 2px var(--accent-line); }
@media (max-width: 1100px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cp-side { position: static; max-height: none; }
  #cp-json { min-height: 320px; resize: vertical; }
  .cp-title { font-size: var(--fs-lg); min-width: 0; width: 100%; }
}
