/* ============================================================
   Matrix 2.0 WebUI components (data-reviewer-ui-style, restrained preset)
   Tokens live in tokens.css; this file only references tokens.
   ============================================================ */

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Global type scale: every font size is rem-based, so this one value sizes the whole UI (107.5% of 16px; 13px body text renders at ~14px). */
html { font-size: 107.5%; overflow-y: scroll; }   /* always keep the (transparent) scrollbar track, so a short page is as wide as a long one */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 0.8125rem/1.5 var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
/* The parts the browser draws take the palette too. */
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
input, textarea { caret-color: var(--accent); }
td, th { font-variant-numeric: tabular-nums; }
a:hover { color: var(--accent-hi); text-decoration: underline; }
code, kbd, pre, .mono { font-family: var(--font-mono); }
button { font-family: inherit; }
strong, b { font-weight: 600; }

:focus-visible { outline: none; box-shadow: var(--ring); }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-hi); }

/* ---------- shell: header + tabs ---------- */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}
.header-right { display: flex; align-items: stretch; gap: 16px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}
.brand-mark {
  width: 20px; height: 20px;
  border-radius: 5px;
  background: var(--primary-bg);
  color: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark .ic { width: 13px; height: 13px; }
.brand-title { color: var(--ink); font-weight: 600; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--sel);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 0 7px;
  line-height: 1.125rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge-gemini { background: var(--pass-soft); color: var(--pass); }

nav { display: flex; gap: 2px; align-items: stretch; }
.nav-btn {
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 9px 0;
  border-radius: 8px;
  transition: background var(--t);
}
.nav-btn:hover { background: var(--sel); }
.nav-btn.active { background: var(--sel-hi); font-weight: 600; }
.header-tools { display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--ink);
}
.user-chip #global-user-name { color: var(--ink); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.theme-selector {
  display: flex;
  align-items: center;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.theme-btn {
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background var(--t), color var(--t);
}
.theme-btn:hover { color: var(--ink); }
.theme-btn.active { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

main {
  flex: 1;
  padding: 16px 20px 32px;
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}
.section { display: none; }
.section.active { display: block; }

/* ---------- icons (inline sprite in index.html) ---------- */
.ic {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: -2px;
}
.ic-16 { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- page head + panels ---------- */
.panel-head {
  padding: 4px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 46px;
}
.panel-head-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.panel-head-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-title { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.panel-sub { font-size: var(--fs-xs); color: var(--ink); font-weight: 400; }
.panel-title, .mx-dialog-title, .brand-title, .stat-value, h1, h2, h3 {
  font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.005em; }
.count-pill {
  font-size: var(--fs-xs);
  color: var(--ink);
  background: var(--sel);
  padding: 0 8px;
  line-height: 1.25rem;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.pager {
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: var(--fs-xs);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.pager-controls { display: flex; align-items: center; gap: 4px; }
.pager-current { color: var(--ink); font-weight: 500; padding: 0 6px; }

/* ---------- stat strip (frameless) ---------- */
.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 0;
  margin: 4px 0 16px;
}
.stat-card {
  border-left: 1px solid var(--line);
  padding: 0 28px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 160px;
}
.stat-card:first-child { border-left: 0; padding-left: 0; }
.stat-label { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }
.stat-value {
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-meta { font-size: var(--fs-xs); color: var(--ink); }

/* ---------- inputs ---------- */
.input-box, .filter-select, .filter-input, .input-control {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  min-height: 30px;
  color: var(--ink);
  font: 0.8125rem/1.4 var(--font-sans);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.input-box:hover, .filter-select:hover, .filter-input:hover, .input-control:hover { border-color: var(--line-hi); }
.input-box:focus, .filter-select:focus, .filter-input:focus, .input-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-box::placeholder, .filter-input::placeholder, .input-control::placeholder { color: var(--ink-3); }
select.input-box option, select.filter-select option, select.input-control option { background: var(--panel); color: var(--ink); }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-group label { font-size: var(--fs-xs); color: var(--ink); font-weight: 500; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 5px 12px;
  min-height: 30px;
  font: 500 0.8125rem/1.3 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid transparent;
  background: var(--primary-bg);
  color: var(--on-primary);
  transition: background var(--t), border-color var(--t), color var(--t);
}
.btn:hover { background: var(--primary-bg-hi); text-decoration: none; }
.btn:active { transition-duration: var(--t-fast); }
.btn[disabled], .btn:disabled, .btn-action[disabled], .btn-action:disabled { opacity: .45; cursor: not-allowed; }

.btn.primary, .btn-primary {
  background: var(--primary-bg) !important;
  color: var(--on-primary) !important;
  border-color: transparent !important;
}
.btn.primary:hover, .btn-primary:hover { background: var(--primary-bg-hi) !important; }
.btn.secondary, .btn-secondary {
  background: var(--sel) !important;
  color: var(--ink) !important;
  border: 1px solid transparent !important;
  cursor: pointer;
}
.btn.secondary:hover, .btn-secondary:hover { background: var(--sel-hi) !important; }
.btn.ghost, .btn-ghost {
  background: transparent !important;
  color: var(--ink-2) !important;
  border-color: transparent !important;
}
.btn.ghost:hover, .btn-ghost:hover { background: var(--sel) !important; color: var(--ink) !important; }
.btn.danger, .btn-danger {
  background: transparent !important;
  color: var(--fail) !important;
  border-color: var(--fail-line) !important;
}
.btn.danger:hover, .btn-danger:hover { background: var(--fail-soft) !important; }
.btn.fab, .btn-fab {
  background: var(--primary-bg) !important;
  color: var(--on-primary) !important;
  border-radius: var(--radius-pill) !important;
  box-shadow: var(--shadow-overlay) !important;
}
.btn-sm, .pager .btn { padding: 2px 8px !important; min-height: 26px; font-size: var(--fs-xs) !important; }

.btn-action {
  background: var(--sel);
  color: var(--ink);
  border: 1px solid transparent;
  padding: 2px 9px;
  min-height: 26px;
  font: 500 0.75rem/1.3 var(--font-sans);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--t), background var(--t);
}
.btn-action:hover { background: var(--sel-hi); text-decoration: none; }

/* The × that closes a window or a drawer: a solid square in the ink colour, so it reads as a button. */
.mx-x {
  flex: none;
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ink); border-radius: 8px;
  background: var(--panel); color: var(--ink);
  cursor: pointer;
}
.mx-x .ic { width: 18px; height: 18px; stroke-width: 2.75; vertical-align: 0; }
.mx-x:hover, .mx-x:focus-visible { background: var(--ink); color: var(--panel); }
.mx-x-corner { position: absolute; top: 12px; right: 12px; z-index: 10; }

/* ---------- tables ---------- */
.table-container {
  background: transparent;
  overflow: hidden;
  margin-bottom: 24px;
}
/* The page is the only vertical scroller: a table grows to its full height. A narrow screen
   scrolls a wide table sideways inside its wrapper; a wide one needs no wrapper scrolling, so the
   wrapper lets go of overflow there and the header row sticks under the page header instead. */
.table-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  position: relative;
}
@media (min-width: 1100px) {
  #section-dashboard .table-container, #section-manifests .table-container,
  #section-dashboard .table-scroll-wrapper, #section-manifests .table-scroll-wrapper { overflow: visible; }
  .table-container #top-datasets-table thead th, .table-container #manifests-table thead th { top: 48px; }
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  text-align: left;
}
th {
  background: var(--bg);
  padding: 7px 10px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-hi);
  white-space: nowrap;
}
td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--wash); }
td.num, th.num { text-align: right; white-space: nowrap; }

/* 数据清单「采样规模与配比」: one line per group. A folded cell shows the first three lines, each cut
   to one line, and a「…」button (index.html, MANIFEST_SCALE_LINES = 3) that opens a window with a table of all of them. */
.mx-scale { max-width: 220px; font-size: var(--fs-xs); color: var(--text-muted); }
.mx-scale.is-folded { width: 220px; }
.mx-scale-line { overflow-wrap: break-word; }
.mx-scale.is-folded .mx-scale-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-scale-toggle {
  margin-top: 2px;
  padding: 0 8px;
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  line-height: 1.4;
  cursor: pointer;
}
.mx-scale-toggle:hover { border-color: var(--ink-2); }
.mx-scale-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mx-scale-table th, .mx-scale-table td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line-soft, var(--line)); text-align: left; vertical-align: top; }
.mx-scale-table th { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.mx-scale-table .num { text-align: right; white-space: nowrap; }
.mx-scale-table .mx-scale-name { overflow-wrap: break-word; color: var(--ink); }
.mx-scale-table tbody tr:hover { background: none; }

/* 数据名称: past MANIFEST_NAME_CHARS the rest hides behind a「…」button. */
.mx-name:not(.is-open) .mx-name-rest { display: none; }
.mx-name { overflow-wrap: anywhere; }
.mx-name-toggle { margin: 0 0 0 4px; font-weight: 400; font-size: var(--fs-xs); vertical-align: 1px; }

/* Click to copy (index.html: [data-copy] / [data-copy-from]). */
.mx-copy, [data-copy], [data-copy-from] { cursor: pointer; }
#mx-copy-tip {
  position: fixed; left: 0; top: 0; z-index: calc(var(--z-toast) + 1); pointer-events: none;
  padding: 3px 8px; border-radius: 5px; background: var(--ink); color: var(--panel);
  font-size: var(--fs-xs); line-height: 1.4; white-space: nowrap; box-shadow: var(--shadow);
}
#mx-copy-tip[hidden] { display: none; }
.mx-copy:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.mx-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

#top-datasets-table thead th,
#manifests-table thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--panel-deep);
  box-shadow: 0 1px 0 var(--line);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
  background: var(--sel);
  color: var(--ink);
}
.tag-fd { background: var(--sel); color: var(--ink); }
.tag-video { background: var(--accent-soft); color: var(--accent); }
.tag-rd { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.tag-views { background: var(--panel-deep); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-soft); }

/* ---------- chips / status pills ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1.25rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  white-space: nowrap;
}
.chip.filled { background: var(--sel); border-color: transparent; color: var(--ink); }
.chip.mono { font-family: var(--font-mono); font-weight: 400; }
.chip.ok { color: var(--pass); background: var(--pass-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.err { color: var(--fail); background: var(--fail-soft); border-color: transparent; }
.chip.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: var(--radius-pill);
        font-size: var(--fs-xs); line-height: 1.25rem; color: var(--ink); font-weight: 500; white-space: nowrap; }
.pill::before { font-weight: 600; }
.pill.pass { background: var(--pass-soft); color: var(--pass); }
.pill.pass::before { content: "✓"; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.warn::before { content: "!"; }
.pill.fail { background: var(--fail-soft); color: var(--fail); }
.pill.fail::before { content: "✕"; }
.pill.none { background: var(--sel); color: var(--ink-3); }
.pill.none::before { content: "·"; }

.stripe { position: relative; }
.stripe::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px;
                  background: var(--stripe, var(--ink-3)); }
.stripe.pass { --stripe: color-mix(in srgb, var(--pass) 45%, transparent); }
.stripe.fail { --stripe: var(--fail); }
.stripe.warn { --stripe: var(--warn); }

/* ---------- loading / empty / error ---------- */
.skeleton-shimmer, .skel {
  display: block;
  height: 14px;
  background: var(--sel-hi);
  border-radius: 4px;
  animation: ui-pulse 1.2s ease-in-out infinite;
}
.skel-rows { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.skel-rows > i { display: block; height: 22px; border-radius: 5px; background: var(--sel);
                 animation: ui-pulse 1.2s ease-in-out infinite; }
td.skel-cell { padding: 0; }
@keyframes ui-pulse { 50% { opacity: .5; } }

.msg {
  border: 1px dashed var(--line-hi);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px;
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
}
.msg a, .msg button.link { color: var(--accent); }
.msg.error { border-style: solid; border-color: var(--fail-line); background: var(--fail-soft); color: var(--fail); }
button.link { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--accent); }
button.link:hover { text-decoration: underline; }

.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-label { font-size: var(--fs-xs); font-weight: 500; color: var(--ink); display: block; margin-bottom: 4px; }
.seg-tabs { display: flex; gap: 2px; align-items: stretch; align-self: stretch; margin: -8px 0; }
.seg-tabs .nav-btn { min-height: 46px; padding: 0 10px; }

/* ---------- KaTeX ---------- */
.katex-display { margin: 8px 0 !important; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex { font-size: 1.05em !important; color: inherit; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-overlay);
}
.modal-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
#manifest-modal, #recipe-builder-modal { background: var(--scrim) !important; backdrop-filter: none !important; }
#manifest-modal > div, #recipe-builder-modal > div {
  border-radius: 10px !important;
  box-shadow: var(--shadow-overlay) !important;
}

/* ---------- expert FAB + drawer ---------- */
.expert-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary-bg);
  color: var(--on-primary);
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: var(--fs-sm);
  cursor: grab;
  box-shadow: var(--shadow-overlay);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: var(--z-fab);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: background var(--t);
}
.expert-fab:hover { background: var(--primary-bg-hi); }
.expert-fab:active, .expert-fab.dragging { cursor: grabbing !important; }
.expert-fab.dragging { transition: none !important; opacity: .92; }
.fab-drag-handle { opacity: .5; font-size: var(--fs-xs); margin-right: -2px; cursor: grab; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pass); }

.expert-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 92vw;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-overlay);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 24px));
  visibility: hidden;
  transition: transform 120ms ease-in, visibility 0s linear 120ms;
}
.expert-drawer.open {
  transform: none;
  visibility: visible;
  transition: transform var(--t-layer) cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
.expert-header {
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
}
.expert-header .btn-secondary { padding: 2px 8px; min-height: 26px; font-size: var(--fs-xs); }
.expert-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel-deep);
}
.expert-msg {
  max-width: 92%;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.6;
  word-break: break-word;
}
.expert-msg.user {
  align-self: flex-end;
  background: var(--sel-hi);
  color: var(--ink);
}
.expert-msg.agent {
  align-self: flex-start;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}
.expert-msg h1, .expert-msg h2, .expert-msg h3, .expert-msg h4 {
  color: var(--ink);
  margin: 12px 0 6px;
  font-weight: 600;
  line-height: 1.35;
}
.expert-msg h1:first-child, .expert-msg h2:first-child, .expert-msg h3:first-child { margin-top: 0; }
.expert-msg h1 { font-size: var(--fs-md); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.expert-msg h2 { font-size: var(--fs-sm); }
.expert-msg h3, .expert-msg h4 { font-size: var(--fs-sm); }
.expert-msg p { margin: 6px 0; }
.expert-msg ul, .expert-msg ol { margin: 6px 0 6px 20px; padding-left: 0; }
.expert-msg li { margin-bottom: 3px; }
.expert-msg table {
  width: 100%;
  margin: 10px 0;
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  background: var(--panel);
}
.expert-msg th { background: var(--panel-deep); color: var(--ink); padding: 5px 8px; font-size: var(--fs-xs); }
.expert-msg td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-xs); }
.expert-msg tr:last-child td { border-bottom: 0; }
.expert-msg blockquote {
  border-left: 3px solid var(--line-hi);
  padding: 4px 10px;
  margin: 8px 0;
  color: var(--ink);
}
.expert-msg code {
  background: var(--code-bg);
  color: var(--ink);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: .88em;
}
.expert-msg pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.expert-msg pre code { background: transparent; padding: 0; font-size: var(--fs-xs); }
.expert-msg hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.expert-tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sel);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  margin: 4px 0;
}
.expert-feedback-bar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.expert-fb-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 1px 8px;
  min-height: 24px;
  font-size: var(--fs-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color var(--t), color var(--t);
}
.expert-fb-btn:hover { border-color: var(--line-hi); color: var(--ink); }
.expert-fb-btn.liked { background: var(--pass-soft); border-color: transparent; color: var(--pass); }

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--t);
}
.session-item:hover { background: var(--sel); }
.session-item.active { background: var(--sel-hi); box-shadow: inset 3px 0 0 var(--accent); }
.session-title {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-meta { font-size: var(--fs-xs); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

.expert-chip-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px 0;
  scrollbar-width: none;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.expert-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color var(--t), color var(--t);
}
.expert-chip:hover { color: var(--ink); border-color: var(--line-hi); }
.expert-input-area {
  padding: 10px 14px 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- recipe builder: containers ---------- */
.rb-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.rb-inner-card {
  background: var(--panel-deep);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 10px;
}
.rb-diagram-box {
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.rb-notice-box {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  font-size: var(--fs-xs);
  color: var(--ink);
  line-height: 1.5;
}
.rb-title-blue, .rb-title-green, .rb-title-amber, .rb-title-purple { color: var(--ink); font-weight: 600; }

.rb-mixed-limits-banner {
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
}
.rb-mixed-limits-title { color: var(--warn); font-weight: 600; font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.rb-mixed-limits-badge {
  background: var(--warn);
  color: var(--on-warn) !important;
  font-weight: 500;
  font-size: var(--fs-xs);
  padding: 0 7px;
  border-radius: 4px;
}
.rb-mixed-limits-recom { font-size: var(--fs-xs); color: var(--ink); }
.rb-mixed-limits-recom strong { color: var(--warn); font-weight: 600; font-variant-numeric: tabular-nums; }
.rb-mixed-limits-desc { font-size: var(--fs-xs); color: var(--ink); margin-top: 6px; line-height: 1.55; }
.rb-mixed-limits-desc strong { color: var(--ink); font-weight: 600; }
.rb-mixed-limits-table { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--warn-line); }
.rb-mixed-limits-header {
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink); margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.rb-mixed-limits-sub { font-size: var(--fs-xs); color: var(--ink); font-weight: 400; }
.rb-emb-limit-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rb-emb-limit-name { font-weight: 600; font-size: var(--fs-xs); color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rb-emb-limit-count { font-size: var(--fs-xs); color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.rb-emb-limit-label { font-size: var(--fs-xs); color: var(--ink); margin-bottom: 2px; font-weight: 500; }
.rb-tag-limit-multi, .rb-tag-limit-single {
  display: inline-block;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}
.rb-tag-limit-multi { color: var(--warn); background: var(--warn-soft); }
.rb-tag-limit-single { color: var(--ink); background: var(--sel); }


.rb-subpanel-box {
  margin-top: 6px;
  padding: 8px;
  background: var(--panel-deep);
  border-radius: 6px;
  border: 1px dashed var(--line);
}

.badge-cam-available, .badge-cam-missing {
  font-size: var(--fs-xs); padding: 0 5px; border-radius: 3px; font-weight: 500; line-height: 1rem;
}
.badge-cam-available { background: var(--pass-soft); color: var(--pass); }
.badge-cam-missing { background: var(--warn-soft); color: var(--warn); }
.rb-cam-missing { opacity: .75; border: 1px dashed var(--warn-line) !important; }

/* ---------- loader pipeline stepper ---------- */
.post-stepper-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin-bottom: 12px;
  overflow-x: auto;
  gap: 6px;
}
.post-step-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 4px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}
.post-step-node.active { color: var(--ink); border-color: var(--accent-line); }
.post-step-node-idx {
  background: var(--sel-hi);
  color: var(--ink);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.post-step-node.active .post-step-node-idx { background: var(--accent); color: var(--on-accent); }
.post-step-line { flex: 1; height: 1px; min-width: 14px; background: var(--line-hi); }

.post-stage-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: var(--fs-xs);
  color: var(--ink);
  min-width: 0;
  transition: border-color var(--t);
}
.post-stage-card:hover { border-color: var(--line-hi); }
.post-stage-card.wide { padding: 12px 14px; }
.post-stage-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
}
.post-stage-header-title { display: flex; align-items: center; gap: 6px; }
.post-stage-pill {
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--sel);
  color: var(--ink);
}

/* ---------- action tape ---------- */
.rb-action-tape {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  overflow-x: auto;
}
.rb-mask-track { display: flex; gap: 3px; align-items: center; width: 100%; font-size: var(--fs-xs); }
.rb-mask-bit { display: flex; align-items: center; justify-content: center; height: 16px; border-radius: 2px; font-weight: 600; }
.rb-mask-bit.bit-1 { background: var(--pass-soft); color: var(--pass); }
.rb-mask-bit.bit-0 { background: transparent; color: var(--ink-3); border: 1px dashed var(--line); }
.tensor-alias-code {
  display: inline-block;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--sel);
  padding: 0 4px;
  border-radius: 3px;
  margin-top: 2px;
}

.post-stages-h-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  scrollbar-width: thin;
}

.post-cam-table { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: var(--fs-xs); margin-top: 6px; }
.post-cam-row {
  display: grid;
  grid-template-columns: minmax(95px, 1.4fr) repeat(4, minmax(52px, 1fr));
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
  gap: 4px;
}
.post-cam-row:last-child { border-bottom: 0; }
.post-cam-header { background: var(--panel-deep); font-weight: 500; color: var(--ink); text-align: center; border-bottom: 1px solid var(--line); }
.post-cell-view { text-align: left; font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-cell-mod { text-align: center; display: flex; justify-content: center; align-items: center; }
.post-badge-mod {
  font-size: var(--fs-xs); font-weight: 500; border-radius: 3px; padding: 0 4px;
  display: inline-block; min-width: 38px; text-align: center;
}
.post-badge-rgb, .post-badge-depth, .post-badge-seg, .post-badge-robotseg { background: var(--sel); color: var(--ink); }
.post-badge-empty { color: var(--ink-3); font-size: var(--fs-xs); }

.post-stage-svg-wrap {
  width: 100%;
  margin: 6px 0 8px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-deep);
}
.post-stage-svg { display: block; width: 100%; height: auto; }
/* Diagram loops removed: motion must express a state change, not decoration. */
.svg-anim-ray { stroke-dasharray: 6 4; }
.svg-anim-pulse, .svg-anim-stream { animation: none; }

.post-pill-group { display: flex; gap: 4px; margin-bottom: 6px; overflow-x: auto; padding-bottom: 2px; }
.post-pill-btn {
  padding: 1px 8px;
  min-height: 24px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.post-pill-btn:hover { border-color: var(--line-hi); color: var(--ink); }
.post-pill-btn.active { background: var(--sel-hi); border-color: var(--line-hi); color: var(--ink); }
.op-status-on { background: var(--pass-soft) !important; color: var(--pass) !important; border: 1px solid transparent !important; font-weight: 500; }
.op-status-off { background: var(--sel) !important; color: var(--ink-3) !important; border: 1px solid transparent !important; font-weight: 500; }

.tensor-inspector-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); margin-top: 4px; line-height: 1.35; }
.tensor-inspector-table th { background: var(--panel-deep); color: var(--ink); font-weight: 500; padding: 3px 6px; font-size: var(--fs-xs); }
.tensor-inspector-table td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-xs); }
.tensor-inspector-table tr:hover { background: var(--wash); }
.tensor-dim-pill {
  display: inline-block; padding: 0 4px; border-radius: 3px; font-size: var(--fs-xs);
  background: var(--sel); color: var(--ink); margin-right: 2px; font-variant-numeric: tabular-nums;
}
.tensor-key-code { font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-xs); }

/* ---------- pipeline stage stepper ---------- */
.stage-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 500;
  padding: 1px 10px 1px 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.stage-item i {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--sel-hi); color: var(--ink-2);
  font-style: normal; font-size: var(--fs-xs);
  display: inline-flex; align-items: center; justify-content: center;
}
.stage-item.active { border-color: var(--accent-line); color: var(--ink); }
.stage-item.active i { background: var(--accent); color: var(--on-accent); }

.cam-box-anchor { border-color: var(--accent) !important; box-shadow: inset 3px 0 0 var(--accent) !important; }

/* ---------- recipe builder wizard ---------- */
.rb-wizard-nav {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 0 8px;
  margin-bottom: 14px;
  gap: 4px;
  overflow-x: auto;
}
.rb-wizard-step-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  flex: 1;
  min-width: 160px;
  transition: background var(--t);
}
.rb-wizard-step-btn:hover { background: var(--sel); }
.rb-wizard-step-btn.active { background: var(--sel-hi); }
.rb-step-badge {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: var(--fs-xs); flex-shrink: 0;
  border: 1px solid var(--line-hi);
  font-variant-numeric: tabular-nums;
}
.rb-wizard-step-btn.active .rb-step-badge { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.rb-wizard-step-btn.completed .rb-step-badge { background: var(--pass-soft); color: var(--pass); border-color: transparent; }
.rb-step-text { display: flex; flex-direction: column; min-width: 0; }
.rb-step-title { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.rb-wizard-divider { width: 12px; height: 1px; background: var(--line); flex-shrink: 0; }

.rb-preset-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rb-preset-pill {
  padding: 4px 12px;
  min-height: 30px;
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
  transition: border-color var(--t), background var(--t);
}
.rb-preset-pill:hover { border-color: var(--line-hi); }
.rb-preset-pill.active { background: var(--sel-hi); border-color: var(--line-hi); box-shadow: inset 0 -2px 0 var(--accent); }

.rb-card .input-box, .rb-inner-card .input-box {
  min-height: 30px;
  padding: 4px 10px !important;
  font-size: var(--fs-sm);
  border-radius: 6px;
}


.rb-cam-item {
  margin-bottom: 0;
  padding: 10px 12px !important;
  background: var(--panel) !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--line) !important;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color var(--t);
}
.rb-cam-item:hover { border-color: var(--line-hi) !important; }
.rb-cam-item.active { border-color: var(--line-hi) !important; box-shadow: inset 3px 0 0 var(--accent); }

.rb-mods-grid { display: flex !important; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rb-mod-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 8px;
  min-height: 24px;
  border-radius: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--t), color var(--t);
}
.rb-mod-pill:hover { border-color: var(--line-hi); color: var(--ink); }
.rb-mod-pill input[type="checkbox"] { margin: 0; cursor: pointer; width: 13px; height: 13px; accent-color: var(--accent); }
.rb-mod-pill:has(input[type="checkbox"]:checked) { background: var(--sel); color: var(--ink); border-color: var(--line-hi); }


.rb-ops-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.rb-op-card { padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); transition: border-color var(--t); }
.rb-op-card:hover { border-color: var(--line-hi); }

/* ---------- in-page confirm / prompt (mxDialog) ---------- */
.mx-dialog-backdrop {
  position: fixed; inset: 0; z-index: var(--z-dialog); background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.mx-dialog {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-overlay);
  width: min(460px, 100%); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px;
}
.mx-dialog-title { margin: 0; font-size: var(--fs-md); }
.mx-dialog-message { white-space: pre-wrap; font-size: var(--fs-sm); line-height: 1.55; color: var(--ink); }
.mx-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.mx-dialog-input { width: 100%; }
/* mxModal: a wider window that only shows something; its body scrolls, the page under it does not move. */
.mx-modal { width: min(640px, 100%); max-height: calc(100vh - 32px); }
.mx-modal-wide { width: min(1040px, 100%); }
.mx-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mx-modal-head .mx-dialog-title { overflow-wrap: anywhere; }
.mx-modal-sub { margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-3); }
.mx-modal-body { overflow: auto; min-height: 0; }
.dm-edit { display: grid; gap: 8px; }
.dm-edit[hidden] { display: none; }
.dm-edit textarea, .dm-edit input[type="text"] { width: 100%; font-family: var(--font-mono); }
/* dm 增删: left = the new dm (原有 plain, 新加 green), right = the catalog. Each list scrolls on its own. */
.dm-edit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.dm-edit-col { display: grid; gap: 6px; min-width: 0; align-content: start; }
.dm-edit-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); }
.dm-edit-col input[type="search"] { width: 100%; }
.dm-edit-head-end { display: inline-flex; align-items: center; gap: 8px; }
/* 撤销 stands out while there is a click to take back, and drops to a plain outline when there is none. */
.dm-edit-undo { gap: 4px; font-weight: 600; border: 1.5px solid var(--accent) !important; color: var(--accent) !important; background: var(--accent-soft) !important; }
.dm-edit-undo .ic { stroke-width: 2.5; }
.dm-edit-undo:hover:not(:disabled) { background: var(--accent) !important; color: var(--panel) !important; }
.dm-edit-undo:disabled { opacity: 1; border-color: var(--line) !important; color: var(--ink-3) !important; background: transparent !important; }
.dm-edit-list {
  height: min(360px, 42vh); overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.dm-edit-row {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px;
  border-left: 3px solid transparent; font-family: var(--font-mono); font-size: var(--fs-sm);
}
.dm-edit-row .tm-muted { flex: none; max-width: 45%; text-align: right; font-size: var(--fs-xs); }
.dm-edit-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dm-edit-row.is-new { background: var(--pass-soft); border-left-color: var(--pass); }
.dm-edit-tag { flex: none; font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 600; color: var(--pass); }
.dm-edit-row.is-blocked { color: var(--ink-3); }
.dm-edit-empty { padding: 8px; }
.dm-edit-btn {
  flex: none; width: 24px; height: 24px; padding: 0; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 1rem/1 var(--font-sans); border: 1.5px solid currentColor; background: var(--panel);
}
.dm-edit-btn .ic { width: 14px; height: 14px; stroke-width: 3; vertical-align: 0; }
.dm-edit-btn.is-remove { color: var(--fail); }
.dm-edit-btn.is-add { color: var(--pass); }
.dm-edit-btn.is-remove:hover { background: var(--fail); color: var(--panel); }
.dm-edit-btn.is-add:hover:not(:disabled) { background: var(--pass); color: var(--panel); }
.dm-edit-btn:disabled { color: var(--line-hi); cursor: not-allowed; }
.dm-edit-note { white-space: pre-wrap; font-size: var(--fs-sm); color: var(--fail); }
.dm-edit-note[hidden] { display: none; }
.dm-edit-video { font-size: var(--fs-sm); color: var(--ink-2); border-left: 2px solid var(--accent-line); padding-left: 8px; }
.dm-edit-review-sum { border-collapse: collapse; font-size: var(--fs-sm); width: auto; }
.dm-edit-review-sum th, .dm-edit-review-sum td { padding: 4px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.dm-edit-review-sum th:first-child, .dm-edit-review-sum td:first-child { text-align: left; }
.dm-edit-review-sum tr:last-child td { font-weight: 600; border-bottom: 0; }
.dm-edit-review-list { list-style: none; margin: 0; padding: 4px; max-height: 30vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.dm-edit-review-list li { display: flex; gap: 8px; padding: 3px 6px; font-family: var(--font-mono); font-size: var(--fs-sm); border-left: 3px solid transparent; }
.dm-edit-review-list.is-new li { border-left-color: var(--pass); color: var(--pass); }
.dm-edit-review-list.is-gone li { border-left-color: var(--fail); color: var(--fail); }
@media (max-width: 720px) {
  .dm-edit-cols { grid-template-columns: 1fr; }
  .dm-edit-list { height: min(300px, 36vh); }
}
.mx-modal-body .mx-scale-table th { position: sticky; top: 0; background: var(--panel); }

/* ---------- toast ---------- */
/* Below the header, so a toast never covers the controls in it (任务, the user chip). */
#global-toast-container { z-index: var(--z-toast) !important; top: 60px !important; }
.toast-item {
  box-shadow: var(--shadow-overlay) !important;
  animation: toast-in var(--t-layer);
  transition: opacity 120ms ease-in, transform 120ms ease-in;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toastFadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

/* ---------- 数据总表 dataset filters: chip rows (multi-select, instant apply) ---------- */
.dash-filter-toolbar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}
.dash-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 30px;
}
.dash-filter-row + .dash-filter-row { border-top: 1px solid var(--line-soft); }
.dash-filter-grid { display: flex; flex-direction: column; gap: 2px; }
.dash-filter-grid[hidden] { display: none; }
/* Wide screens: rows flow into two columns so the table stays above the fold. */
@media (min-width: 1200px) {
  .dash-filter-toolbar:not(:has(.dash-filter-grid)),
  .dash-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 28px;
  }
  .dash-filter-toolbar:not(:has(.dash-filter-grid)) .dash-filter-row:nth-child(2),
  .dash-filter-grid .dash-filter-row:nth-child(2) { border-top: 0; }
}
/* The search row under the chip rows, across both columns. */
.dash-filter-search { align-items: center; border-top: 1px solid var(--line-soft); padding: 4px 0 2px; }
.dash-filter-grid[hidden] + .dash-filter-search { border-top: 0; }
.dash-filter-search .dash-filter-label { padding-top: 0; }
.dash-filter-search .input-box { flex: 1 1 auto; max-width: 520px; min-width: 0; }
.dash-filter-label {
  flex: 0 0 76px;
  padding-top: 6px;
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.dash-filter-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  padding: 3px 0;
}
.dash-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 1px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.dash-filter-chip:hover { background: var(--sel); color: var(--ink); }
.dash-filter-chip.is-active {
  border-color: var(--line-hi);
  background: var(--sel-hi);
  color: var(--ink);
  font-weight: 500;
}
.dash-filter-chip strong {
  min-width: 19px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--sel);
  color: var(--ink);
  font: 500 0.6875rem/1rem var(--font-sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.dash-filter-chip.is-active strong { background: var(--primary-bg); color: var(--on-primary); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  header { height: auto; flex-wrap: wrap; padding: 6px 16px; }
  .header-right { flex-wrap: wrap; min-width: 0; max-width: 100%; }
  /* The nav scrolls inside the header instead of widening the page past a phone's width. */
  nav { overflow-x: auto; max-width: 100%; }
  .nav-btn { flex: none; }
  .nav-btn { min-height: 36px; }
}
@media (max-width: 768px) {
  main { padding: 12px 16px 24px; }
  .pager { flex-direction: column; align-items: stretch; }
  .stat-card { min-width: 45%; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Filter rows with many options: a searchable dropdown (combobox) instead of chips. */
.mx-combo { position: relative; width: min(22rem, 100%); }
.mx-combo .input-box { width: 100%; padding-right: 28px; }
.mx-combo .input-box.is-set { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mx-combo-clear {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  cursor: pointer;
}
.mx-combo-clear:hover { background: var(--sel); color: var(--ink); }
.mx-combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 100%;
  width: max-content;
  max-width: min(36rem, 90vw);
  max-height: 18rem;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
}
.mx-combo-option {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.mx-combo-option:hover, .mx-combo-option.is-active { background: var(--sel-hi); }
.mx-combo-option.is-selected { color: var(--accent); font-weight: 600; }
.mx-combo-option mark { background: var(--warn-soft); color: inherit; border-radius: 2px; padding: 0; }
.mx-combo-all { color: var(--ink); }
.mx-combo-empty { padding: 6px 8px; color: var(--ink-3); font-size: var(--fs-xs); }

/* ---------- row actions ----------
   A row shows its one main action (.row-main) and puts the rest in a 「⋯」 menu (.row-menu).
   A button never borrows the chart palette, so the data stays the loudest thing in a row. */
.btn-action.row-main { color: var(--accent); border-color: var(--accent-line); }
.btn-action.row-main:hover { background: var(--accent-soft); border-color: var(--accent); }
.row-acts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; max-width: 170px; }
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; min-width: 28px; padding: 2px 6px; letter-spacing: 1px; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--sel-hi); border-color: var(--line-hi); }
.row-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: var(--z-sticky);
  display: flex; flex-direction: column; min-width: 140px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
}
.row-menu-list > button, .row-menu-list > a {
  all: unset; box-sizing: border-box; padding: 6px 10px; border-radius: 4px; cursor: pointer;
  font-size: var(--fs-sm); color: var(--ink); white-space: nowrap;
}
.row-menu-list > button:hover, .row-menu-list > a:hover, .row-menu-list > button:focus-visible { background: var(--sel-hi); }

/* Shared filter dropdown: option rows with checkmark (multi-select), label and count; selected values as removable chips. */
.dash-filter-options:has(> .mx-combo) { gap: 4px 6px; }
.mx-combo-option { display: flex; align-items: baseline; gap: 8px; }
.mx-combo-text { flex: 1 1 auto; min-width: 0; }
.mx-combo-check { flex: 0 0 1em; color: var(--accent); font-weight: 600; text-align: center; }
.mx-combo-count {
  flex: 0 0 auto;
  margin-left: 12px;
  color: var(--ink);
  font: 600 0.68rem var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.mx-combo-option.is-selected .mx-combo-count { color: var(--accent); }
.mx-combo-tag span { margin-left: 2px; opacity: 0.7; }
.mx-combo-tag:hover span { opacity: 1; }

/* Column chooser (训练清单 列设置): drag to reorder, tick to show. */
.mx-column-wrap { position: relative; }
.mx-column-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  max-width: calc(100vw - 32px);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(10, 16, 28, 0.16);
}
/* Explicit so a later display rule cannot un-hide the closed menu. */
.mx-column-menu[hidden] { display: none; }
.mx-column-menu-hint { padding: 2px 6px 6px; color: var(--text-muted); font-size: var(--fs-xs); }
.mx-column-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: var(--fs-sm);
  color: var(--ink);
  cursor: grab;
  user-select: none;
}
.mx-column-item:hover { background: var(--surface-2); }
.mx-column-item.is-dragging { opacity: 0.45; }
.mx-column-item.is-drop-target { border-color: var(--accent); background: var(--accent-soft); }
.mx-column-item input { margin: 0; }
.mx-column-handle { color: var(--text-muted); font-size: var(--fs-xs); letter-spacing: -2px; }

/* ---------- compile / publish jobs (JobCenter) ---------- */
.job-center-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink-2);
  font: inherit; font-size: var(--fs-sm); cursor: pointer;
}
.job-center-btn:hover { border-color: var(--line-hi); color: var(--ink); }
.job-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-xs); font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.job-count[hidden] { display: none; }
.job-drawer {
  position: fixed; top: 56px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px)); z-index: var(--z-drawer);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-overlay);
  display: flex; flex-direction: column; overflow: hidden;
}
.job-drawer[hidden] { display: none; }
.job-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.job-drawer-list { overflow-y: auto; padding: 8px 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.job-row { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; background: var(--panel); }
.job-row.is-queued, .job-row.is-running, .job-row.is-publishing { border-color: var(--accent-line); background: var(--accent-soft); }
.job-row.is-failed { border-color: var(--fail-line); }
.job-row-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); }
.job-row-main strong { font-family: var(--font-mono); font-weight: 600; overflow-wrap: anywhere; }
.job-row-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.job-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.job-error { font-size: var(--fs-xs); color: var(--fail); white-space: pre-wrap; overflow-wrap: anywhere; }
.job-state { font-size: var(--fs-xs); font-weight: 600; padding: 0 6px; border-radius: 4px; background: var(--sel); color: var(--ink-2); }
.job-state.is-queued, .job-state.is-running, .job-state.is-publishing, .job-state.is-preview_ready { background: var(--accent-soft); color: var(--accent); }
.job-state.is-completed, .job-state.is-published { background: var(--pass-soft); color: var(--pass); }
.job-state.is-failed { background: var(--fail-soft); color: var(--fail); }
.job-stages { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.job-stages li { font-size: var(--fs-xs); padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-3); }
.job-stages li.is-done { border-color: var(--pass-line); color: var(--pass); background: var(--pass-soft); }
.job-stages li.is-current { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.job-stages li.is-failed { border-color: var(--fail-line); color: var(--fail); background: var(--fail-soft); font-weight: 600; }

/* 数据总表: the dataset's data manifest */
.dm-state { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: 0 6px; border-radius: 4px; line-height: 1.25rem; white-space: nowrap; }
.dm-state.is-none { color: var(--ink-3); font-weight: 400; }
.dm-state.is-queued, .dm-state.is-running { background: var(--accent-soft); color: var(--accent); }
.dm-state.is-fresh { background: var(--pass-soft); color: var(--pass); }
.dm-state.is-stale { background: var(--warn-soft); color: var(--warn); }
.dm-state.is-failed { background: var(--fail-soft); color: var(--fail); }
/* A dataset marked unusable (catalog/unusable.py): greyed row, the failed tag's colours, reason on hover. */
.dm-state.is-unusable { background: var(--fail-soft); color: var(--fail); font-family: var(--font-sans); }
tr.is-unusable > td { color: var(--ink-3); }
.dm-state-sub { font-size: var(--fs-xs); color: var(--ink-3); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cdm-precheck { font-size: var(--fs-sm); line-height: 1.55; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; background: var(--panel-deep); }
.cdm-precheck.is-queued, .cdm-precheck.is-running { border-color: var(--accent-line); background: var(--accent-soft); }
.cdm-precheck.is-fresh { border-color: var(--pass-line); background: var(--pass-soft); }
.cdm-precheck.is-stale { border-color: var(--warn-line); background: var(--warn-soft); }
.cdm-precheck.is-failed { border-color: var(--fail-line); background: var(--fail-soft); }
/* dm compile dialog: the video releases of the picked datasets (one row per cohort). */
.cdm-video { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; display: grid; gap: 8px; }
.cdm-video-head { font-size: var(--fs-sm); font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.cdm-video-head .tm-muted { font-weight: 400; font-size: var(--fs-xs); }
.cdm-video-row { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.cdm-video-cohort { font-family: var(--font-mono); font-size: var(--fs-sm); display: flex; gap: 6px; align-items: center; }
.cdm-video-built { width: auto; justify-self: start; font-family: var(--font-mono); font-size: var(--fs-xs); padding: 2px 6px; }
.cdm-video-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.cdm-video-chips .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdm-video-none { color: var(--ink-3); border-style: dashed; }
/* Cohorts whose names start alike fold into one row with one tick for all (index.html compileVideoFamilies). */
.cdm-video-family > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cdm-video-family > summary::before { content: "▸"; color: var(--ink-3); width: 10px; }   /* flex takes the marker away */
.cdm-video-family[open] > summary::before { content: "▾"; }
.cdm-video-family[open] > summary { margin-bottom: 8px; }
.cdm-video-family > .cdm-video-row { margin: 0 0 8px 18px; }
.cdm-video-count { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }

/* a manifest just published from the wizard */
.is-just-published { outline: 2px solid var(--pass); outline-offset: 2px; animation: just-published 2.4s ease-out 1; }
@keyframes just-published { from { background: var(--pass-soft); } }

/* the wizard's publication progress (step 5) */
.rb-publish-progress { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.rb-publish-progress .job-error { font-size: var(--fs-sm); }

/* 轨迹列表 (index.html, manifestTrajectoryListHtml): five trajectories of every dataset. The modal
   layer is the only scroller; the table has no height limit of its own. */
.mx-traj-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin: 0 28px 14px 0; }
.mx-traj-title { margin: 0; font-size: var(--fs-md); color: var(--ink); overflow-wrap: anywhere; }
.mx-traj-mid { margin-left: 6px; font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 400; color: var(--ink-3); }
.mx-traj-sub { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ink-3); }
.mx-traj-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mx-traj-table { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.mx-traj-table table { font-size: var(--fs-sm); }
.mx-traj-id { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.3; max-width: 220px; word-break: break-all; }
.mx-traj-id .mx-copy { color: var(--accent); }

/* A training manifest card under its data manifest: name and id copy on click. */
.tm-card-name { color: var(--ink); font-size: var(--fs-md); font-weight: 600; overflow-wrap: anywhere; }
.tm-card-id { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); }

/* Code colours: GitHub's light and dark palettes for highlight.js tokens (index.html, mxHighlight);
   the --hl-* values are in tokens.css. Only the token colours change; each block keeps its own background and font. */
.hljs-keyword, .hljs-selector-tag, .hljs-type, .hljs-doctag { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-template-string { color: var(--hl-string); }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: normal; }
.hljs-title, .hljs-title.function_, .hljs-title.class_, .hljs-section { color: var(--hl-title); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-variable.constant_ { color: var(--hl-number); }
.hljs-built_in, .hljs-variable.language_, .hljs-params { color: var(--hl-builtin); }
.hljs-attr, .hljs-attribute, .hljs-property, .hljs-variable { color: var(--hl-attr); }
.hljs-meta, .hljs-name, .hljs-selector-class { color: var(--hl-meta); }

/* 数据清单 table: the name column is capped and its tags cut with an ellipsis, so the action
   column stays on screen; an id shows its prefix and the first 8 of its hash. */
.mx-name-cell { max-width: 360px; }
.mx-name-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; min-width: 0; }
.mx-name-tags .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-name-line { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.mx-id-cell { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.mx-recipe-cell { max-width: 260px; }
.mx-recipe { padding: 2px 0 2px 10px; border-left: 2px solid var(--line-hi); font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.mx-ds-name { font-weight: 500; color: var(--ink); }

/* ---------- picking rows (数据总表, 训练清单) ----------
   A box shows only where it can be used: on the row under the pointer, on a keyboard focus, on a touch screen,
   and on every row once anything is picked. A row that cannot be picked has none. A picked row takes the
   neutral selection fill, and what to do with the picks floats at the bottom of the page. */
.mx-check, .mx-pick-box {
  appearance: none; flex: none; box-sizing: border-box; width: 16px; height: 16px; margin: 0; position: relative;
  border: 1px solid var(--line-hi); border-radius: 5px; background: var(--panel); cursor: pointer;
  transition: opacity var(--t), background var(--t), border-color var(--t);
}
.mx-check:hover, .mx-pick-box:hover { border-color: var(--ink-3); }
.mx-check:focus-visible, .mx-pick-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mx-check:checked, .mx-pick-box:checked { background: var(--primary-bg); border-color: var(--primary-bg); }
.mx-check:checked::after, .mx-pick-box:checked::after {
  content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 3.5px; height: 7.5px;
  border: solid var(--on-primary); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg);
}
.mx-pick-cell { width: 26px; min-width: 26px; padding: 0; }
.mx-pick-cell + th, .mx-pick-cell + td { padding-left: 2px; }
.mx-pick { display: flex; justify-content: center; padding: 6px 5px; cursor: pointer; user-select: none; }
.mx-pick-box { opacity: 0; }
.mx-pick-box:disabled { display: none; }
tr:hover .mx-pick-box, .mx-pick-box:focus-visible, .mx-pick-box:checked,
.section:has(.mx-sel-bar:not([hidden])) .mx-pick-box { opacity: 1; }
@media (hover: none) { .mx-pick-box { opacity: 1; } }
/* On a wide page the box column hangs in the page's margin, so row names keep the page's left edge. */
@media (min-width: 1100px) {
  #section-tms .table-container, #section-tms .table-scroll-wrapper { overflow: visible; }
  #top-datasets-table, #tm-list-table { margin-left: -20px; width: calc(100% + 20px) !important; }
  thead .mx-pick-cell, tbody .mx-pick-cell { border-color: transparent; background: transparent; }
  .mx-pick-cell + th, .mx-pick-cell + td { padding-left: 0; }
}
tr:has(.mx-pick-box:checked) > td { background: var(--sel); }
tbody tr:has(.mx-pick-box:checked):hover > td { background: var(--sel-hi); }

.mx-sel-bar {
  position: fixed; left: 50%; bottom: 20px; z-index: calc(var(--z-fab) - 1); transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; box-sizing: border-box; width: max-content; max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-overlay); font-size: var(--fs-sm); color: var(--ink);
  font-variant-numeric: tabular-nums; animation: mx-sel-bar-in var(--t-layer) cubic-bezier(.16, 1, .3, 1);
}
.mx-sel-bar[hidden] { display: none; }
.mx-sel-text { min-width: 0; }
.mx-sel-acts { display: flex; flex: none; gap: 6px; }
.mx-sel-acts .btn { border-radius: var(--radius-pill); }
@keyframes mx-sel-bar-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (max-width: 760px) {
  /* full width, above the 领域专家 button */
  .mx-sel-bar { width: calc(100vw - 32px); flex-wrap: wrap; gap: 8px; border-radius: var(--radius); padding: 10px 12px; bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) { .mx-sel-bar { animation: none; } }
