/* ==================================================================
   matching-incoming.css - Incoming documents with matching (canon
   threshold-incoming-matching, group D: the queue and the item card).

   Lifts beside wwwroot/css/af-incoming.css and loads after it,
   af-requirements.css (radio dot, input, refusal) and
   threshold-operational-components.css (th-field, th-input).
   Tokens only; dark flows through the --th-* layer.

   Part 1 copies, under their existing names, the advisory proposal
   rules that the all-files prototype canon drew and the shipped sheet
   left out ("ship with proposals in the matching delivery"):
   docs/design-canon/all-files-prototype-review/handoff/all-files/
   af-incoming.css, .af-in-proposal* .af-in-lead .af-in-cands
   .af-in-cand*. .af-in-cand no longer rides on .af-in-radio: a card
   holds a table and buttons, so it is a box with a radio inside.
   The per-fact signal list (.af-in-signal*) is replaced by the
   comparison table (.th-mx-cmp) and is not copied.

   Part 2 is this canon's own atoms (th-mx-*).
   ================================================================== */

/* ---------- Part 1: copied from the prototype canon ---------- */
.af-in-proposal { display: flex; flex-direction: column; gap: 8px; }
.af-in-proposal-head { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.af-in-proposal-title { font-family: var(--th-font-serif); font-weight: 600; font-size: 14px; color: var(--th-ink); }
.af-in-lead { font-size: var(--th-size-13); color: var(--th-ink-2); text-wrap: pretty; }
.af-in-cands { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.af-in-cands.is-multi { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.af-in-cand { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; min-width: 0; }
.af-in-cand-head { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.af-in-cand-name { font-weight: 600; font-size: 13px; white-space: nowrap; }
.af-in-cand-files { font-size: 11px; color: var(--th-ink-2); font-family: var(--th-font-mono); overflow-wrap: anywhere; white-space: pre-line; }


/* ---------- Part 2: this canon's atoms ---------- */
.th-mx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* A text button that reads as a link: Check again, Undo, Change facts */
.th-mx-link { font: inherit; font-size: inherit; padding: 0; border: 0; background: transparent; color: var(--th-advant); cursor: pointer; white-space: nowrap; }
.th-mx-link:hover { color: var(--th-advant-deep); text-decoration: underline; }
.th-mx-link:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; border-radius: var(--th-radius-2); }

/* Queue header: source health, one line, only when a source needs attention */
.th-mx-health { margin: 4px 0 0; display: flex; align-items: baseline; gap: 4px 6px; flex-wrap: wrap; font-size: var(--th-size-12); color: var(--th-ink-2); }
.th-mx-health > svg { align-self: center; color: var(--th-warn-ink); }
.th-mx-health b { color: var(--th-ink); font-weight: 600; }

/* Queue rows: the tab a search result is in; a waiting row's typed name */
.th-mx-row-tab { align-self: flex-start; margin-top: 2px; font-size: 11px; font-weight: 600; color: var(--th-ink-2); }
.af-in-item-label.is-name { font-weight: 600; }

/* Section head: a label with one quiet action at the right */
.th-mx-sec-head { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.th-mx-sec-head > .th-mx-link, .th-mx-sec-head > .th-mx-aside { margin-left: auto; font-size: var(--th-size-12); }
.th-mx-aside { color: var(--th-ink-2); }

/* Facts from the document: label | value, with where it came from under the value */
.th-mx-facts { margin: 0; display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 6px 16px; font-size: var(--th-size-13); }
.th-mx-fact { display: contents; }
.th-mx-facts dt { color: var(--th-ink-2); }
.th-mx-facts dd { margin: 0; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.th-mx-fact-v { color: var(--th-ink); overflow-wrap: anywhere; }
.th-mx-fact-v.is-mono { font-family: var(--th-font-mono); font-size: var(--th-size-12); }
.th-mx-prov { font-size: 11px; color: var(--th-ink-2); }
.th-mx-prov.is-off { color: var(--th-warn-ink); }

/* The typed-fact form */
.th-mx-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.th-mx-form .th-field label { color: var(--th-ink); font-weight: 500; }
.th-mx-form .th-field label .th-mx-opt { font-weight: 400; color: var(--th-ink-2); }
.th-mx-form .th-input { width: 100%; min-width: 0; box-sizing: border-box; }
.th-mx-form .th-input.is-mono { font-family: var(--th-font-mono); }
.th-mx-form-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-mx-form-foot .af-in-hint { flex: 1 1 220px; }

/* Who this might be */
.th-mx-checked { margin-left: auto; display: inline-flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; font-size: var(--th-size-12); color: var(--th-ink-2); }
.th-mx-checked.is-fresh { color: var(--th-ink); }
.th-mx-outcome { font-size: var(--th-size-14); color: var(--th-ink); line-height: 1.4; text-wrap: pretty; }
.th-mx-outcome b { font-weight: 600; }
.th-mx-outcome .th-mx-ref { font-family: var(--th-font-mono); font-size: var(--th-size-13); white-space: nowrap; }
.th-mx-quiet { display: flex; align-items: flex-start; gap: 7px; font-size: var(--th-size-12); color: var(--th-ink-2); line-height: 1.45; }
.th-mx-quiet > svg { margin-top: 2px; color: var(--th-ink-3); }
.th-mx-quiet b { color: var(--th-ink); font-weight: 600; }
.th-mx-quiet .th-mx-link { margin-left: 4px; }
.th-mx-pointer { font-size: var(--th-size-12); color: var(--th-ink-2); }

/* A candidate card */
.th-mx-cand { border: 1px solid var(--th-line); border-radius: 4px; background: var(--th-paper); }
.th-mx-cand.is-chosen { border-color: var(--th-advant); box-shadow: inset 0 0 0 1px var(--th-advant); }
.th-mx-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0; border: 0; background: transparent; font: inherit; color: var(--th-ink); cursor: pointer; text-align: left; }
.th-mx-pick:focus-visible { outline: 2px solid var(--th-advant); outline-offset: 2px; border-radius: var(--th-radius-2); }
.th-mx-pick[aria-checked="true"] .af-req-radio-dot { border-color: var(--th-advant-deep); }
.th-mx-pick[aria-checked="true"] .af-req-radio-dot > span { background: var(--th-advant-deep); }
.th-mx-pick .af-req-radio-dot { margin-top: 0; }
.th-mx-cand-name { font-weight: 600; font-size: 13px; }
.th-mx-chip { margin-left: auto; }
.th-mx-origins { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.th-mx-origin { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border: 1px solid var(--th-line-2); border-radius: var(--th-radius-pill); font-size: 11px; line-height: 1.6; color: var(--th-ink-2); background: var(--th-paper); }
.th-mx-origin > svg { width: 11px; height: 11px; }
.th-mx-origin.is-verified { color: var(--th-advant-deep); border-color: var(--th-advant); }
.th-mx-origin.is-disputed { color: var(--th-risk-ink); border-color: var(--th-risk); }
.th-mx-origin.is-progress { color: var(--th-warn-ink); border-color: var(--th-warn); }
.th-mx-by { font-size: 11px; color: var(--th-ink-2); }
.th-mx-cand-foot { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; padding-top: 2px; }
.th-mx-cand-foot .cc-btn { background: var(--th-paper); }
.th-mx-cand-note { font-size: var(--th-size-12); color: var(--th-ink-2); text-wrap: pretty; }

/* The safeguard note and the deciding rule or identifier */
.th-mx-safeguard { display: flex; align-items: flex-start; gap: 6px; font-size: var(--th-size-12); color: var(--th-ink); line-height: 1.45; text-wrap: pretty; }
.th-mx-safeguard > svg { margin-top: 2px; color: var(--th-warn-ink); }
.th-mx-safeguard.is-risk > svg { color: var(--th-risk-ink); }
.th-mx-decide { display: flex; align-items: flex-start; gap: 6px; font-size: var(--th-size-12); color: var(--th-ink-2); line-height: 1.45; text-wrap: pretty; }
.th-mx-decide > svg { margin-top: 2px; color: var(--th-ink-3); }
.th-mx-decide b { color: var(--th-ink); font-weight: 600; }

/* The fact-by-fact comparison */
.th-mx-cmp-wrap { min-width: 0; }
.th-mx-cmp { width: 100%; border-collapse: collapse; font-size: var(--th-size-12); line-height: 1.4; }
.th-mx-cmp th { text-align: left; font-weight: 600; font-size: 11px; color: var(--th-ink-2); padding: 3px 8px 4px 0; border-bottom: 1px solid var(--th-line); white-space: nowrap; }
.th-mx-cmp th[scope="row"] { font-size: var(--th-size-12); font-weight: 400; color: var(--th-ink-2); white-space: normal; border-bottom-color: var(--th-line-soft); }
.th-mx-cmp td, .th-mx-cmp th[scope="row"] { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--th-line-soft); vertical-align: baseline; }
.th-mx-cmp tr:last-child > * { border-bottom: 0; }
.th-mx-cmp .th-mx-v { color: var(--th-ink); overflow-wrap: anywhere; }
.th-mx-cmp .th-mx-v.is-mono { font-family: var(--th-font-mono); font-size: 11.5px; }
.th-mx-cmp .th-mx-v.is-none { color: var(--th-ink-3); }
.th-mx-cmp .th-mx-r { padding-right: 0; text-align: right; white-space: nowrap; }
.th-mx-cmp tr.is-differs > * { background: var(--th-risk-soft); }
.th-mx-cmp tr.is-differs > :first-child { box-shadow: inset 2px 0 0 var(--th-risk); padding-left: 6px; }
.th-mx-cmp tr.is-differs .th-mx-v { color: var(--th-ink); font-weight: 600; }
.th-mx-cmp .cc-pill > svg { width: 10px; height: 10px; }
/* Differs sits on a tinted row, so its pill takes the edge colour to stay a pill */
.th-mx-cmp .cc-pill.is-risk { border-color: var(--th-risk); background: var(--th-paper); }
.th-mx-cmp .th-mx-sub { display: block; font-size: 11px; color: var(--th-ink-2); font-weight: 400; font-family: var(--th-font-sans); }
.th-mx-cmp-note { font-size: var(--th-size-12); color: var(--th-ink-2); text-wrap: pretty; }
.th-mx-hidden { display: flex; align-items: center; gap: 6px; font-size: var(--th-size-12); color: var(--th-ink-2); }
.th-mx-hidden > svg { color: var(--th-ink-3); }

/* A candidate turned down: one line in place of the card */
.th-mx-dismissed { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; padding: 8px 12px; border: 1px dashed var(--th-line-2); border-radius: 4px; font-size: var(--th-size-12); color: var(--th-ink-2); }
.th-mx-dismissed b { color: var(--th-ink); font-weight: 600; }

/* The comparison under Find applicant */
.th-mx-compare { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--th-line); border-radius: 4px; background: var(--th-paper); }

/* Item history */
.th-mx-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--th-size-12); color: var(--th-ink); }
.th-mx-hist li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
.th-mx-hist-when { font-family: var(--th-font-mono); font-size: 11px; color: var(--th-ink-2); }

/* Dialog: what the action is about, label | value */
.th-mx-dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: var(--th-size-13); }
.th-mx-dl dt { color: var(--th-ink-2); }
.th-mx-dl dd { margin: 0; color: var(--th-ink); overflow-wrap: anywhere; }
.th-mx-dl .th-mx-sub { display: block; font-size: 11.5px; color: var(--th-ink-2); }
.th-mx-dl .is-mono { font-family: var(--th-font-mono); font-size: var(--th-size-12); }

/* Narrow (400): the same breakpoint as af-incoming.css */
@media (max-width: 992px) {
    /* Four queue tabs no longer fit one row at 400: two by two, the shipped look per tab */
    .th-mx-four-tabs .af-in-filters { display: block; }
    .th-mx-four-tabs .af-in-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
    .th-mx-four-tabs .af-in-tab { justify-content: space-between; min-height: 32px; align-items: center; white-space: normal; text-align: left; }
    .th-mx-four-tabs .af-in-tab:nth-child(-n+2) { border-bottom: 1px solid var(--th-line); }
    .th-mx-four-tabs .af-in-tab:nth-child(2n) { border-right: 0; }
    .af-in-cands.is-multi { grid-template-columns: minmax(0, 1fr); }
    .th-mx-form { grid-template-columns: minmax(0, 1fr); }
    .th-mx-facts { grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px 12px; }
    /* The comparison reflows: fact and result on one line, the values under it */
    .th-mx-cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .th-mx-cmp, .th-mx-cmp tbody { display: block; }
    .th-mx-cmp tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--th-line-soft); }
    .th-mx-cmp tr:last-child { border-bottom: 0; }
    .th-mx-cmp tr > *, .th-mx-cmp tr > th[scope="row"] { border-bottom: 0; padding: 0; }
    .th-mx-cmp tr > th[scope="row"] { grid-column: 1; grid-row: 1; color: var(--th-ink); font-weight: 600; }
    .th-mx-cmp .th-mx-r { grid-column: 2; grid-row: 1; }
    .th-mx-cmp td.th-mx-v { grid-column: 1 / -1; padding-top: 2px; }
    .th-mx-cmp td.th-mx-v::before { content: attr(data-label) " "; font-family: var(--th-font-sans); font-size: 11px; font-weight: 400; color: var(--th-ink-2); }
    .th-mx-cmp tr.is-differs { background: var(--th-risk-soft); box-shadow: inset 2px 0 0 var(--th-risk); padding-left: 8px; padding-right: 6px; }
    .th-mx-cmp tr.is-differs > *, .th-mx-cmp tr.is-differs > :first-child { background: transparent; box-shadow: none; padding-left: 0; }
    .th-mx-hist li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
