/* Payout fraud control (#/payout-control). Colours and spacing come from the shared tokens. */

/* tabs are links: same look as the segmented buttons */
.mn-tabs a.tab-btn{ display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.mn-tabs a.tab-btn:focus-visible{ outline: 2px solid var(--focus); outline-offset: -2px; }
.mn-badge{ display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warning-bg); color: var(--warning); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab-btn.active .mn-badge{ background: var(--surface); }

/* the countdown chip: no capitals forced, steady width, digits that do not jiggle */
.ov-chip.mn-cd{ text-transform: none; min-width: 7ch; justify-content: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-chip.mn-cd-lg{ font-size: 15px; padding: 4px 12px; }
.mn-more{ font-size: 12px; color: var(--ink-muted); cursor: help; }

/* queue */
.mn-list{ background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--elev-1); overflow: clip; margin-bottom: var(--space-4); }
.mn-list .table-card{ border: 0; box-shadow: none; border-radius: 0; }
.mn-list .data-toolbar{ border-bottom: 1px solid var(--line); }
.mn-list .empty-state{ padding: var(--space-8) var(--space-6); }
.mn-status{ font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.mn-status.mn-bad{ color: var(--warning); font-weight: 500; }
.mn-group{ text-align: left; padding: 10px 24px; background: var(--sunken); color: var(--ink-muted); font-size: 13px; font-weight: 500; }
.mn-group-row:hover td, .mn-group-row:hover th{ background: var(--sunken); }
/* case ids and amounts stay on one line */
.mn-list a.mn-case, #mnRoot td.num, .mn-amount{ white-space: nowrap; }
/* a long total wraps after the currency rather than being cut off */
.mn-kpis .kpi-value{ font-size: clamp(20px, 1.9vw, 26px); }
.mn-go-col{ text-align: right; }
#mnRoot table.mn-nodecide .mn-go-col{ display: none; }
.mn-engine{ margin: 0 0 var(--space-4); }
.mn-case, .mn-back{ display: inline-flex; align-items: center; min-height: 32px; font-weight: 500; }
.mn-back{ margin: 0 0 var(--space-3); color: var(--ink-muted); text-decoration: none; }
.mn-back:hover{ color: var(--ink); text-decoration: underline; }
td.wrap .ov-chip{ margin: 2px 4px 2px 0; }
.mn-sub{ font-size: 13px; color: var(--ink-muted); margin-top: 2px; }

/* a case */
.mn-case-head{ display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.mn-case-head h3{ margin: 0; font-size: 18px; font-variant-numeric: tabular-nums; }
.mn-case-head h3:focus{ outline: none; }
.mn-amount{ margin: var(--space-3) 0 var(--space-4); font-size: 36px; line-height: 44px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
#mnRoot .kv-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); }
#mnRoot .kv-grid > div{ display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-muted); min-width: 0; overflow-wrap: anywhere; }
#mnRoot .kv-grid > div b{ font-size: 18px; line-height: 24px; font-weight: 500; color: var(--ink); }
#mnRoot .actions{ display: flex; flex-wrap: wrap; gap: 8px; margin: var(--space-3) 0 0; }
.mn-why{ margin: var(--space-2) 0 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.mn-why.hidden{ display: none; }
.mn-rowbtns{ display: flex; flex-wrap: wrap; gap: 8px; }
.mn-local{ margin: 0 0 var(--space-3); }
#mnRoot label.check{ display: flex; align-items: center; gap: var(--space-3); min-height: 44px; font-size: 14px; font-weight: 400; cursor: pointer; }
#mnRoot label.check input{ width: 18px; height: 18px; flex: none; }
#mnRoot label.check small{ color: var(--ink-muted); }
#mnRoot fieldset{ border: 1px solid var(--line-2); border-radius: var(--radius-sm, 12px); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); min-width: 0; }
#mnRoot fieldset legend{ padding: 0 6px; font-weight: 500; }
#mnRoot fieldset:disabled{ opacity: .8; }
.mn-det summary{ cursor: pointer; font-size: 13px; color: var(--ink-muted); overflow-wrap: anywhere; }
.mn-det pre, .mn-lead pre{ margin: 6px 0 0; padding: 8px 12px; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); }
.error-banner .mn-det summary, .error-banner a, .warn-banner a{ color: inherit; }

/* forms */
.mn-row{ display: flex; flex-wrap: wrap; gap: 0 var(--space-4); align-items: flex-start; }
.mn-row > .field{ flex: 1 1 min(100%, 200px); min-width: 0; }
.mn-fields{ display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 var(--space-4); }
.mn-fe{ min-height: 0; font-size: 13px; line-height: 18px; color: var(--critical); }
.mn-fe:empty{ display: none; }
.mn-list-err > div + div{ margin-top: 4px; }
.mn-sentence{ margin: var(--space-2) 0 var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; }
.mn-sentence:empty{ display: none; }
.mn-adv{ margin: 0 0 var(--space-4); }
.mn-adv summary{ cursor: pointer; font-size: 14px; color: var(--ink-muted); min-height: 32px; display: flex; align-items: center; }
.mn-adv textarea, #nrJ, textarea[name$="-json"]{ font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.mn-effect{ margin: 0 0 var(--space-3); padding: var(--space-2) var(--space-3); background: var(--info-bg); color: var(--info); border-radius: var(--radius-sm); font-size: 14px; }
.mn-effect:empty{ display: none; }
.mn-status-row{ display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 6px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
ul.mn-ul{ margin: 0 0 var(--space-3); padding-left: 20px; }
.mn-filters{ margin-bottom: 0; }

/* simulation and the three states */
.mn-sim{ margin: 0 0 var(--space-4); padding: var(--space-4); border: 1px solid var(--line-2); border-radius: var(--radius-sm, 12px); }
.mn-sim h4{ margin: 0 0 var(--space-1); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.mn-sim-note{ margin: 0 0 var(--space-3); font-size: 13px; color: var(--ink-muted); }
.mn-blast{ display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.mn-blast > div{ display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); background: var(--surface-2); border-radius: var(--radius-sm); }
.mn-blast span{ font-size: 13px; color: var(--ink-muted); }
.mn-blast b{ font-size: 22px; line-height: 28px; font-variant-numeric: tabular-nums; }
.mn-blast small{ font-size: 12px; color: var(--ink-faint); }
.mn-blast.stale{ opacity: .55; }
.mn-seg-set{ margin-top: var(--space-4); }
.mn-seg{ display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--sunken); max-width: 100%; }
.mn-seg-b{ min-height: 40px; min-width: 88px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--ink-muted); font: inherit; font-weight: 500; cursor: pointer; }
.mn-seg-b[aria-pressed="true"]{ background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .14); cursor: default; }
.mn-seg-b:disabled:not([aria-pressed="true"]){ opacity: .5; cursor: not-allowed; }
.mn-seg-b:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; }
.mn-conseq{ margin: var(--space-3) 0 0; padding-left: 20px; font-size: 13px; color: var(--ink-muted); }
.mn-conseq li.on{ color: var(--ink); font-weight: 500; }

/* dialogs */
.mn-facts{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
.mn-facts > div{ min-width: 0; }
.mn-facts dt{ font-size: 12px; color: var(--ink-muted); }
.mn-facts dd{ margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.mn-secret{ margin: var(--space-3) 0 var(--space-2); padding: var(--space-3) var(--space-4); background: var(--surface-2); border: 1px dashed var(--edge); border-radius: var(--radius-sm); }
.mn-secret code{ display: block; font: 15px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.mn-secret code:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; }
.modal-card .btn-row .btn{ min-height: 44px; }

/* touch: 44px targets, full width primary buttons */
@media (pointer: coarse), (max-width: 639.98px){
  .mn-case, .mn-back{ min-height: 44px; }
  #mnRoot .actions .btn, .mn-rowbtns .btn{ min-height: 44px; }
  .mn-seg-b{ min-height: 44px; }
  .mn-det summary, .mn-adv summary{ min-height: 44px; display: flex; align-items: center; }
  .mn-tabs a.tab-btn{ min-height: 44px; }
}
@media (max-width: 639.98px){
  #mnRoot .actions .btn.primary, #mnRoot .actions .btn.danger, .btn-row .btn.primary, .btn-row .btn.danger{ flex: 1 1 100%; }
  .modal-card .btn-row .btn{ flex: 1 1 100%; }
  .mn-seg{ display: flex; width: 100%; }
  .mn-seg-b{ flex: 1; min-width: 0; padding: 0 8px; }
  .mn-amount{ font-size: 30px; line-height: 36px; }
  .mn-list table.stack tr{ padding: 12px 16px; }
  .mn-group{ padding: 10px 16px; display: block; }
  .mn-list table.stack tr.mn-group-row{ padding: 0; }
  /* three lines a case: case and amount, time left and status, then Decide; the rest is on the case */
  .mn-list table.stack tbody tr:not(.mn-group-row){ display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "case amount" "time status" "go go"; gap: 4px 12px; align-items: center; }
  .mn-list table.stack tbody tr > td{ min-width: 0; min-height: 0; padding: 0; gap: 0; }
  .mn-list table.stack tbody tr > td::before{ content: none; }
  .mn-list table.stack tbody tr > td:is([data-label="Customer"], .mn-c-payee, .mn-c-risk, .mn-c-why){ display: none; }
  .mn-list table.stack tbody tr > td[data-label="Case"]{ grid-area: case; justify-content: flex-start; }
  .mn-list table.stack tbody tr > td[data-label="Amount"]{ grid-area: amount; justify-content: flex-end; font-weight: 600; }
  .mn-list table.stack tbody tr > td[data-label="Time left"]{ grid-area: time; justify-content: flex-start; align-items: center; }
  .mn-list table.stack tbody tr > td[data-label="Status"]{ grid-area: status; justify-content: flex-end; align-items: center; }
  .mn-list table.stack tbody tr > td.mn-go-col{ grid-area: go; padding-top: 4px; }
  .mn-go{ flex: 1; }
  .mn-facts{ grid-template-columns: 1fr; }
  .mn-rowbtns{ flex-direction: column; align-items: stretch; width: 100%; }
}

/* chips on this page read as written: "Pending review", not "Pending Review" */
#mnRoot .ov-chip{ text-transform: none; }
@media (min-width: 640px){ .mn-list td.wrap{ min-width: 100px; } }
/* A narrow list drops what the case page also shows, so the table never scrolls sideways: payee and risk first, then the reasons. */
.mn-list{ container: mn-list / inline-size; }
@media (min-width: 640px){
  @container mn-list (max-width: 1039.98px){ .mn-list :is(.mn-c-payee, .mn-c-risk){ display: none; } }
  @container mn-list (max-width: 939.98px){ .mn-list .mn-c-why{ display: none; } }
}
@media (max-width: 639.98px){ .mn-list table.stack td.wrap{ flex-wrap: wrap; justify-content: flex-end; } .mn-list table.stack td.wrap::before{ flex-basis: 100%; max-width: none; } }

/* One held payout: the facts, the decision, then the evidence. On a wide screen the decision stays beside the other two. */
.mn-detail > .panel, .mn-evidence > .panel{ margin-bottom: var(--space-4); }
.mn-evidence{ min-width: 0; }
.mn-decide .actions{ display: flex; flex-wrap: wrap; gap: 8px; }
.mn-decide-sum{ margin: 0 0 var(--space-3); color: var(--ink-muted); }
.mn-todecide{ margin: 0 0 var(--space-3); }
@media (min-width: 1200px){
  .mn-detail.mn-two{ display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: var(--space-4); align-items: start; }
  .mn-two > .mn-summary, .mn-two > .mn-evidence{ grid-column: 1; }
  .mn-two > .mn-decide{ grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 88px; }
  .mn-two .mn-todecide{ display: none; }
}
.mn-mode-brief{ display: none; }
/* One record on a phone: the title is kept for screen readers, links and tabs step aside, and the mode shrinks to its chip. */
@media (max-width: 639.98px){
  #mnRoot.mn-record > .page-head{ position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #mnRoot.mn-record > :is(.related, #mnNav){ display: none; }
  .mn-record .mn-mode{ padding: 8px 12px; margin-bottom: var(--space-3); }
  .mn-record .mn-mode-full{ display: none; }
  .mn-record .mn-mode-brief{ display: inline; }
  .mn-record .mn-back{ margin-bottom: var(--space-2); }
  .mn-record .mn-amount{ margin: var(--space-2) 0; }
  #mnRoot .mn-summary .kv-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* On one held payout the standing explanation steps aside, so the amount and the time left start higher. */
#mnRoot:has(.mn-detail) .page-head p{ display: none; }

/* row actions side by side */
.mn-acts{ display: inline-flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; }
@media (max-width: 639.98px){ .mn-acts{ display: flex; width: 100%; } }

/* Three row buttons may wrap, so the queue stays a table on a small laptop (this outranks the one-line rule for row actions). */
.mn-list .table-wrap .mn-acts{ flex-wrap: wrap; white-space: normal; }
.mn-list .mn-acts .btn{ white-space: nowrap; }
/* stage buttons, search and pages line up with the rows inside the card */
.mn-list .table-card > :is(.tt-stages, .tt-bar, .tt-foot){ padding-left: 16px; padding-right: 16px; }

/* Open, Approved, Rejected, Expired */
.mn-bar{ margin-bottom: var(--space-4); }
.mn-bar > .field{ flex: 1 1 0; min-width: 132px; max-width: 170px; }
.mn-bar > .field.grow{ flex: 2 1 0; min-width: 120px; max-width: 320px; }
@media (max-width: 639.98px){ .mn-bar > .field{ flex: 1 1 130px; max-width: none; } .mn-bar > .field.grow{ flex-basis: 100%; max-width: none; } }
@media (min-width: 640px){ .mn-history td:not(.num){ white-space: normal; } .mn-history a.mn-case{ white-space: nowrap; } }

/* Held payouts of one customer: the action stays in reach while rows are ticked. */
.mc-bar{ position: sticky; bottom: var(--space-2); justify-content: flex-end; z-index: 2; }
.mc-bar:has(.btn:disabled){ position: static; } /* nothing ticked: it sits under the rows, over nothing */
.mc-bar .btn:not(:disabled){ box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
@media (max-width: 639.98px){ .mc-bar .btn{ width: 100%; white-space: normal; } }

/* Verdict and list forms. */
.mn-check{ display: flex; align-items: center; gap: 8px; min-height: 32px; margin: 0; }
.mn-check input{ width: auto; margin: 0; }
.mn-checks{ border: 0; padding: 0; margin: 0 0 var(--space-3); display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.mn-checks legend{ padding: 0; margin-bottom: 4px; font-weight: 600; }
