/* =========================================================
   Credit card statements: the show page (Views/CreditCardStatement/show.php + partials/details.php, entry_row.php;
   behaviour in js/creditcard-show.js) and the new / edit form (form.php; js/creditcard-form.js). Page grid, cards
   and the header are the ones of show-page.css and expense-form.css; this file adds the fm-cc-* parts. Only theme
   tokens (theme.css) and Bootstrap variables, so the light and the dark theme both work. Loaded by
   layouts/default.php before theme.css.
   ========================================================= */

.fm-pill-warn { padding: .15rem .55rem; border-radius: 999px; background: var(--fm-warn-soft); color: var(--fm-warn-text); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.fm-ccshow .fm-xshow-title { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }

/* ---------- header tile: the card type's logo ---------- */
.fm-cc-tile { width: 4.5rem; height: 3rem; border-radius: .6rem; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--fm-brand-soft); color: var(--fm-brand-text); font-size: 1.6rem; overflow: hidden; border: 1px solid var(--fm-line); }
.fm-cc-tile img { max-width: 85%; max-height: 80%; object-fit: contain; }
.fm-cc-tile-sm { width: 2.4rem; height: 1.6rem; border-radius: .35rem; font-size: .95rem; }

/* ---------- entries: filter ---------- */
.fm-cc-entries-head { flex-wrap: wrap; }
.fm-cc-seg { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .2rem; border-radius: 999px; background: var(--fm-canvas); border: 1px solid var(--fm-line); }
.fm-cc-seg-btn { border: 0; background: transparent; color: var(--fm-muted); border-radius: 999px; padding: .3rem .75rem; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; min-height: 2.25rem; }
.fm-cc-seg-btn:hover { color: var(--fm-ink); }
.fm-cc-seg-btn[aria-pressed="true"] { background: var(--fm-surface); color: var(--fm-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.fm-cc-seg-btn:focus-visible { outline: 2px solid var(--fm-brand); outline-offset: 1px; }

/* ---------- entries: rows ---------- */
.fm-cc-list { list-style: none; margin: 0; padding: 0; }
.fm-cc-row { padding: .8rem 1.25rem; border-bottom: 1px solid var(--fm-line); display: flex; flex-direction: column; gap: .5rem; }
.fm-cc-row:last-child { border-bottom: 0; }
.fm-cc-row[hidden] { display: none; }
.fm-cc-r1 { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.fm-cc-date { width: 2.75rem; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.05; padding: .3rem 0; border-radius: .6rem; background: var(--fm-canvas); border: 1px solid var(--fm-line); }
.fm-cc-dd { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.fm-cc-mm { font-size: .68rem; text-transform: uppercase; color: var(--fm-muted); letter-spacing: .04em; }
.fm-cc-desc { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.fm-cc-raw { font-family: var(--bs-font-monospace); font-size: .82rem; overflow-wrap: anywhere; }
.fm-cc-meta { font-size: .75rem; color: var(--fm-muted); }
.fm-cc-amount { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fm-cc-box { display: flex; align-items: center; gap: .5rem; margin-left: 3.6rem; padding: .4rem .7rem; border-radius: var(--fm-radius-control); font-size: .82rem; border: 1px dashed var(--fm-line); color: var(--fm-muted); }
.fm-cc-box a { font-weight: 600; }
.fm-cc-st { width: .55rem; height: .55rem; border-radius: 50%; flex: none; background: var(--fm-muted); }
.fm-cc-box-matched, .fm-cc-box-created { border-style: solid; border-color: transparent; background: var(--fm-income-soft); color: var(--fm-ink); }
.fm-cc-box-matched .fm-cc-st, .fm-cc-box-created .fm-cc-st { background: var(--fm-income); }
.fm-cc-box-suggested { border-style: solid; border-color: transparent; background: var(--fm-warn-soft); color: var(--fm-ink); }
.fm-cc-box-suggested .fm-cc-st { background: var(--fm-warn-text); }
.fm-cc-box-ignored { background: transparent; }
.fm-cc-box-unmatched .fm-cc-st { background: var(--fm-alert); }
@media (max-width: 575.98px) {
  .fm-cc-row { padding: .75rem 1rem; }
  .fm-cc-box { margin-left: 0; }
}

.fm-cc-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 2.5rem 1.25rem; }
.fm-cc-bar { display: flex; align-items: center; gap: .5rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--fm-line); font-size: .9rem; }
.fm-cc-bar-ok { background: var(--fm-income-soft); color: var(--fm-ink); }
.fm-cc-bar-ok .bi { color: var(--fm-income-text); }

/* ---------- reconciliation ---------- */
.fm-cc-prog { display: flex; height: .6rem; border-radius: 999px; overflow: hidden; background: var(--fm-line); }
.fm-cc-prog-matched { background: var(--fm-income); }
.fm-cc-prog-ignored { background: var(--fm-muted); }
.fm-cc-prog-suggested { background: var(--fm-warn-text); }
.fm-cc-prog-unmatched { background: var(--fm-alert); }
.fm-cc-prog > span { display: block; height: 100%; }
.fm-cc-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .75rem; font-size: .82rem; }
.fm-cc-legend li { display: flex; align-items: center; gap: .4rem; }
.fm-cc-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.fm-cc-dot { width: .6rem; height: .6rem; border-radius: 50%; flex: none; }
.fm-cc-msg { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem .75rem; border-radius: var(--fm-radius-control); font-size: .85rem; }
.fm-cc-msg .bi { line-height: 1.3; }
.fm-cc-msg-ok { background: var(--fm-income-soft); color: var(--fm-ink); }
.fm-cc-msg-ok .bi { color: var(--fm-income-text); }
.fm-cc-msg-warn { background: var(--fm-warn-soft); color: var(--fm-ink); }
.fm-cc-msg-warn .bi { color: var(--fm-warn-text); }
.fm-cc-msg-err { background: var(--fm-alert-soft); color: var(--fm-ink); }
.fm-cc-msg-err .bi { color: var(--fm-alert-text); }
.fm-cc-msg-info { background: var(--fm-brand-soft); color: var(--fm-ink); }
.fm-cc-msg-info .bi { color: var(--fm-brand-text); }

/* ---------- form: statement file ---------- */
.fm-cc-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 1.75rem 1rem; border: 2px dashed var(--fm-line); border-radius: var(--fm-radius-card); background: var(--fm-canvas); cursor: pointer; color: var(--fm-muted); }
.fm-cc-drop .bi { font-size: 2rem; color: var(--fm-brand-text); }
.fm-cc-drop strong { color: var(--fm-ink); }
.fm-cc-drop:hover, .fm-cc-drop.is-over { border-color: var(--fm-brand); background: var(--fm-brand-soft); }
.fm-cc-drop:focus-visible { outline: 2px solid var(--fm-brand); outline-offset: 2px; }
.fm-cc-chosen { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border: 1px solid var(--fm-line); border-radius: .75rem; margin-top: .75rem; min-width: 0; }
.fm-cc-chosen[hidden] { display: none; }
.fm-cc-chosen-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fm-cc-status { margin-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.fm-cc-status:empty { display: none; }
.fm-cc-spin { width: 1rem; height: 1rem; border: 2px solid var(--fm-line); border-top-color: var(--fm-brand); border-radius: 50%; animation: fm-cc-spin .8s linear infinite; flex: none; margin-top: .15rem; }
@keyframes fm-cc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fm-cc-spin { animation: none; } }

/* ---------- form: entries found ---------- */
.fm-cc-found-table { width: 100%; font-size: .85rem; border-collapse: collapse; }
.fm-cc-found-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--fm-muted); font-weight: 700; padding: .5rem .75rem; border-bottom: 1px solid var(--fm-line); text-align: left; }
.fm-cc-found-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--fm-line); vertical-align: middle; }
.fm-cc-found-table tr:last-child td { border-bottom: 0; }
.fm-cc-found-table .fm-cc-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fm-cc-found-table .fm-cc-check { width: 2.5rem; }
.fm-cc-found-table tr.is-excluded td:not(.fm-cc-check) { opacity: .5; text-decoration: line-through; }
.fm-cc-found-table tr.is-dup td { background: var(--fm-warn-soft); }
.fm-cc-found-table .fm-cc-raw { font-size: .8rem; }
.fm-cc-found-more { display: flex; justify-content: center; padding: .6rem; border-top: 1px solid var(--fm-line); }
.fm-cc-found-more[hidden] { display: none; }
@media (max-width: 575.98px) {
  .fm-cc-found-table .fm-cc-col-booked, .fm-cc-found-table .fm-cc-col-kind { display: none; }
  .fm-cc-found-table td, .fm-cc-found-table th { padding: .45rem .5rem; }
}

/* ---------- form: card picker rows ---------- */
.fm-cc-sel { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.fm-cc-sel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-cc-sel-digits { margin-left: auto; color: var(--fm-muted); font-size: .8rem; font-variant-numeric: tabular-nums; flex: none; }
.fm-xedit #payment_method_id + .select2-container .select2-selection--single { height: auto; min-height: 2.6rem; padding-top: .25rem; padding-bottom: .25rem; }
.fm-xedit #payment_method_id + .select2-container .select2-selection__arrow { height: 100%; top: 0; transform: none; display: flex; align-items: center; }

.fm-cc-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }

/* Release 2.11: matching. Suggested boxes are dashed in the warn colour, the actions sit under the box on phones. */
.fm-cc-box { flex-wrap: wrap; }
.fm-cc-box-suggested { border: 1px dashed var(--fm-warn-text); }
.fm-cc-box-text { display: flex; flex-direction: column; gap: .15rem; flex: 1 1 14rem; min-width: 0; }
.fm-cc-rec-name { font-weight: 600; overflow-wrap: anywhere; }
.fm-cc-rec-meta { color: var(--fm-muted); }
.fm-cc-reasons { display: flex; flex-wrap: wrap; gap: .3rem; }
.fm-cc-reason { padding: .05rem .5rem; border-radius: 999px; background: var(--fm-surface); border: 1px solid var(--fm-line); color: var(--fm-ink); font-size: .75rem; }
.fm-pill-brand { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--fm-brand-soft); color: var(--fm-brand-text); font-size: .75rem; font-weight: 600; margin-right: .3rem; }
.fm-cc-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.fm-cc-actions .btn { white-space: nowrap; }
.fm-cc-row-focus, .fm-cc-row-done { box-shadow: inset 3px 0 0 var(--fm-brand); }
.fm-cc-bar-brand { background: var(--fm-brand-soft); color: var(--fm-ink); flex-wrap: wrap; }
.fm-cc-bar-brand .bi { color: var(--fm-brand-text); }
.fm-cc-bar-info { color: var(--fm-muted); }
.fm-cc-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; padding: .7rem 1rem; border-radius: var(--fm-radius-card); background: var(--fm-brand-soft); color: var(--fm-ink); }
.fm-cc-banner .bi { color: var(--fm-brand-text); }
.fm-cc-banner a { margin-left: auto; font-weight: 600; }
@media (max-width: 575.98px) {
  .fm-cc-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-left: 0; }
  .fm-cc-actions .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: normal; }
}

.fm-cc-toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); z-index: 1090; max-width: min(36rem, calc(100% - 2rem)); padding: .6rem 1rem; border-radius: var(--fm-radius-control); background: var(--fm-ink); color: var(--fm-surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.fm-cc-toast-error { background: var(--fm-alert); color: #fff; }

/* the match dialog */
.fm-cc-dlg-entry { padding: .6rem .8rem; border-radius: var(--fm-radius-control); background: var(--fm-canvas); }
.fm-cc-dlg-list { display: flex; flex-direction: column; gap: .4rem; }
.fm-cc-cand { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem; border: 1px solid var(--fm-line); border-radius: var(--fm-radius-control); cursor: pointer; }
.fm-cc-cand:has(input:checked) { border-color: var(--fm-brand); background: var(--fm-brand-soft); }
.fm-cc-cand .form-check-input { margin-top: .2rem; flex: none; }
.fm-cc-cand-body { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.fm-cc-cand-name { font-weight: 600; overflow-wrap: anywhere; }
.fm-cc-cand-meta { color: var(--fm-muted); font-size: .85rem; }
.fm-cc-cand-score { font-variant-numeric: tabular-nums; color: var(--fm-muted); font-size: .8rem; white-space: nowrap; }
.fm-cc-dlg-state:empty { display: none; }
.fm-cc-dlg-error { color: var(--fm-alert-text); }
.fm-cc-skel { height: 3.2rem; border-radius: var(--fm-radius-control); background: var(--fm-canvas); margin-bottom: .4rem; animation: fm-cc-pulse 1.2s ease-in-out infinite; }
@keyframes fm-cc-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .fm-cc-skel { animation: none; } }

/* An entry linked to several records (2.12.0): one line per record, their total, the dialog's running total */
.fm-cc-link { display: flex; flex-direction: column; }
.fm-cc-link + .fm-cc-link { margin-top: .35rem; padding-top: .35rem; border-top: 1px dashed var(--fm-line); }
.fm-cc-linked-total { font-weight: 600; }
.fm-cc-linked-off { color: var(--fm-warn-text); }
.fm-cc-dlg-total { font-size: .875rem; font-weight: 600; color: var(--fm-ink); margin-right: .5rem; }
.fm-cc-dlg-total.fm-cc-linked-off { color: var(--fm-warn-text); }
