.tm-facts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tm-builder-controls label { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); margin: 8px 0; min-width: 0; }
.tm-builder-controls input:not([type=checkbox]), .tm-builder-controls select, .tm-builder-controls textarea { width: 100%; box-sizing: border-box; padding: 7px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 5px; }
.tm-builder-controls input[type=checkbox] { align-self: flex-start; }
.tm-builder-controls textarea, .tm-code { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55; }
.tm-builder-controls textarea { resize: vertical; }
.tm-builder-controls summary { cursor: pointer; }
.tm-muted { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; }
.tm-code { background: var(--code-bg); padding: 12px; border: 1px solid var(--border); border-radius: 5px; overflow: auto; max-height: 420px; }
#rb-status-msg, #rb-strict-preview { overflow-wrap: anywhere; }
/* Step 5: the name of each manifest about to be published. */
.rb-name-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rb-name-fields label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
.rb-name-fields label[hidden] { display: none; }
.rb-name-fields .input-box { width: 100%; }
.rb-name-fields label.rb-debug-row { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 600; cursor: pointer; }
.rb-name-fields label.rb-debug-row input { margin-top: 3px; }
.rb-name-fields label.rb-debug-row .tm-muted { display: block; font-weight: 400; font-size: var(--fs-xs); }
/* 快照 window: name and id copy on click; the install and usage blocks follow. */
.tm-snap-head h3 { margin: 0 28px 4px 0; font-size: var(--fs-md); overflow-wrap: anywhere; }
.tm-snap-head p { margin: 0 0 12px; color: var(--ink-3); font-size: var(--fs-sm); }
.tm-snap-id { font-family: var(--font-mono); font-size: var(--fs-sm); }
#manifest-modal-content h4 { margin: 14px 0 6px; }
#manifest-modal-content .tm-code + .btn { margin-top: 8px; }
#post-pipeline-stepper:empty { display: none; }
#recipe-builder-modal :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#recipe-builder-modal button:disabled { opacity: .5; cursor: default; }
@media (max-width: 700px) {
  .tm-grid { grid-template-columns: 1fr; }
  .rb-modal-header { flex-direction: column; gap: 8px !important; }
  #recipe-builder-modal { padding: 8px !important; }
  #recipe-builder-modal > div { width: 100% !important; padding: 14px !important; }
  .rb-step-view > div { grid-template-columns: minmax(0, 1fr) !important; }
  .rb-preset-bar, .rb-wizard-footer > div { flex-wrap: wrap; }
  .rb-wizard-nav { overflow-x: auto; }
}

/* Explicit selection and augmentation controls retain the existing editor. */
.tm-range-inputs { display: flex; align-items: center; gap: var(--space-2, 8px); }
.tm-range-inputs input { min-width: 0; width: 100%; }
.tm-builder-controls fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 12px 0; min-width: 0; }
.tm-builder-controls legend { color: var(--text); font-weight: 600; padding: 0 6px; }
.tm-builder-controls fieldset:disabled { opacity: 0.65; }
.tm-asset-option { display: block; margin: 8px 0; }
.tm-asset-path { overflow-wrap: anywhere; color: var(--text-muted); font-size: var(--fs-xs); }
.tm-builder-controls [hidden] { display: none !important; }

/* The contract's own verdict on the draft, refreshed as it is edited. It is
   shown whether it passes or fails: a panel that only appears on failure
   cannot be told apart from one that never ran. */
.tm-contract-ok { color: var(--ok, #3fa34d); font-size: var(--fs-sm); margin-top: 8px; }
.tm-contract-problems { color: var(--fail, #d05353); font-size: var(--fs-sm); margin-top: 8px; }
.tm-contract-problems ul { margin: 6px 0 0; padding-left: 18px; }
.tm-contract-problems li { margin: 3px 0; overflow-wrap: anywhere; }

/* Step 1: train/val split table (Task 8 shell; Task 9 fills it with data). */
.tm-split-table-wrap { overflow-x: auto; }
.tm-split-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tm-split-table th, .tm-split-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.tm-split-table input { width: 6.5rem; }
.tm-split-table tr.tm-split-invalid { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.tm-split-table td.tm-split-counts { font-family: var(--font-mono); color: var(--text-muted); }
/* 一侧只有一个来源时配比被锁成 1：灰底灰字，说明它不是坏了而是没有意义。 */
.tm-split-table input.rb-split-weight:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.rb-split-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
/* Which pool is open has to read at a glance from step 2 on: the strip is a
   coloured band with a filled segment, and train and val take different hues
   so the two are not told apart by the label alone. */
.rb-pool-tabs { --pool-hue: var(--accent); display: flex; gap: 12px; margin-bottom: 12px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--pool-hue); border-left-width: 5px; border-radius: 8px;
  background: color-mix(in srgb, var(--pool-hue) 9%, transparent); }
.rb-pool-tabs[data-active-pool=val] { --pool-hue: var(--warn, #c98a1b); }
.rb-pool-current { font-size: var(--fs-md); font-weight: 600; color: var(--pool-hue); white-space: nowrap; }
.rb-pool-current b { font-family: var(--font-mono); font-size: var(--fs-md); text-transform: uppercase; }
.rb-pool-switch { display: inline-flex; border: 1px solid var(--pool-hue); border-radius: 6px; overflow: hidden; }
.rb-pool-tab { padding: 6px 16px; font-size: var(--fs-sm); font-weight: 600; font-family: var(--font-mono); cursor: pointer;
  border: 0; background: transparent; color: var(--text-muted); }
.rb-pool-tab + .rb-pool-tab { border-left: 1px solid var(--pool-hue); }
.rb-pool-tab:hover { color: var(--text); }
.rb-pool-tab.active { background: var(--pool-hue); color: #fff; }
/* An author ``display`` beats the UA sheet's ``[hidden]`` rule, and the
   project's ``!important`` override is scoped under .tm-builder-controls,
   which this strip is a sibling of -- so it needs its own. */
.rb-pool-tabs[hidden] { display: none; }
/* Step 1 is where the split itself is decided; there is no pool to configure
   yet, so the strip stays out of the way until step 2. */
.rb-pool-tabs.on-split-step { display: none; }
.tm-pool-overridden { color: var(--accent); font-size: var(--fs-xs); margin-left: 6px; }
@media (max-width: 700px) {
  .rb-split-toolbar { flex-direction: column; align-items: stretch; }
  .tm-split-table input { width: 100%; }
}
/* Step 2: per-dataset parameters. Fields run down, datasets run across. */
.rb-ds-wrap { overflow-x: auto; }
.rb-ds-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.rb-ds-table th, .rb-ds-table td { border-bottom: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: middle; }
.rb-ds-table thead th { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.rb-ds-table thead th small { display: block; font-family: var(--font-sans); font-weight: 400; color: var(--text-muted); font-size: var(--fs-xs); }
.rb-ds-table tr.rb-ds-section td { background: var(--surface-2); font-weight: 600; font-size: var(--fs-xs); }
.rb-ds-table td.rb-ds-key { font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; width: 1%; }
.rb-ds-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-ds-cell small { color: var(--text-muted); font-size: var(--fs-xs); font-family: var(--font-mono); }
.rb-ds-pair { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rb-ds-cell { flex-wrap: nowrap; }
.rb-ds-cell .input-box { flex: 1; min-width: 0; box-sizing: border-box; }
.rb-ds-table td.rb-ds-name { font-family: var(--font-mono); white-space: nowrap; width: 1%; }
.rb-ds-table .rb-ds-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; width: 1%; }
.rb-ds-cell .input-box.rb-ds-narrow { width: 84px; }
.rb-ds-cell .input-box.rb-ds-mono { font-family: var(--font-mono); }
/* Step 2: the one container for the pair, above the per-dataset table. */
.rb-container-pick { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-muted); }
.rb-container-pick select { min-width: 0; max-width: 100%; font-family: var(--font-mono); }
.rb-container-pick[hidden] { display: none; }
/* A group whose dc nobody verified (step 2), and the same list on a running publication. */
.rb-quaplat-banner, .rb-quaplat-warn { margin: 0 0 12px; padding: 6px 10px; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--radius); }
.rb-quaplat-banner[hidden] { display: none; }
/* Step 3: two cards side by side. Step 4: the image card and the augmentation card. */
.rb-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.rb-image-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .rb-two, .rb-image-grid { grid-template-columns: 1fr; } }
.tm-builder-controls label.rb-inline-check { flex-direction: row; align-items: center; gap: 8px; font-family: var(--font-mono); }
.rb-patch-presets { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.rb-patch-presets .btn-action { font-size: var(--fs-xs); padding: 2px 10px; font-weight: 600; }
#rb-summary td { overflow-wrap: anywhere; }
/* The on/off switch of the augmentation editor reads as one line. */
#rb-augmentation-editor > label { flex-direction: row; align-items: center; gap: 6px; }
/* The derive modal's title: 衍生训练/测试清单, the source dm's name, its id, on one line. */
.rb-title { flex: 1; display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; min-width: 0; }
.rb-title-k { font-size: var(--fs-lg); font-weight: 600; color: var(--accent-fg); white-space: nowrap; }
.rb-title-name { font-size: var(--fs-md); font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.rb-title-name:empty { display: none; }
.rb-title-id { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-muted); }
@media (max-width: 720px) { .rb-ds-table td.rb-ds-name { white-space: normal; overflow-wrap: anywhere; } }
/* Step 5 摘要: a long group id wraps instead of squeezing the value column to one character. */
#rb-summary td { overflow-wrap: anywhere; }
#rb-summary td.rb-ds-key { white-space: normal; width: 38%; }

/* 快照: a tm with video -- bucket shares as bars, per group what was drawn and left out. */
.tm-vs { font-size: var(--fs-sm); color: var(--ink-2); margin: 4px 0 8px; }
.tm-vb { display: grid; gap: 4px; margin-bottom: 10px; overflow-x: auto; }
.tm-vb-row { display: grid; grid-template-columns: repeat(var(--tm-vb-slots, 1), 7.5em) 1fr 4em 5em; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.tm-vb-head { color: var(--ink-3); font-size: var(--fs-xs); }
.tm-vb-bar { height: 10px; background: var(--panel-deep); border-radius: 3px; overflow: hidden; }
.tm-vb-bar i { display: block; height: 100%; background: var(--accent); }
.tm-vb-num { text-align: right; font-variant-numeric: tabular-nums; }
.tm-vg { border-collapse: collapse; font-size: var(--fs-sm); margin-bottom: 12px; }
.tm-vg th, .tm-vg td { padding: 3px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.tm-vg th:first-child, .tm-vg td:first-child { text-align: left; font-family: var(--font-mono); }
.tm-vg th { color: var(--ink-3); font-weight: 500; font-size: var(--fs-xs); }
.tm-vg-drop { color: var(--warn); }
