/*
 * The money lists (redesign 2026-11-12): Gifts received, Pledges and the
 * pledge's own page, Upcoming card charges, Cards on file, Unmatched gifts.
 * Loaded by AdminPanelProvider after the other page stylesheets and built on
 * the same --md-* roles (docs/DESIGN-M3.md) — never a hard-coded colour.
 * Hand-written, no build step. kl-* = lists.
 */

/* ---------- The top of a list: quick chips, and the line that says what is shown ---------- */
.kl-head { border-bottom: 1px solid var(--md-outline-variant); }
.kl-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px 0; }
.kl-chips__label { font: 500 13px/20px var(--md-font); color: var(--md-on-surface-variant); }
.kl-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--md-outline); background: transparent; color: var(--md-on-surface-variant);
  font: 500 14px/20px var(--md-font); white-space: nowrap;
}
.kl-chip:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.kl-chip[aria-pressed="true"] { border-color: transparent; background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.kl-chip__tick { display: none; width: 16px; height: 16px; }
.kl-chip[aria-pressed="true"] .kl-chip__tick { display: inline-block; }
.kl-sum { margin: 0; padding: 10px 16px 12px; font: 400 14px/20px var(--md-font); color: var(--md-on-surface-variant); display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
.kl-sum strong { font: 600 16px/24px var(--md-font); color: var(--md-on-surface); font-variant-numeric: tabular-nums; }

/* Money in a column: digits line up, and an amount is never broken or cut. */
.kl-money, .kl-money * { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* One description for a wide screen, another for a phone (the columns it stands in for are hidden there). */
.kl-narrow { display: none; }
@media (max-width: 767px) {
  .kl-wide { display: none; }
  .kl-narrow { display: inline; }
}

/* A flag inside a cell or a line: something to act on, or something that will not happen. */
.kl-flag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 1px 10px; border-radius: 9999px; white-space: nowrap;
  font: 600 12px/18px var(--md-font); background: var(--md-surface-container-highest); color: var(--md-on-surface-variant);
}
.kl-flag--bad { background: var(--md-error-container); color: var(--md-on-error-container); }
.kl-flag--wait { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.kl-flag--good { background: color-mix(in srgb, rgb(var(--success-600)) 14%, transparent); color: rgb(var(--success-700)); }
.dark .kl-flag--good { color: rgb(var(--success-400)); }
.kl-muted { color: var(--md-on-surface-variant); }
.kl-link { color: var(--md-primary); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.kl-link:hover { text-decoration-thickness: 2px; }

/* Tables on these pages: figures line up, the row buttons stay on one line, a long name wraps instead of pushing columns off. */
.kl-page .fi-ta-text-item-label { font-variant-numeric: tabular-nums; }
.kl-page .fi-ta-actions { gap: 12px; flex-wrap: nowrap; white-space: nowrap; }
.kl-name { max-width: 24rem; }
.kl-for { max-width: 18rem; }
@media (min-width: 768px) { .kl-name { min-width: 9.5rem; } .kl-for { min-width: 9rem; } }
/* A laptop: less air between the columns, so every one of them is on screen. */
@media (min-width: 768px) and (max-width: 1399px) {
  .kl-page .fi-ta-table .fi-ta-cell:not(:first-of-type) .fi-ta-text,
  .kl-page .fi-ta-table .fi-ta-header-cell:not(:first-of-type) { padding-inline: 8px; }
}
/* A record's own page, with menus beside a long heading: on a laptop the buttons go under the heading, each on one line. */
@media (min-width: 640px) and (max-width: 1535px) {
  .kl-record .fi-header { flex-direction: column; align-items: flex-start; }
}
.kl-page .fi-header .fi-btn { white-space: nowrap; }
@media (min-width: 1024px) { .kl-page:not(.kl-record) .fi-header .fi-ac { flex-wrap: nowrap; } }

/* A column that only fits a wide screen, and the line that stands in for it below that. */
.kl-below-wide { display: none; }
@media (max-width: 1399px) {
  .kl-from-wide { display: none; }
  .kl-below-wide { display: block; max-width: 8.5rem; white-space: normal; }
}

/* On a laptop a row's menu is its icon alone (the tooltip and the menu still say what it is), so the columns keep the width. */
@media (max-width: 1535px) {
  .kl-page .fi-ta-actions .fi-ac-link-group > span:not(.sr-only) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
  }
}
@media (max-width: 767px) {
  .kl-chips { flex-wrap: nowrap; overflow-x: auto; padding-inline: 12px; scrollbar-width: none; }
  .kl-chips::-webkit-scrollbar { display: none; }
  .kl-chips > * { flex: none; }
  .kl-sum { padding-inline: 12px; }
  .kl-page .fi-ta-actions .fi-link > span:not(.sr-only), .kl-page .fi-ta-actions .fi-btn > span.fi-btn-label { display: none; }
}

/* "Next payment" on the Pledges list: the date and amount on one line, the note under it may wrap. */
.kl-next { min-width: 7.5rem; max-width: 13rem; }

/* "How we got it": the words "Pledge card" show the scan of the card while the mouse is over them, and the small arrow downloads it
   (resources/views/filament/lists/pledge-sources.blade.php). The picture is placed by the view, clear of the table's own scroll box. */
.kl-peek { display: inline-flex; align-items: center; white-space: nowrap; }
.kl-peek__words { text-decoration: underline dotted; text-decoration-color: var(--md-outline); text-underline-offset: 3px; cursor: zoom-in; }
.kl-peek__get {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 9999px; cursor: pointer;
  color: var(--md-primary);
}
.kl-peek__words + .kl-peek__get { margin-inline-start: 2px; }
.kl-peek__get svg { width: 14px; height: 14px; }
.kl-peek__get:hover { background: color-mix(in srgb, var(--md-primary) 12%, transparent); }
.kl-peek__get:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 1px; }
.kl-peek__tip {
  position: fixed; z-index: 60; top: 0; left: 0; pointer-events: none; box-sizing: border-box;
  max-width: calc(100vw - 16px); padding: 8px; border-radius: 12px; white-space: normal;
  border: 1px solid var(--md-outline-variant); background: var(--md-surface-container-high); color: var(--md-on-surface);
  box-shadow: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);
}
.kl-peek__files { display: flex; gap: 8px; align-items: flex-start; }
.kl-peek__file { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kl-peek__file img { display: block; max-width: min(26rem, 44vw); max-height: min(30rem, 62vh); border-radius: 8px; background: #fff; }
.kl-peek__file img[hidden] { display: none; }
.kl-peek__file iframe { display: block; width: min(24rem, 44vw); height: min(30rem, 62vh); border: 0; border-radius: 8px; background: #fff; }
.kl-peek__name { max-width: min(26rem, 44vw); font: 400 12px/16px var(--md-font); color: var(--md-on-surface-variant); overflow-wrap: anywhere; text-align: start; }
.kl-peek__none { display: block; width: 14rem; padding: 12px; font: 400 13px/18px var(--md-font); color: var(--md-on-surface-variant); text-align: start; }
.kl-peek__none[hidden] { display: none; }

/* The same scan in plain sight: beside the boxes of "Change this pledge", and on the pledge's own page (pledge-card-scans.blade.php). */
.kl-scans { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.kl-scan { margin: 0; flex: 1 1 14rem; min-width: 0; max-width: 32rem; }
.kl-scan img { display: block; width: 100%; max-height: 26rem; object-fit: contain; object-position: left top; border-radius: 12px; border: 1px solid var(--md-outline-variant); background: #fff; cursor: zoom-in; }
.kl-scan iframe { display: block; width: 100%; height: 26rem; border: 1px solid var(--md-outline-variant); border-radius: 12px; background: #fff; }
.kl-scan figcaption { display: flex; align-items: center; gap: 4px; margin-top: 4px; font: 400 13px/20px var(--md-font); color: var(--md-on-surface-variant); }
.kl-scan__get { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 9999px; color: var(--md-primary); }
.kl-scan__get svg { width: 16px; height: 16px; }
.kl-scan__get:hover { background: color-mix(in srgb, var(--md-primary) 12%, transparent); }
.kl-scan__none { margin: 0; padding: 12px; border: 1px dashed var(--md-outline-variant); border-radius: 12px; font: 400 14px/20px var(--md-font); color: var(--md-on-surface-variant); }
.kl-scan__none[hidden], .kl-scan a[hidden] { display: none; }
.kl-facts li.kl-facts__scans { align-items: start; }
.kl-facts .kl-scan { max-width: 20rem; }
.kl-facts .kl-scan img { max-height: 14rem; }
.kl-facts .kl-scan iframe { height: 14rem; }

/* ---------- Shared pieces: a card, a section heading, a list of lines, a fold ---------- */
.kl-card {
  border: 1px solid var(--md-outline-variant); border-radius: 16px; background: var(--md-surface-container-low);
  padding: 20px 24px; font: 400 15px/22px var(--md-font); color: var(--md-on-surface);
}
.kl-h { margin: 0 0 8px; font: 500 18px/26px var(--md-font); color: var(--md-on-surface); }
.kl-h__count { font-weight: 400; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.kl-empty { margin: 0; color: var(--md-on-surface-variant); }
.kl-foot { margin: 8px 4px 0; font: 400 14px/20px var(--md-font); color: var(--md-on-surface-variant); }
.kl-rows { margin: 0; padding: 0; list-style: none; border: 1px solid var(--md-outline-variant); border-radius: 16px; overflow: hidden; background: var(--md-surface-container-low); }
.kl-row {
  display: grid; grid-template-columns: 9.5rem 7rem minmax(0, 1fr) auto; align-items: baseline; gap: 4px 16px;
  padding: 12px 20px; font: 400 15px/22px var(--md-font); color: var(--md-on-surface);
}
.kl-row + .kl-row { border-top: 1px solid var(--md-outline-variant); }
.kl-row__when { color: var(--md-on-surface-variant); white-space: nowrap; }
.kl-row__when--late { color: rgb(var(--danger-600)); font-weight: 500; }
.dark .kl-row__when--late { color: rgb(var(--danger-400)); }
.kl-row__amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: end; }
.kl-row__what { min-width: 0; overflow-wrap: anywhere; }
.kl-row__open { white-space: nowrap; }

.kl-fold { border: 1px solid var(--md-outline-variant); border-radius: 16px; background: var(--md-surface-container-low); scroll-margin-top: 5rem; }
.kl-fold__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 20px;
  border: 0; border-radius: 16px; background: transparent; color: var(--md-on-surface); font: 400 15px/22px var(--md-font); text-align: start; cursor: pointer;
}
.kl-fold__head:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.kl-fold__head strong { font-weight: 600; }
.kl-fold__icon { flex: none; width: 20px; height: 20px; color: var(--md-on-surface-variant); transition: transform 150ms cubic-bezier(.2, 0, 0, 1); }
.kl-fold__icon--open { transform: rotate(180deg); }
.kl-fold__body { padding: 4px 20px 20px; }
.kl-fold__lead { margin: 0 0 16px; max-width: 62rem; font: 400 14px/20px var(--md-font); }

/* ---------- The pledge's own page ---------- */
.kl-pledge { display: grid; grid-template-columns: fit-content(52%) minmax(0, 1fr); gap: 20px 48px; align-items: start; }
.kl-figures { margin: 0; display: flex; flex-wrap: wrap; gap: 12px 32px; }
.kl-figures dt { font: 500 13px/18px var(--md-font); color: var(--md-on-surface-variant); }
.kl-figures dd { margin: 0; font: 600 24px/32px var(--md-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kl-figures dd.kl-figures__sub { font: 400 13px/18px var(--md-font); color: var(--md-on-surface-variant); white-space: normal; max-width: 13rem; }
.kl-figures__owed { color: var(--md-primary); }
.kl-facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.kl-facts li { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 4px 12px; align-items: baseline; }
.kl-facts__label { font: 500 13px/22px var(--md-font); color: var(--md-on-surface-variant); }
.kl-notes { margin: 0; white-space: pre-line; overflow-wrap: anywhere; max-width: 70rem; }

@media (max-width: 1399px) {
  .kl-pledge { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  .kl-card { padding: 16px; }
  .kl-figures { gap: 12px 24px; }
  .kl-figures dd { font-size: 20px; line-height: 28px; }
  .kl-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .kl-row__what { grid-column: 1 / -1; }
  .kl-row__open { grid-column: 1 / -1; }
  .kl-fold__head, .kl-fold__body { padding-inline: 14px; }
  .kl-facts li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ---------- A note above a page, a bar of choices, a search box, a pager ---------- */
.kl-note { padding: 12px 16px; border-radius: 12px; font: 400 15px/22px var(--md-font); background: var(--md-surface-container-high); color: var(--md-on-surface); }
.kl-note--wait { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.kl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.kl-bar__group { display: flex; flex-wrap: wrap; gap: 8px; }
.kl-search {
  flex: 1 1 14rem; max-width: 22rem; display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 9999px;
  border: 1px solid var(--md-outline); background: var(--md-surface-container-lowest); color: var(--md-on-surface-variant);
}
.kl-search:focus-within { outline: 2px solid var(--md-primary); outline-offset: -1px; border-color: var(--md-primary); }
.kl-search__icon { flex: none; width: 18px; height: 18px; }
.kl-search input { flex: 1 1 auto; min-width: 0; border: 0; padding: 6px 0; background: transparent; color: var(--md-on-surface); font: 400 15px/22px var(--md-font); outline: none !important; box-shadow: none !important; }
.kl-sum--bare { padding: 0; }
.kl-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; font: 400 14px/20px var(--md-font); }
.kl-pager__nav { display: flex; align-items: center; gap: 8px; }
.kl-flag--wrap { white-space: normal; border-radius: 12px; }
.kl-link--quiet { color: inherit; font-weight: 400; text-decoration-color: var(--md-outline); }

/* ---------- Upcoming card charges ---------- */
.kl-run__headline { margin: 0; font: 400 20px/28px var(--md-font); }
.kl-run__headline strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.kl-run .kl-muted { margin: 4px 0 0; font: 400 14px/24px var(--md-font); }
.kl-day__head { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; }
.kl-day__label { font: 500 18px/26px var(--md-font); color: var(--md-on-surface); }
.kl-day__head--late .kl-day__label { color: rgb(var(--danger-600)); }
.dark .kl-day__head--late .kl-day__label { color: rgb(var(--danger-400)); }
.kl-day__sum { font: 400 15px/22px var(--md-font); color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.kl-day__hint { margin: -4px 0 8px; max-width: 62rem; font: 400 14px/20px var(--md-font); color: var(--md-on-surface-variant); }
.kl-charge {
  display: grid; grid-template-columns: minmax(9rem, 3fr) 6.5rem minmax(9rem, 4fr) minmax(10rem, 4fr) minmax(8rem, 2.5fr); align-items: baseline; gap: 4px 20px;
  padding: 12px 20px; font: 400 15px/22px var(--md-font); color: var(--md-on-surface);
}
.kl-charge + .kl-charge { border-top: 1px solid var(--md-outline-variant); }
.kl-charge__who { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.kl-charge__late { display: block; font: 500 13px/18px var(--md-font); color: rgb(var(--danger-600)); }
.dark .kl-charge__late { color: rgb(var(--danger-400)); }
.kl-charge__amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: end; }
.kl-charge__pledge, .kl-charge__card { min-width: 0; overflow-wrap: anywhere; }
.kl-charge__card .kl-link { margin-inline-start: 6px; white-space: nowrap; }
.kl-charge__text { font-size: 14px; }
@media (max-width: 1023px) {
  .kl-charge { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .kl-charge__pledge, .kl-charge__card, .kl-charge__text { grid-column: 1 / -1; }
  .kl-charge__text--none { display: none; }
  .kl-search { max-width: none; }
}

/* ---------- Unmatched gifts: progress, then the lines still to do ---------- */
.kl-progress__headline { margin: 0; font: 500 20px/28px var(--md-font); font-variant-numeric: tabular-nums; }
.kl-progress__headline strong { font-weight: 600; }
.kl-progress__how { margin: 12px 0 0; max-width: 62rem; font: 400 14px/20px var(--md-font); }
.kl-meter { height: 8px; margin-top: 12px; border-radius: 9999px; background: var(--md-surface-container-highest); overflow: hidden; }
.kl-meter > span { display: block; height: 100%; border-radius: 9999px; background: var(--md-primary); }
.kl-what { min-width: 12rem; max-width: 46rem; }
/* The amount under the sender on a phone, where the Amount column is not shown (the row's pinned buttons covered it). */
.kl-amount { font: 600 16px/24px var(--md-font); color: var(--md-on-surface); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Which bank account a deposit landed in, and the list of the feed's accounts. */
.kl-into { font-weight: 500; color: var(--md-on-surface); }
.kl-feed__lead { margin: 0; max-width: 62rem; font: 400 14px/20px var(--md-font); }
.kl-feed__list { margin: 12px 0 0; padding: 0; list-style: none; }
.kl-feed__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 48px; padding: 8px 0; }
.kl-feed__row + .kl-feed__row { border-top: 1px solid var(--md-outline-variant); }
.kl-feed__what { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kl-feed__what strong { font-weight: 600; }
.kl-feed__do { flex: none; }
.kl-worklist .fi-ta-actions { gap: 16px; }
@media (max-width: 767px) {
  .kl-what { min-width: 0; overflow-wrap: anywhere; }
  .kl-narrow.kl-amount { display: block; }
  /* Both buttons keep their words on a phone: they stand on their own line under the deposit (below). */
  .kl-page .kl-worklist .fi-ta-actions .fi-btn > span.fi-btn-label,
  .kl-page .kl-worklist .fi-ta-actions .fi-link > span:not(.sr-only) { display: inline; }
}
/* A deposit becomes two lines on a phone: what came in, then its buttons (as on the Books and grant lists).
   Beside the pinned buttons the sender had a third of the screen, and on a small phone lay under them. */
@media (max-width: 639px) {
  .kl-worklist .fi-ta-table, .kl-worklist .fi-ta-table :is(thead, tbody) { display: block; }
  .kl-worklist .fi-ta-table tbody tr.fi-ta-row { display: flex; flex-wrap: wrap; align-items: center; }
  .kl-worklist .fi-ta-table thead tr { display: flex; align-items: center; }
  /* The sender is the one column a phone shows: it takes the whole line, so the buttons start the next one. */
  .kl-worklist .fi-ta-table :is(tbody tr.fi-ta-row > td.fi-ta-cell[class*="fi-table-cell-"], thead tr > th[class*="fi-table-header-cell-"]) { flex: 1 0 100%; min-width: 0; box-sizing: border-box; text-align: start; }
  .kl-worklist .fi-ta-table thead tr > th.fi-ta-actions-header-cell { display: none; } /* empty; beside a full-width heading it made the table 2px too wide */
  .kl-worklist .fi-ta-table tbody tr.fi-ta-row > td.fi-ta-actions-cell { flex: 1 0 100%; }
  .kl-worklist .fi-ta-table tbody tr.fi-ta-row > td.fi-ta-actions-cell > div { padding-top: 0; padding-bottom: 12px; justify-content: flex-start; white-space: normal; }
  .kl-page .kl-worklist .fi-ta-table tbody tr.fi-ta-row > td.fi-ta-actions-cell .fi-ta-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px 16px; white-space: normal; }
  .kl-what { max-width: none; }
}
