/* Keystone · Financial Crime: what the working pages add to the canvas look. Interaction only. */

/* the canvas's invented example stays hidden while the real verdicts load */
html.kf-wait .k-app__col,
html.kf-wait .k-app__aside > section,
html.kf-wait .kq-list,
html.kf-wait .k-approve,
html.kf-wait .aq-inst .k-occ,
html.kf-wait .ks-fit > div > div:nth-child(2) { visibility: hidden; }

/* queue rows and institutions open and switch */
a.kq-row { color: inherit; text-decoration: none; border-radius: var(--radius-md, 10px); }
a.kq-row:hover b { text-decoration: underline; text-underline-offset: 3px; }
a.kq-row:focus-visible, .aq-inst:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.aq-inst { cursor: pointer; }
.kq-done { color: var(--ink-3); }
.k-ticket__msg [contenteditable="true"] { display: block; outline: 1px solid var(--line); outline-offset: 4px; border-radius: 4px; }

/* institution menu in the case view */
.kf-menu { position: absolute; z-index: 30; min-width: 200px; padding: 6px; border-radius: var(--radius-md, 10px);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline), 0 12px 32px rgba(0, 0, 0, .28); }
.kf-menu button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.kf-menu button:hover, .kf-menu button[aria-current="true"] { background: var(--ground-2); }

/* records in the conversation */
.kf-recs { display: flex; flex-direction: column; gap: 6px; }
.kf-recs .k-event { margin: 0; }

/* the case view: back to the queue, and the analyst's decision above the message box */
.kf-back { flex: none; }
@media (min-width: 761px) { .k-app__head .kf-back { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); } }
.kf-decide { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: var(--radius-lg, 16px); }
.kf-decide [data-k-bot] { --size: 28px; flex: none; }
.kf-decide .k-approve__actions { flex: 1; justify-content: flex-end; gap: 6px; }
.kf-decide .k-approve__actions .k-chip { margin-right: auto; }
.kf-decide .k-approve__actions .k-btn--primary { margin-left: 4px; }
.kf-decide a.k-btn--primary, .kf-decide a.k-btn--primary:hover { color: var(--on-primary); }
.kf-decide.is-busy { pointer-events: none; }
@media (max-width: 560px) {
  .kf-decide { align-items: flex-start; }
  .kf-decide .k-approve__actions { flex-wrap: wrap; }
  .kf-decide .k-approve__actions .k-btn--primary { flex: 1 0 100%; margin-left: 0; order: -1; }
}

/* the case view's question buttons, above the decision */
.kf-asks { margin-bottom: 2px; }

/* plain words before codes: the reason in words leads, the code follows quietly with the brief's
   description on hover */
.kf-code { cursor: help; }
.kw-verdict .kf-what { font-weight: 500; font-size: 15px; color: var(--ink); }
.kw-verdict .kf-code { margin-left: auto; font-size: 11px; color: var(--ink-3); }

/* the queue: each institution's real split, with its counts beside the bar */
.aq-inst .kf-left { display: block; margin-top: 2px; }
.aq-inst .kf-split i { min-width: 2px; }
.aq-inst .kf-n { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.aq-inst .kf-n i { margin-right: 3px; font-style: normal; font-weight: 600; }
.aq-inst .kf-n .ok { color: var(--ok); }
.aq-inst .kf-n .ask { color: var(--ask); }
.aq-inst .kf-n .bad { color: var(--bad); }
.kf-filter { flex: none; }
.kf-filter button { white-space: nowrap; }
.kf-empty { padding: 18px 0 6px; }
.kf-pager { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.kf-pager:empty { display: none; }
.kf-pager p { margin: 0; }
.kf-pager__btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.kf-pager .k-btn { min-width: 36px; padding-left: 8px; padding-right: 8px; }
.kf-pager__gap { padding: 0 2px; color: var(--ink-3); }
@media (max-width: 560px) {
  .aq-inst { grid-template-columns: minmax(0, 1fr) auto !important; }
  .aq-inst .kf-split { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .kf-filter { flex: 1 1 100%; order: 2; }
  .kf-filter button { flex: 1; padding: 0 6px; }
}

/* queue rows: the reason in words leads, the system's sentence follows in a quieter tone, and the
   case facts sit underneath as small tags; the verdict stays on the right */
.kq-row { align-items: start; }
.kq-main { display: block; min-width: 0; }
.kq-main > b { display: block; font-size: 15.5px; line-height: 1.3; }
.kq-main .kq-line { margin-top: 3px; font-size: 13px; line-height: 1.45; }
.kq-main .kq-line .b { color: var(--ink-3); }
.kq-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.kq-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-3); font-size: 11.5px; line-height: 1; white-space: nowrap; }
.kq-tag--id { background: transparent; box-shadow: inset 0 0 0 1px var(--line); font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.kq-tag--done { background: var(--info-soft, var(--surface-3)); color: var(--ink); }
.kq-end { padding-top: 1px; }

/* after the first visit in a tab, queue rows arrive still: the verdict and the reason, no reading */
.kq-list.kf-still .kw-r, .kq-list.kf-still .kq-end, .kq-list.kf-still .kq-line .b, .kq-list.kf-still .kw-swap .k-mk { opacity: 1; animation: none; }
.kq-list.kf-still .kq-line .q, .kq-list.kf-still .kq-line .a, .kq-list.kf-still .kw-dots { opacity: 0; animation: none; }

/* Case Lead's reply on the phone */
.kf-reply { margin: 0 0 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.kf-reply b { color: var(--ink); }

/* the case view: a one-line summary, then the SOP's checks as a table, each marked passed, failed or
   not reached, with the reason's own sentences beside the check they belong to */
.kf-sum { margin-top: 8px; }
.kf-tally { display: inline-block; margin-left: 4px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kf-checks { margin-top: 12px; }
.kf-checks .k-table th[scope="row"] { text-align: left; font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); white-space: normal; border-bottom: 1px solid var(--line); vertical-align: top; }
.kf-checks .k-table th[scope="row"] b { font-weight: 500; }
.kf-checks .k-table tr:last-child th { border-bottom: 0; }
.kf-checks .k-table td { vertical-align: top; }
.kf-checks .k-table td:first-child { white-space: normal; }
.kf-ck__res { font-size: 13.5px; color: var(--ink); }
.kf-ck__in { display: flex; align-items: flex-start; gap: 8px; }
.kf-ck__in > span:last-child { padding-top: 1px; }
.kf-ck--ok .kf-ck__res { color: var(--ok); }
.kf-ck--bad .kf-ck__res { color: var(--bad); }
.kf-ck--off .kf-ck__res { color: var(--ink-3); }
.kf-ck--bad td, .kf-ck--bad th { background: var(--bad-soft); }
.kf-ck--verdict td, .kf-ck--verdict th { background: var(--ground-2); }
.kf-mk--off { background: var(--surface-2); color: var(--ink-3); }
.kf-ck__facts { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.kf-ck__facts p { margin: 0; }
.kf-ck__facts p + p { margin-top: 6px; }
.kf-ck__none { color: var(--ink-3); }
@media (min-width: 761px) {
  .kf-checks .k-table th[scope="row"] { width: 30%; }
  .kf-checks .kf-ck__res { width: 22%; }
}
@media (max-width: 760px) {
  .kf-checks .k-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .kf-checks .k-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
  .kf-checks .k-table tr:last-child { border-bottom: 0; }
  .kf-checks .k-table th[scope="row"], .kf-checks .k-table td { display: block; border-bottom: 0; padding: 10px 12px 0; }
  .kf-checks .k-table .kf-ck__res { text-align: right; }
  .kf-checks .kf-ck__in { justify-content: flex-end; }
  .kf-checks .k-table .kf-ck__facts { grid-column: 1 / -1; padding-bottom: 10px; }
}

/* the reason as numbered steps: one sentence a step, in the system's own order and words, with the
   records each sentence names beside it as citation chips */
.kf-steps { list-style: none; margin: 0; padding: 0; counter-reset: kf-step; display: grid; gap: 10px; }
.kf-steps > li { position: relative; min-width: 0; padding-left: 32px; counter-increment: kf-step; overflow-wrap: anywhere; }
.kf-steps > li::before, .kf-stepn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; line-height: 1; }
.kf-steps > li::before { content: counter(kf-step); position: absolute; left: 0; top: 1px; }
.kf-steps__ids { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 2px; vertical-align: middle; }
.kf-steps__ids .k-cite { vertical-align: 0; }
.kf-steps > li.kf-steps__more { counter-increment: none; color: var(--ink-3); font-size: .92em; }
.kf-steps > li.kf-steps__more::before { content: none; }
.k-doc .kf-steps { gap: 8px; }
.k-doc .kf-steps > li { padding-left: 30px; }
/* an evidence card: the step of the reason that cites this record */
.kf-cited { position: relative; padding-left: 30px; }
.kf-cited .kf-stepn { position: absolute; left: 0; top: 0; }
.k-doc .kf-steps > li::before { top: 0; }
/* on the phone: the first steps, each held to three lines, the records under it */
.kf-steps--compact { gap: 8px; margin-top: 2px; font-size: 14px; line-height: 1.45; }
.kf-steps--compact > li { padding-left: 30px; }
.kf-steps--compact > li::before { top: -1px; }
.kf-steps--compact .kf-steps__t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.kf-steps--compact .kf-steps__ids { display: flex; margin: 4px 0 0; }
.kf-steps--compact .kf-steps__more a { color: var(--ink-2); }
/* the landing's example reason keeps its box */
.kl-reason.kf-steps { padding: 16px 18px; gap: 10px; }
.kl-open { display: inline-block; margin-left: 4px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.kl-open:hover { color: var(--ink-2); }
.kl-open[hidden] { display: none; }

/* queue rows: the checks behind the verdict as a strip of cells, each with its mark and result */
.kq-checks { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 10px;
  border-radius: var(--radius-sm); overflow: hidden; background: var(--line); box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0; animation: kw-in .4s var(--ease-out) forwards; animation-delay: var(--m, 1s); }
.kq-ck { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: var(--surface); min-width: 0; }
.kq-ck__name { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.kq-ck__res { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.3; color: var(--ink); }
.kq-ck--ok .kq-ck__res { color: var(--ok); }
.kq-ck--bad { background: linear-gradient(var(--bad-soft), var(--bad-soft)), var(--surface); }
.kq-ck--bad .kq-ck__res { color: var(--bad); }
.kq-ck--off .kq-ck__res { color: var(--ink-3); }
.kq-list.kf-still .kq-checks { opacity: 1; animation: none; }
