/* 结构图（TmStructure）和「训练清单」页（TmListPage）。颜色只用 tokens.css 里的变量。 */

/* ---- 窗口 ---- */
.mx-modal.tms-modal { width: min(760px, 100%); }
.mx-modal.tms-modal.tms-wide { width: min(1480px, 100%); }
.tms-head { display: flex; align-items: flex-start; gap: 10px; }
.tms-titles { flex: 1; min-width: 0; }
.tms-titles .mx-dialog-title { overflow-wrap: anywhere; }
.tms-back { border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); border-radius: var(--radius-sm);
  padding: 2px 10px; font-size: var(--fs-md); line-height: 1.4; cursor: pointer; }
.tms-back:hover { background: var(--sel); }
.tms-body { padding-top: 12px; }
.tms-sub code, .tms-body code { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.tms-mute { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.tms-note { color: var(--ink-3); font-size: var(--fs-sm); margin: 8px 0; }
.tms-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- 结构图：dm → 数据集 → dc → 算子 → container → 后处理 ---- */
.tms-flowhead, .tms-flow { display: grid; grid-template-columns: 160px 180px 124px minmax(320px, 1fr) 160px 160px; column-gap: 28px; min-width: 1244px; }
.tms-flowhead { color: var(--ink-3); font-size: var(--fs-xs); padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tms-flow { grid-template-rows: repeat(var(--n), auto); row-gap: 6px; }
.tms-dm { grid-column: 1; grid-row: 1 / -1; }
.tms-ct { grid-column: 5; grid-row: 1 / -1; }
.tms-post { grid-column: 6; grid-row: 1 / -1; }
.tms-dm, .tms-ct, .tms-post { display: flex; align-items: center; position: relative; }
.tms-flow.tall .tms-dm, .tms-flow.tall .tms-ct, .tms-flow.tall .tms-post { align-items: flex-start; padding-top: 4px; }
.tms-dm::after, .tms-ct::before { content: ""; position: absolute; top: 14px; bottom: 14px; width: 8px; border: 1.5px solid var(--line-hi); }
.tms-dm::after { right: -15px; border-left: 0; border-radius: 0 6px 6px 0; }
.tms-ct::before { left: -15px; border-right: 0; border-radius: 6px 0 0 6px; }
.tms-post::before { content: ""; position: absolute; left: -28px; width: 28px; top: 50%; border-top: 1.5px solid var(--line-hi); }
.tms-flow.tall .tms-post::before { top: 60px; }
.tms-node { display: grid; gap: 2px; width: 100%; min-width: 0; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); font: inherit; font-size: var(--fs-sm); }
.tms-node small { color: var(--ink-3); font-size: var(--fs-xs); }
.tms-node.tms-link { cursor: pointer; transition: border-color var(--t), background var(--t); }
.tms-node.tms-link:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.tms-nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-body code.tms-id { display: block; padding: 0; background: none; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-ds, .tms-flow > .tms-dcc, .tms-ops { position: relative; align-self: center; }
.tms-ds { grid-column: 2; padding: 4px 0; min-width: 0; font-size: var(--fs-sm); }
.tms-ds b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-ds::before, .tms-flow > .tms-dcc::before, .tms-ops::before, .tms-ops::after { content: ""; position: absolute; top: 50%; border-top: 1.5px solid var(--line-hi); }
.tms-ds::before { left: -15px; width: 12px; }
/* dc 格：dc chip 和它的质检状态（.pill），放不下时 pill 折到下一行 */
.tms-flow > .tms-dcc { grid-column: 3; justify-self: start; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.tms-flow > .tms-dcc::before { left: -28px; width: 26px; }
/* 算子竖着排，一行一个；min-width: 0 让这一列守住自己的格，长 chip 在格内换行而不是压到 container 上 */
.tms-ops { grid-column: 4; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tms-ops .tms-arrow { padding: 0 0 0 12px; font-size: 0.7rem; line-height: 1; }
.tms-ops::before { left: -28px; width: 26px; }
.tms-ops::after { right: -15px; width: 14px; }
.tms-split { display: flex; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tms-split span + span::before { content: "·"; margin: 0 6px; color: var(--line-hi); }
.tms-split .tms-tr { color: var(--ink-2); }
.tms-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--panel); color: var(--ink); font: 400 var(--fs-xs)/1.6 var(--font-mono); white-space: nowrap; }
button.tms-chip { cursor: pointer; transition: border-color var(--t), color var(--t), background var(--t); }
button.tms-chip:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.tms-ver { color: var(--ink-3); margin-left: -4px; }
.tms-chip.tms-ghost { border-style: dashed; color: var(--ink-3); font-family: var(--font-sans); }
.tms-chip.tms-mini { font-size: var(--fs-xs); padding: 1px 7px; }
.tms-stage { font-family: var(--font-sans); color: var(--ink-3); border-right: 1px solid var(--line); padding-right: 6px; }
.tms-chip.tms-op { max-width: 100%; }
/* 数据集之间的分割线：跨 数据集 · dc · 算子 三列 */
.tms-sep { grid-column: 2 / 5; border-top: 1px solid var(--line-soft); align-self: center; }
.tms-arrow { color: var(--ink-3); padding: 0 2px; }
.tms-pipe { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }

/* ---- dc：源列 → 槽 ---- */
.tms-legend { font-size: var(--fs-xs); color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 6px 0; }
.tms-legend em { font-style: normal; white-space: nowrap; }
.tms-legend i { display: inline-block; width: 18px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--line-hi); background: var(--panel); }
.tms-legend i.op { border: 1.5px dashed var(--accent); }
.tms-legend i.lc { background: var(--sel-hi); border-color: var(--line); }
.tms-legend i.lc.on { background: var(--accent); border-color: var(--accent); }
svg.tms-map { display: block; font: 12px var(--font-mono); }
svg.tms-map .k { fill: var(--panel); stroke: var(--line-hi); }
svg.tms-map .k.op { stroke: var(--accent); stroke-dasharray: 4 3; stroke-width: 1.5; }
svg.tms-map .s { fill: var(--sel); stroke: var(--line); }
svg.tms-map .s.on { fill: var(--panel-deep); stroke: var(--line-hi); }
svg.tms-map .c { fill: var(--sel-hi); stroke: var(--line); stroke-width: 0.6; }
svg.tms-map .c.on { fill: var(--accent); stroke: var(--accent); }
svg.tms-map .c.dim { opacity: 0.55; }
svg.tms-map .kt, svg.tms-map .st, svg.tms-map .lg { fill: var(--ink); }
svg.tms-map .kd, svg.tms-map .ci, svg.tms-map .lgd { fill: var(--ink-3); }
svg.tms-map .kn { fill: var(--ink-2); font-family: var(--font-sans); }
svg.tms-map .opt { fill: var(--accent); }
svg.tms-map .b { font-weight: 600; }
svg.tms-map .sec { fill: var(--ink); font: 600 13px var(--font-sans); }
svg.tms-map .sep { stroke: var(--line); }
svg.tms-map .e { fill: none; stroke: var(--ink-3); stroke-width: 1.2; opacity: 0.55; }
svg.tms-map .el { fill: var(--ink-3); }
svg.tms-map .dl { stroke-width: 2; }
/* 语义段：8 色循环，同名同色 */
svg.tms-map .c.on.s0 { fill: var(--chart-1); stroke: var(--chart-1); } svg.tms-map .dl.s0 { stroke: var(--chart-1); }
svg.tms-map .c.on.s1 { fill: var(--chart-7); stroke: var(--chart-7); } svg.tms-map .dl.s1 { stroke: var(--chart-7); }
svg.tms-map .c.on.s2 { fill: var(--chart-2); stroke: var(--chart-2); } svg.tms-map .dl.s2 { stroke: var(--chart-2); }
svg.tms-map .c.on.s3 { fill: var(--chart-4); stroke: var(--chart-4); } svg.tms-map .dl.s3 { stroke: var(--chart-4); }
svg.tms-map .c.on.s4 { fill: var(--chart-5); stroke: var(--chart-5); } svg.tms-map .dl.s4 { stroke: var(--chart-5); }
svg.tms-map .c.on.s5 { fill: var(--chart-8); stroke: var(--chart-8); } svg.tms-map .dl.s5 { stroke: var(--chart-8); }
svg.tms-map .c.on.s6 { fill: var(--chart-3); stroke: var(--chart-3); } svg.tms-map .dl.s6 { stroke: var(--chart-3); }
svg.tms-map .c.on.s7 { fill: var(--chart-6); stroke: var(--chart-6); } svg.tms-map .dl.s7 { stroke: var(--chart-6); }
.tms-details { margin: 10px 0; }
.tms-details summary { cursor: pointer; color: var(--ink-3); font-size: var(--fs-sm); }
.tms-keys { font: var(--fs-xs)/1.7 var(--font-mono); color: var(--ink-3); overflow-wrap: anywhere; }

/* ---- container：槽 × dc ---- */
.tms-info { background: var(--sel); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 10px; font-size: var(--fs-sm); }
.tms-info b { color: var(--ink-2); }
.tms-info p { margin: 4px 0 0; }
table.tms-occ { border-collapse: collapse; font-size: var(--fs-xs); min-width: 100%; }
table.tms-occ th, table.tms-occ td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: middle; white-space: nowrap; }
table.tms-occ thead th { background: var(--panel-deep); position: sticky; top: 0; }
table.tms-occ tbody th { font-weight: 500; background: var(--panel); position: sticky; left: 0; }
table.tms-occ td.on { background: color-mix(in srgb, var(--accent) 4%, transparent); font: var(--fs-xs) var(--font-mono); }
table.tms-occ code { background: none; padding: 0; color: var(--ink); }
table.tms-occ td.off { color: var(--ink-3); text-align: center; }
table.tms-occ tr.first > * { border-top: 2.5px solid var(--line-hi); }
/* 槽的种类：灰底文字，前面一个小色点区分，不整块上色。 */
.tms-kind { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); border-radius: 4px; padding: 0 6px; margin-right: 4px; font-weight: 500;
  color: var(--ink-2); background: var(--sel); --dot: var(--ink-3); }
.tms-kind::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); }
.tms-kind.k-rgb, .tms-kind.k-depth, .tms-kind.k-seg { --dot: var(--chart-2); }
.tms-kind.k-state { --dot: var(--chart-5); }
.tms-kind.k-action { --dot: var(--chart-7); }
.tms-kind.k-tensor { --dot: var(--chart-6); }
.tms-kind.k-video, .tms-kind.k-text { --dot: var(--chart-3); }
.tms-desc { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 3px; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 400; white-space: normal; max-width: 240px; }
.tms-desc b { font-family: var(--font-mono); }
.tms-bar { display: inline-flex; gap: 1px; vertical-align: middle; margin-right: 6px; }
.tms-bar i { display: block; width: 5px; flex: none; height: 12px; background: var(--sel-hi); border-radius: 1px; }
.tms-bar i.gap { margin-left: 4px; }
.tms-bar i.on { background: var(--accent); }
.tms-bar i.on.s0 { background: var(--chart-1); } .tms-bar i.on.s1 { background: var(--chart-7); }
.tms-bar i.on.s2 { background: var(--chart-2); } .tms-bar i.on.s3 { background: var(--chart-4); }
.tms-bar i.on.s4 { background: var(--chart-5); } .tms-bar i.on.s5 { background: var(--chart-8); }
.tms-bar i.on.s6 { background: var(--chart-3); } .tms-bar i.on.s7 { background: var(--chart-6); }

/* ---- 后处理 ---- */
pre.tms-spec { white-space: pre; overflow-x: auto; background: var(--code-bg); border-radius: var(--radius); padding: 10px 12px; font: var(--fs-xs)/1.6 var(--font-mono); margin: 0 0 10px; }
table.tms-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.tms-table th, table.tms-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tms-table th { color: var(--ink-3); font-weight: 500; }

/* ---- 「训练清单」页 ---- */
.tml-unit.pair { border-left: 2px solid var(--line-hi); padding: 2px 0 2px 12px; }
.tml-unit .tag { margin-bottom: 6px; }
.tml-halves { display: flex; gap: 18px; flex-wrap: wrap; }
.tml-half { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tml-hh { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tml-hh strong { overflow-wrap: anywhere; }
.tml-meta { font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; }
.tml-btns { display: flex; gap: 6px; flex-wrap: wrap; }
#tm-list-table td { vertical-align: top; }

/* ---- 「训练清单」页：删除 ---- */
#tm-list-table .tml-ops { width: 64px; text-align: right; }
#tm-list-table .mx-pick { padding-top: 13px; }   /* on the row's first line: its cells align to the top */
.tml-hh .tag.tml-ref { color: var(--fail); background: transparent; box-shadow: inset 0 0 0 1px var(--fail-line); }
.tml-reason { margin-top: 6px; font-size: var(--fs-xs); color: var(--ink-3); }
/* 创建人 / 调试 filters; a tm being debugged and a quick edit's tag; the debug notice on the structure page */
.tml-filters { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.tml-filter { display: inline-flex; align-items: center; gap: 6px; }
.tml-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tml-seg label { position: relative; cursor: pointer; }
.tml-seg label + label { border-left: 1px solid var(--line); }
.tml-seg input { position: absolute; opacity: 0; pointer-events: none; }
.tml-seg span { display: block; padding: 3px 10px; font-size: var(--fs-xs); }
.tml-seg input:checked + span { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tml-seg input:focus-visible + span { outline: 2px solid var(--accent-line); outline-offset: -2px; }
.tml-half.tml-debug { border-left: 3px solid var(--warn-line); padding-left: 8px; }
.tml-hh .tag.tml-dbg { color: var(--warn); background: var(--warn-soft); cursor: help; }
.tml-hh .tag.tml-edit { color: var(--accent); background: var(--accent-soft); cursor: help; }
.tms-edit-from { margin: 0 0 10px; font-size: var(--fs-xs); overflow-wrap: anywhere; }
.tm-debug-notice { margin: 8px 0; padding: 8px 10px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); }
.tml-reason b { color: var(--ink-2); font-weight: 600; }
.tml-dm-name { color: var(--ink); overflow-wrap: anywhere; }
/* 两头的框同一个样子：同宽（列宽）、同高，四行对齐。 */
.tms-node.tms-hub { min-height: 112px; align-content: start; gap: 3px; }
.tms-hub small { margin-bottom: 2px; }
.tms-hub .tms-mute { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-hub-sub { color: var(--ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-ops { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 4px; }
