/* Verification, KYC providers and Fraud check switch: everything added for the UX audit.
   Uses the tokens in styles.css only. */

[hidden].kyc-bar, .kyc-view [hidden], .kyc-menu[hidden]{ display: none !important; }

/* ---- an error that stays beside its field ---- */
.field-error{ margin: 0; font-size: 13px; line-height: 18px; color: var(--critical); }
.field-error:empty{ display: none; }
.kyc-pick .field-error{ flex-basis: 100%; }
input[aria-invalid="true"], textarea[aria-invalid="true"]{ border-color: var(--critical); box-shadow: inset 0 0 0 1px var(--critical); }

/* ---- a customer's name is the one link into their page ---- */
.kyc-name{ display: inline-block; padding: 4px 0; font-weight: 500; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.kyc-name:hover{ text-decoration: underline; text-underline-offset: 3px; }
.kyc-name:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---- tick boxes: a bigger target for a finger ---- */
.kyc-tick{ display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; cursor: pointer; }
.kyc-tick input{ width: 18px; height: 18px; margin: 0; }
@media (pointer: coarse){
  .kyc-tick{ min-width: 44px; min-height: 44px; }
  .kyc-tick input{ width: 22px; height: 22px; }
  .kyc-pick label{ min-height: 44px; }
  .kyc-keys{ display: none; }
}
.kyc-q tr.is-picked td{ background: var(--sel); }

/* ---- the waiting list: filters, the select menu, and the bar that follows the selection ---- */
.kyc-lookup summary{ cursor: pointer; padding-top: 10px; font-size: 13.5px; color: var(--ink-muted); }
.kyc-lookup[open] summary{ margin-bottom: 10px; }
.kyc-toolbar{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.kyc-selnote{ margin: 6px 0 0; }
.kyc-selnote:empty{ display: none; }
.kyc-menu{ position: relative; }
.kyc-menu > summary{ list-style: none; cursor: pointer; }
.kyc-menu > summary::-webkit-details-marker{ display: none; }
.kyc-menu-list{ position: absolute; right: 0; z-index: 15; min-width: 250px; margin-top: 6px; padding: 6px; display: flex; flex-direction: column; align-items: stretch; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.kyc-menu-list .btn, .kyc-view-act .btn.ghost{ justify-content: flex-start; border-color: transparent; background: none; text-align: left; }
.kyc-menu-list .btn:hover, .kyc-view-act .btn.ghost:hover{ background: var(--hover); }

.kyc-bar{ position: sticky; bottom: 12px; z-index: 30; margin-top: 12px; }
.kyc-bar-in{ display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.kyc-bar-in strong{ margin-right: auto; font-weight: 500; }

/* ---- the confirm box: who is in the run ---- */
.kyc-who{ list-style: none; margin: 12px 0; padding: 0; max-height: 220px; overflow: auto; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.kyc-who li{ display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kyc-who li:last-child{ border-bottom: 0; }
.kyc-who:focus-visible{ outline: 2px solid var(--focus); outline-offset: 2px; }
.kyc-who-name{ font-weight: 500; }
.kyc-who-flag{ background: var(--warning-bg); }

/* ---- a run in progress, and the results of earlier runs ---- */
.kyc-progress-head{ display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.kyc-progress progress{ display: block; width: 100%; height: 10px; accent-color: var(--cta); }
.kyc-progress .ov-sub{ margin-top: 8px; }
.kyc-run:focus{ outline: none; }

/* ---- a document's decision (a group of radio buttons under its own legend) ---- */
fieldset.kyc-pick{ min-width: 0; margin: 6px 0 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); }

/* ---- the document viewer ---- */
.kyc-view-act kbd, .kyc-keys kbd{ font: inherit; font-size: 11px; line-height: 1; padding: 2px 6px; margin-left: 4px; border: 1px solid currentColor; border-radius: 6px; opacity: .7; }
.kyc-keys{ margin: 12px 0 0; }

/* ---- lists of facts, on the KYC providers and Fraud check switch pages ---- */
.kp-statelist{ display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px 16px; margin: 8px 0 0; }
.kp-statelist div{ margin: 0; min-width: 0; }
.kp-statelist dt{ font-size: 12.5px; color: var(--ink-muted); }
.kp-statelist dd{ margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--ink); overflow-wrap: anywhere; }
.fs-note{ margin: 0 0 16px; }

/* before and after, in a confirm box */
.modal-card .kp-ba{ max-height: 240px; overflow: auto; margin: 12px 0; }
.kp-ba td, .kp-ba th{ white-space: normal; overflow-wrap: anywhere; }

/* ---- under 640px: the waiting list is a stack of labelled cards, like the KYC events ---- */
@media (max-width: 639.98px){
  .kyc-q.table-wrap{ overflow: visible; }
  .kyc-q thead{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .kyc-q table, .kyc-q tbody, .kyc-q tr, .kyc-q td{ display: block; }
  .kyc-q tr{ padding: 12px 18px; border-bottom: 1px solid var(--line); }
  .kyc-q tbody tr:last-child{ border-bottom: 0; }
  /* The shared phone stacking in styles.css also tags this table (.stack), and its td rule is more specific than ours: match it. */
  .kyc-q td, .kyc-q table.stack td, .kyc-q table.stack td:first-child, .kyc-q table.stack td:last-child{ display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 0 10px; height: auto; padding: 3px 0 !important; border: 0; align-items: baseline; justify-content: stretch; text-align: left; }
  .kyc-q table.stack td::before{ max-width: none; font-size: 12.5px; line-height: inherit; color: var(--ink-muted); }
  .kyc-q table.stack tr{ padding: 12px 18px; }
  .kyc-q td::before{ content: attr(data-label); color: var(--ink-muted); font-size: 12.5px; }
  .kyc-q td:empty, .kyc-q table.stack td:empty{ display: none; }
  .kyc-q td > *{ grid-column: 2; }
  .kyc-q td .ov-chip{ justify-self: start; max-width: 100%; white-space: normal; }
  .kyc-q td[data-label="Select"]{ align-items: center; }
  .kyc-q tbody tr:hover td{ background: none; }
  .kyc-q tr.is-picked{ background: var(--sel); }
  .kyc-q tr.is-picked td{ background: none; }
  /* the bar sticks to the bottom of the screen with the count and the action */
  .kyc-bar{ position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
  .kyc-bar-in{ border-radius: var(--radius) var(--radius) 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .kyc-bar-in strong{ flex-basis: 100%; }
  .kyc-bar-in .btn{ flex: 1; }
  .view:has(.kyc-bar:not([hidden])){ padding-bottom: 120px; }
  .kyc-menu-list{ position: fixed; left: 16px; right: 16px; bottom: 16px; min-width: 0; }
  .kyc-who{ max-height: 40vh; }
}

/* Order is a choice of sort, not a filter: it sits beside the count, outside the collapsible filters. */
.kyc-order { display: inline-flex; margin-left: auto; }
.kyc-order .field { margin: 0; display: flex; flex-direction: row; align-items: center; gap: 8px; }
.kyc-order .field label { margin: 0; font-size: 12px; white-space: nowrap; }
.kyc-order .field select { min-height: 36px; }
@media (max-width: 640px) { .kyc-order .field select { min-height: 44px; } }

/* A Clear filters button stays hidden until a filter is active (the .btn display would otherwise win). */
.filters-collapsible [hidden] { display: none !important; }

/* ================= visual-audit pass ================= */

/* ---- a list of facts with row headers (the shared .ov-kv only has cells) ---- */
.kyc-kv th{ height: auto; padding: 12px 14px; background: none; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; font-weight: 400; color: var(--ink-muted); white-space: normal; overflow-wrap: anywhere; vertical-align: middle; width: 42%; padding-left: 24px; }
.kyc-kv tbody tr:last-child th{ border-bottom: 0; }
.panel > .kyc-kv th, .panel-tight .kyc-kv th{ padding-left: 0; }
.panel-tight .kyc-kv th{ padding-top: 7px; padding-bottom: 7px; width: 55%; }
.modal-card .kyc-kv th{ padding: 6px 12px 6px 0; width: 38%; }

/* ---- the waiting list and all customers: a long name wraps instead of pushing the last column off screen ---- */
.kyc-q td[data-label="Customer"], #kycCust td:first-child{ white-space: normal; min-width: 13em; max-width: 24em; }
.kyc-q td[data-label="Documents"] .wrap-cell{ min-width: 9em; }

/* ---- a customer's page: the three checks sit side by side so the documents are not pushed off the first screen ---- */
.kyc-checks{ display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px 16px; align-items: start; margin-top: 12px; }
.kyc-check{ min-width: 0; }
.kyc-check > h4{ margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.kyc-check .kyc-verdict{ margin-bottom: 8px; }
.kyc-check .table-wrap{ margin-top: 4px; }
.kyc-cases > summary, .kyc-about > summary{ cursor: pointer; padding: 6px 0; font-size: 13.5px; color: var(--ink-muted); }
.kyc-same{ list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.kyc-same li{ display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kyc-same li:last-child{ border-bottom: 0; }
.kyc-same .row-action-btn{ font-weight: 500; }

/* radio buttons for a document's decision: the whole label is the target */
.kyc-pick label{ min-height: 28px; padding: 2px 0; }

/* ---- the document viewer: the buttons stay in reach when a reason box opens ---- */
.modal-card .kyc-view-stage{ height: min(46vh, 560px); }
.kyc-view > .btn-row{ position: sticky; bottom: -18px; z-index: 2; margin: 12px 0 -18px; padding: 12px 0 18px; background: var(--surface); }

/* ---- sign-up verdicts: filters wide enough to read, toolbar in two plain rows ---- */
.kyc-vfilters > .field{ flex: 1 1 190px; max-width: 300px; }
.kyc-vbar{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 8px; }
.kyc-vpage{ display: inline-flex; gap: 8px; }
.kyc-vtools{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.kyc-vtools .ov-sub{ margin-right: auto; }
@media (max-width: 639.98px){
  .kyc-vtools .btn, .kyc-vpage .btn{ flex: 1 1 auto; min-height: 44px; }
}

/* ---- KYC providers, Insights: provider comparison reads in one line per measure ---- */
.kp-top{ grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); }
.kp-cmp .kp-note{ display: block; margin: 0 0 0 16px; }
.kp-cmp tbody th{ vertical-align: top; }
.kp-cmp .kp-num{ vertical-align: top; }
@media (max-width: 899.98px){ .kp-top{ grid-template-columns: minmax(0, 1fr); } }

/* ---- Fraud check switch ---- */
.fs-ready{ margin: 0 0 4px; }
.fs-ready dd strong{ font-size: 20px; font-weight: 500; }
.kp-details > summary{ padding: 8px 0; min-height: 32px; cursor: pointer; }

/* ---- KYC events and insights filters: the period presets, then one row of labelled fields ---- */
.kp-toolbar{ flex-direction: column; align-items: stretch; gap: 12px; }
.kp-toolbar > .kp-presets{ align-self: flex-start; }
.kp-fieldrow{ display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 20px; }
.kp-fieldrow > .kp-dates{ padding-left: 0; border-left: 0; }
.kp-fieldrow > .kp-selects{ margin-left: 0; }
@media (max-width: 759px){
  .kp-toolbar > .kp-presets{ align-self: stretch; }
  .kp-fieldrow{ flex-direction: column; align-items: stretch; }
  .kp-fieldrow > .kp-dates{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kp-dates > .btn{ grid-column: 1 / -1; }
  .kp-fieldrow > .kp-selects{ display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}
#kycUpFile{ min-height: 40px; padding: 8px; }

/* ---- phone: fewer pixels spent on numbers, bigger targets in the cards ---- */
@media (max-width: 639.98px){
  #kycKpis .kpi-meta{ display: none; }
  #kycKpis .kpi{ padding-top: 12px; padding-bottom: 12px; }
  .kyc-name{ padding: 12px 0; }
  .kyc-lookup summary{ min-height: 44px; display: flex; align-items: center; }
  .kyc-q table.stack td:has(> .kyc-tick), .kyc-q td:has(> .kyc-tick){ display: block !important; padding: 0 !important; }
  .kyc-q table.stack td:has(> .kyc-tick)::before, .kyc-q td:has(> .kyc-tick)::before{ display: none !important; }
  .kyc-q td > .kyc-tick{ justify-content: flex-start; gap: 8px; min-width: 0; grid-column: auto; }
  .kyc-q td > .kyc-tick::after{ content: "Select"; font-size: 13px; color: var(--ink-muted); }
  .kyc-who-name{ padding: 2px 0; }
  .kyc-view .kyc-view-act .btn, .kyc-view-quick .btn{ min-height: 44px; }
  .kyc-menu-list .btn{ min-height: 44px; }
}
/* verdict buttons carry a long label: let it wrap rather than push the page wide */
#kycVCards .btn[data-v]{ height: auto; min-height: 36px; max-width: 100%; white-space: normal; text-align: left; }
#kycVCards .btn[data-v] .ov-chip{ white-space: normal; max-width: 100%; }

/* ---- the lead's pending declines: a banner at the top, the list under the queue ---- */
.kyc-banner-slot:empty{ display: none; }
.kyc-banner{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; font-size: 14px; font-weight: 500; }
.kyc-banner b{ font-variant-numeric: tabular-nums; }
.kyc-m-line{ display: none; }
#kycConfirm .panel{ margin-top: var(--space-4); }
@media (max-width: 639.98px){
  /* a waiting row is three lines: the name and its warning, one muted line, the tick box */
  .kyc-q tbody tr{ display: flex; flex-direction: column; padding: 10px 14px; }
  .kyc-q td[data-label="Customer"], .kyc-q table.stack td[data-label="Customer"]{ order: 1; display: flex !important; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; max-width: none; padding: 0 !important; }
  .kyc-q td[data-label="Customer"]::before{ display: none; }
  .kyc-q td[data-label="Customer"] > *{ grid-column: auto; }
  .kyc-q .kyc-name{ padding: 0; font-size: 14px; font-weight: 500; }
  .kyc-q td[data-label="Customer"] .sub-line, .kyc-q td[data-label="Customer"] .kyc-shared{ display: none; }
  .kyc-q .kyc-m-line{ display: block; flex-basis: 100%; font-variant-numeric: tabular-nums; font-size: 12px; line-height: 18px; color: var(--ink-muted); }
  .kyc-q td.kc-x, .kyc-q table.stack td.kc-x{ display: none !important; }
  .kyc-q td.kc-sel, .kyc-q table.stack td.kc-sel{ order: 2; }
  .kyc-q td > .kyc-tick{ min-height: 44px; }
}

/* The document and the profile it is checked against, side by side. */
.kyc-view-main{ min-width: 0; }
.kyc-view-facts > summary{ cursor: pointer; padding: 6px 0; font-size: 13.5px; color: var(--ink-muted); }
.kyc-view-facts h3{ font-size: 14px; }
@media (min-width: 900px){
  .kyc-view-two{ display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
  .kyc-view-two .kyc-view-facts{ max-height: min(46vh, 560px); overflow: auto; }
  .kyc-view-two .kyc-view-facts > summary{ display: none; }
}
@media (max-width: 640px){
  .kyc-view > .btn-row{ flex-direction: row; flex-wrap: nowrap; }
  .kyc-view > .btn-row .btn{ flex: 1; min-width: 0; width: auto; }
}

/* Sign-up verdicts: verdict chips are the filter; the table keeps six columns and lets chips wrap. */
.kyc-vchips{ display: flex; flex-wrap: wrap; gap: 8px; }
.kyc-vchip{ display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.kyc-vchip:hover{ background: var(--surface-2); }
.kyc-vchip[aria-pressed="true"]{ border-color: var(--brand, currentColor); background: var(--surface-2); }
.kyc-vchip-all{ padding: 2px 8px; font-weight: 600; }
.kyc-vchip-n{ font-variant-numeric: tabular-nums; font-weight: 600; }
.kyc-vfilters{ align-items: flex-end; }
.kyc-vfilters > .field{ flex: 1 1 160px; max-width: 240px; }
.kyc-vtable td{ vertical-align: top; }
.kyc-vtable .ov-chip{ white-space: normal; max-width: 100%; }
.kyc-vtable .sub-line{ display: block; }
.kyc-tick-off{ display: inline-block; width: 18px; }
.kyc-vfilters > .field:first-child{ flex: 1.6 1 240px; max-width: 320px; }

/* Re-verification: the three actions side by side, stacked on narrow screens. */
.kyc-rv-acts{ display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.kyc-rv-act{ display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.kyc-rv-act[hidden]{ display: none; }
.kyc-rv-act h4{ margin: 0; }
.kyc-rv-act .filter-row{ margin: 0; }
.kyc-rv-act .filter-row > .field{ flex: 1 1 120px; }
.kyc-rv-act .hint{ margin: 0; }
