/* matching-config.css - the atoms this group adds (th-mx-cfg-*; the cfg infix keeps them apart from the other groups, whose sheets load in the same frame). Lifts beside the shipped sheet it extends:
   threshold-document-policies.css (Settings > Documents & intake), with the ordered rule list and the
   picker borrowed from routing-policies.css. Tokens only; both themes come from the tokens. */

/* The shared Settings chrome's Publishing card: the shipped page zeroes its caption padding inline. */

/* A banner that leads a tab panel (nothing configured, just published). */
.th-mx-cfg-lead { display: grid; gap: 10px; margin-top: 18px; }
.th-mx-cfg-lead .th-banner { margin: 0; font-size: 12.5px; line-height: 1.5; }
.th-mx-cfg-after { display: block; margin-top: 8px; color: var(--th-ink-2); }

/* ---------- rule sets: one card per source and document type ---------- */
.th-mx-cfg-sets, .th-mx-cfg-defs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.th-mx-cfg-defs { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; }
.th-mx-cfg-set { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 11px 14px 12px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper-sunk); }
.th-mx-cfg-set:hover { background: var(--th-paper-2); }
.th-mx-cfg-set.is-active { background: var(--th-advant-soft); border-color: color-mix(in oklab, var(--th-advant) 35%, var(--th-line)); box-shadow: inset 3px 0 0 var(--th-advant); }
.th-mx-cfg-set.is-empty { cursor: default; border-style: dashed; background: transparent; }
.th-mx-cfg-set-grp { font-family: var(--th-f-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--th-ink-3); }
.th-mx-cfg-set-name { font-size: 13px; font-weight: 600; color: var(--th-ink); }
.th-mx-cfg-set-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; color: var(--th-ink-2); line-height: 1.45; }
.th-mx-cfg-set-sub { font-size: 11px; color: var(--th-ink-3); }
.th-mx-cfg-set-units { display: grid; gap: 3px; margin-top: 6px; padding-top: 7px; border-top: 1px solid var(--th-line-soft); }
.th-mx-cfg-set-unit { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--th-ink); }
.th-mx-cfg-set-unit .cc-pill { white-space: nowrap; flex: none; }
.th-mx-cfg-set .dp-chg { margin-left: 8px; }

/* The editor below the cards: the verified identifiers switch and its consequence. */
.th-mx-cfg-ids { margin-bottom: 14px; }
.th-mx-cfg-consequence { display: flex; gap: 8px; align-items: flex-start; padding: 9px 14px 11px; border-top: 1px solid var(--th-line-soft); font-size: 12px; line-height: 1.5; color: var(--th-warn-ink); background: var(--th-warn-soft); border-radius: 0 0 var(--th-radius-5) var(--th-radius-5); }
.th-mx-cfg-consequence svg { flex: none; margin-top: 2px; }

/* ---------- the ordered rule list (routing's th-rule-row) ---------- */
.th-mx-cfg-rules .th-card__head { flex-wrap: wrap; }
.th-mx-cfg-facts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.th-mx-cfg-facts .dp-chip { font-size: 11px; padding: 0 8px; line-height: 1.65; }
.th-mx-cfg-rules .th-rule-main__name .dp-chg { margin-left: 8px; }
.th-rule-team.th-mx-cfg-out { display: block; }
.th-mx-cfg-out .th-mx-cfg-outcome { width: 100%; font-size: 12.5px; padding: 6px 8px; }
.th-mx-cfg-out .th-mx-cfg-outcome[aria-invalid="true"] { border-color: var(--th-risk); }
.th-mx-cfg-out .cc-pill { white-space: nowrap; }

/* The standard test: the fixed last row, not draggable. */
.th-mx-cfg-floor { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 12px 11px 8px; border-top: 1px dashed var(--th-line-2); background: var(--th-paper-2); }
.th-rule-list > .th-mx-cfg-floor { margin-left: 0; }
.th-mx-cfg-floor.is-alone { border: 1px dashed var(--th-line-2); border-radius: var(--th-radius-5); margin-top: 12px; }
.th-mx-cfg-floor-pos { color: var(--th-ink-3); background: var(--th-paper-sunk); border-style: dashed; }
.th-mx-cfg-floor-main { display: grid; gap: 3px; min-width: 0; }
.th-mx-cfg-floor-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; font-weight: 600; color: var(--th-ink); }
.th-mx-cfg-floor-text { font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.th-mx-cfg-floor-out { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.th-mx-cfg-floor-out .cc-pill { white-space: nowrap; }
.th-mx-cfg-or { font-size: 11px; color: var(--th-ink-3); }

/* The inline rule editor. */
.th-mx-cfg-ruleform { display: grid; gap: 14px; padding: 14px 16px 16px 8px; border-bottom: 1px solid var(--th-line-soft); background: var(--th-paper); box-shadow: inset 3px 0 0 var(--th-advant); }
.th-mx-cfg-ruleform > :not(.th-mx-cfg-ruleform-head) { margin-left: 38px; }
.th-mx-cfg-ruleform-head { display: flex; align-items: center; gap: 10px; }
.th-mx-cfg-ruleform-title { font-size: 13px; font-weight: 600; color: var(--th-ink); }
.th-mx-cfg-ruleform .th-field { max-width: 420px; }
.th-mx-cfg-fpick { display: grid; gap: 8px; }
.th-mx-cfg-fpick-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.th-mx-cfg-fgroup { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: start; }
.th-mx-cfg-fgroup legend { float: left; padding: 4px 0 0; font-family: var(--th-f-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--th-ink-3); }
.th-mx-cfg-fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.th-mx-cfg-fchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 7px; border: 1px solid var(--th-line-2); border-radius: var(--th-radius-pill); background: var(--th-paper-sunk); font-size: 12px; color: var(--th-ink); cursor: pointer; }
.th-mx-cfg-fchip input { margin: 0; width: 13px; height: 13px; accent-color: var(--th-advant); }
.th-mx-cfg-fchip:hover { border-color: var(--th-ink-4); }
.th-mx-cfg-fchip:focus-within { outline: 2px solid var(--th-advant); outline-offset: 2px; }
.th-mx-cfg-fchip.is-on { background: var(--th-advant-soft); border-color: color-mix(in oklab, var(--th-advant) 45%, var(--th-line-2)); color: var(--th-advant-deep); font-weight: 500; }
.th-mx-cfg-fchip.is-uncompared { border-style: dashed; color: var(--th-ink-2); }
.th-mx-cfg-fchip-note { font-family: var(--th-f-mono); font-size: 9.5px; letter-spacing: 0.04em; color: var(--th-ink-3); }
.th-mx-cfg-ruleform-out { display: grid; gap: 6px; justify-items: start; }
.th-mx-cfg-ruleform-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- publish check ---------- */
.th-mx-cfg-check { margin-top: 14px; }
.th-mx-cfg-check .dp-impact { border-bottom: 1px solid var(--th-line-soft); }
.dp-imp-line.th-mx-cfg-imp-risk .dot { background: var(--th-risk); }
.th-mx-cfg-check .dp-imp-line b { color: var(--th-ink); font-weight: 600; }
.th-mx-cfg-check .dp-imp-line .dp-linkbtn { margin-left: 4px; }
.th-mx-cfg-check-units { padding: 12px 16px 14px; }
.th-mx-cfg-check-note { margin: 8px 0 0; font-size: 11.5px; color: var(--th-ink-2); line-height: 1.5; }
.th-mx-cfg-units { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper); }
.th-mx-cfg-units li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 8px 12px; font-size: 12.5px; color: var(--th-ink); }
.th-mx-cfg-units li + li { border-top: 1px solid var(--th-line-soft); }
.th-mx-cfg-unit-name { min-width: 0; }
.th-mx-cfg-unit-move { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.th-mx-cfg-unit-move .cc-pill { white-space: nowrap; }
.th-mx-cfg-arrow { color: var(--th-ink-3); font-size: 12px; }
.th-mx-cfg-unit-same { font-size: 11.5px; color: var(--th-ink-3); }

/* ---------- hand-recorded ---------- */
.th-mx-cfg-manual-note b { font-weight: 600; }
.th-mx-cfg-offered { margin-top: 18px; }
.th-mx-cfg-offered .dp-tr { grid-template-columns: minmax(0, 0.9fr) minmax(0, 2fr) 0; }
.dp-tr.th-mx-cfg-tr-muted { background: var(--th-paper-2); color: var(--th-ink-2); }
.dp-tr.th-mx-cfg-tr-muted .nm { color: var(--th-ink-2); }

/* ---------- fact mapping ---------- */
.th-mx-cfg-mapbar { margin-top: 14px; }
.th-mx-cfg-map { margin-top: 14px; }
.th-mx-cfg-map .dp-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 150px; }
.dp-tr.th-mx-cfg-grp { background: var(--th-paper-2); padding-top: 6px; padding-bottom: 6px; font-family: var(--th-f-mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--th-ink-3); }
.dp-tr.th-mx-cfg-grp > span { grid-column: 1 / -1; }
.th-mx-cfg-unmapped { font-size: 12px; color: var(--th-ink-3); font-style: italic; }
.th-mx-cfg-status { display: inline-flex; align-items: center; gap: 0; flex-wrap: wrap; }
.th-mx-cfg-status .cc-pill { white-space: nowrap; }
.dp-tr.th-mx-cfg-invalid { background: var(--th-risk-soft); }
.dp-tr.th-mx-cfg-picking { background: var(--th-paper); }
.dp-tr.th-mx-cfg-picking > .th-mx-cfg-fpicker { grid-column: 1 / -1; margin: 4px 0 2px; }
.th-mx-cfg-fieldpick { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 5px 9px 5px 10px; text-align: left; font: inherit; font-size: 12.5px; color: var(--th-ink); cursor: pointer;
  border: 1px solid var(--th-line-2); border-radius: var(--th-radius-3); background: var(--th-paper-sunk); }
.th-mx-cfg-fieldpick:hover { border-color: var(--th-ink-4); }
.th-mx-cfg-fieldpick > svg { flex: none; color: var(--th-ink-2); }
.th-mx-cfg-fieldpick.is-open { border-color: var(--th-advant); box-shadow: 0 0 0 3px var(--th-advant-soft); color: var(--th-ink-2); }
.th-mx-cfg-fieldpick.is-invalid { border-color: var(--th-risk); }
.th-mx-cfg-fieldpick .nm, .th-mx-cfg-fieldpick .sub { display: block; }
.th-mx-cfg-fpicker .th-rule-picker__results + .th-rule-picker__scope { border-top: 1px solid var(--th-line-soft); padding-top: 8px; }
.th-mx-cfg-map-note { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 12px; border: 1px dashed var(--th-line-2); border-radius: var(--th-radius-5); font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.th-mx-cfg-map-note svg { flex: none; margin-top: 2px; color: var(--th-ink-3); }
.th-mx-cfg-empty { margin-top: 14px; border: 1px solid var(--th-line); border-radius: var(--th-radius-8); background: var(--th-paper-sunk); }

/* ---------- review sheets ---------- */
.th-mx-cfg-cap-gap { margin-top: 16px; }
.dp-sheet .th-modal__impact { margin-top: 4px; }
.th-mx-cfg-sheet-note { margin: 8px 0 16px; font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.dp-sheet .th-field textarea { width: 100%; min-height: 68px; }

/* ---------- safe preview ---------- */
.th-mx-cfg-pv-empty { display: grid; gap: 8px; padding: 18px 16px 20px; font-size: 12.5px; color: var(--th-ink-2); line-height: 1.55; }
.th-mx-cfg-pv-empty p { margin: 0; max-width: 560px; }
.th-mx-cfg-pv-empty div { margin-top: 4px; }
.th-mx-cfg-pv-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 11px 16px; border-bottom: 1px solid var(--th-line); font-size: 12px; color: var(--th-ink-2); }
.th-mx-cfg-pv-sum b { font-family: var(--th-f-mono); font-weight: 600; font-size: 13px; color: var(--th-ink); margin-right: 3px; }
.th-mx-cfg-pv-filter { margin-left: auto; }
.th-mx-cfg-pv-filter .bf-seg-opt { padding: 5px 11px; font-size: 12px; }
.th-mx-cfg-pv-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.4fr); gap: 12px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--th-line-soft); font-size: 12.5px; }
.th-mx-cfg-pv-row.is-head { border-top: none; background: var(--th-paper-2); padding-top: 7px; padding-bottom: 7px; font-family: var(--th-f-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--th-ink-3); }
.th-mx-cfg-pv-row.is-changed { box-shadow: inset 3px 0 0 var(--th-marigold-deep); }
.th-mx-cfg-pv-row .cc-pill { white-space: nowrap; }
.th-mx-cfg-pv-res { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.th-mx-cfg-pv-live { font-size: 11px; line-height: 1.4; color: var(--th-ink-2); }
.th-mx-cfg-pv-note { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--th-line); font-size: 12px; line-height: 1.55; color: var(--th-ink-2); }
.th-mx-cfg-pv-item { display: grid; gap: 2px; min-width: 0; }
.th-mx-cfg-pv-id { font-family: var(--th-f-mono); font-size: 12px; color: var(--th-ink); }
.th-mx-cfg-pv-src { font-size: 11px; color: var(--th-ink-2); }
.th-mx-cfg-pv-why { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12px; color: var(--th-ink-2); line-height: 1.45; }
.th-mx-cfg-pv-why .dp-chg { margin-left: 0; }
.th-mx-cfg-pv-masked { display: inline-flex; align-items: center; gap: 6px; }
.th-mx-cfg-pv-masked svg { flex: none; color: var(--th-ink-3); }
.th-mx-cfg-lbl { display: none; }
.th-mx-cfg-pv-detail { padding: 2px 16px 14px 19px; box-shadow: inset 3px 0 0 var(--th-marigold-deep); }
.th-mx-cfg-pv-detail > div { padding: 11px 13px 12px; border: 1px solid var(--th-line); border-radius: var(--th-radius-5); background: var(--th-paper); }
.th-mx-cfg-pv-dhead { font-size: 12px; color: var(--th-ink-2); }
.th-mx-cfg-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; margin: 10px 0 0; }
.th-mx-cfg-results > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--th-line-soft); }
.th-mx-cfg-results dt { font-size: 12px; color: var(--th-ink); }
.th-mx-cfg-results dd { margin: 0; }
.th-mx-cfg-results .cc-pill { white-space: nowrap; }
.th-mx-cfg-results .cc-pill svg { flex: none; }
.th-mx-cfg-hidden { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; font-size: 12px; color: var(--th-ink-2); }
.th-mx-cfg-hidden svg, .th-mx-cfg-hidden-foot svg { flex: none; color: var(--th-ink-3); }
.th-mx-cfg-hidden-foot { display: flex; align-items: center; gap: 7px; }
.th-mx-cfg-pv-dnote { margin: 8px 0 0; font-size: 11.5px; color: var(--th-ink-3); line-height: 1.5; }
.th-mx-cfg-pv-paging { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--th-line); font-size: 11.5px; color: var(--th-ink-2); }
.th-mx-cfg-pv-paging > span { flex: 1; }

/* ---------- history ---------- */
.dp-hev .kind.th-mx-cfg-kind-map { color: var(--th-advant-deep); }
.th-mx-cfg-hafter { display: flex; gap: 7px; align-items: flex-start; margin-top: 8px; padding: 6px 10px; border-radius: var(--th-radius-3); background: var(--th-paper-2); font-size: 12px; color: var(--th-ink-2); line-height: 1.5; }
.th-mx-cfg-hafter svg { flex: none; margin-top: 3px; color: var(--th-ink-3); }

/* ---------- narrow: the Threshold pane at phone width ---------- */
@media (max-width: 720px) {
  .th-mx-cfg-sets, .th-mx-cfg-defs { grid-template-columns: minmax(0, 1fr); }
  .th-mx-cfg-floor { grid-template-columns: 28px minmax(0, 1fr); }
  .th-mx-cfg-floor-out { grid-column: 2; }
  .th-mx-cfg-ruleform { padding: 12px 12px 14px; }
  .th-mx-cfg-ruleform > :not(.th-mx-cfg-ruleform-head) { margin-left: 0; }
  .th-mx-cfg-fgroup { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .th-mx-cfg-ruleform .bf-seg { display: flex; width: 100%; }
  .th-mx-cfg-ruleform .bf-seg-opt { min-width: 0; white-space: normal; padding: 7px 8px; }
  .th-mx-cfg-ruleform-actions { justify-content: stretch; }
  .th-mx-cfg-ruleform-actions .cc-btn { flex: 1; justify-content: center; }
  .th-mx-cfg-offered .dp-tr, .th-mx-cfg-map .dp-tr { grid-template-columns: minmax(0, 1fr); }
  .th-mx-cfg-status { margin-top: 2px; }
  .th-mx-cfg-pv-filter { margin-left: 0; width: 100%; display: flex; }
  .th-mx-cfg-pv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 10px 16px; align-items: start; }
  .th-mx-cfg-pv-row.is-head { display: none; }
  .th-mx-cfg-pv-item, .th-mx-cfg-pv-why { grid-column: 1 / -1; }
  .th-mx-cfg-lbl { display: block; margin-bottom: 3px; font-family: var(--th-f-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--th-ink-3); }
  .th-mx-cfg-pv-detail { padding: 0 12px 12px 15px; }
  .th-mx-cfg-results { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dp-sheet .th-modal__impact li { grid-template-columns: 16px minmax(0, 1fr); row-gap: 2px; }
  .dp-sheet .th-modal__impact .v { grid-column: 2; white-space: normal; }
}
.th-mx-cfg-fpicker .th-rule-picker__close { margin-left: auto; }
