/* ==========================================================================
   ledger.css — the unified Expenses ledger (DESIGN.md §F3, WP-1.6)
   Tables on desktop, cards on mobile (one model, CSS-switched). Status +
   compliance chips. Inline receipt lightbox (never a stacked modal).
   ========================================================================== */

/* View tabs */
.rx-views { display: flex; gap: 4px; background: #F1F5F9; padding: 4px; border-radius: 10px; margin-bottom: 16px; width: fit-content; }
.rx-views a { padding: 9px 16px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 7px; color: var(--rx-muted); text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.rx-views a.active { background: #fff; color: var(--rx-ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.rx-views a .rx-view-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; font-size: .72rem; background: var(--rx-amber-bg); color: var(--rx-amber); border-radius: 9px; text-align: center; }

/* Toolbar: filters + actions */
.rx-ledger-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.rx-ledger-toolbar .form-select { width: auto; min-width: 130px; }
.rx-ledger-toolbar .rx-toolbar-spacer { flex: 1; }

/* Status chips */
.rx-status { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.rx-status-processing { color: var(--rx-muted); }
.rx-status-review { color: var(--rx-amber); }
.rx-status-confirmed { color: var(--rx-money-2); }
.rx-status .spinner-border { width: .8rem; height: .8rem; border-width: 2px; }

/* Desktop table */
.rx-ledger-table { width: 100%; border-collapse: collapse; }
.rx-ledger-table thead th { position: sticky; top: var(--rx-topbar-h); background: var(--rx-canvas); z-index: 1;
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--rx-muted);
  font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--rx-line); }
.rx-ledger-table tbody tr { border-bottom: 1px solid var(--rx-line); cursor: pointer; }
.rx-ledger-table tbody tr:hover { background: #F8FAFC; }
.rx-ledger-table tbody tr:focus-visible,
.rx-ledger-card:focus-visible { outline: 2px solid var(--rx-accent); outline-offset: -2px; }
.rx-ledger-table td { padding: 11px 12px; vertical-align: middle; font-size: .9rem; }
.rx-ledger-table td.col-amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rx-ledger-table .row-merchant { font-weight: 600; color: var(--rx-ink); }
.rx-ledger-table .row-purpose { color: var(--rx-muted); font-size: .82rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-cat-chip { display: inline-block; font-size: .72rem; background: #F1F5F9; color: var(--rx-muted); padding: 2px 7px; border-radius: 6px; margin-top: 2px; }
.rx-row-thumb { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; vertical-align: middle; }
.rx-chips-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* Mobile cards (hidden on desktop) */
.rx-ledger-cards { display: none; }
.rx-ledger-card { border: 1px solid var(--rx-line); border-radius: 12px; background: #fff; padding: 13px; margin-bottom: 10px; cursor: pointer; }
.rx-ledger-card .lc-top { display: flex; justify-content: space-between; gap: 8px; }
.rx-ledger-card .lc-merchant { font-weight: 600; }
.rx-ledger-card .lc-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rx-ledger-card .lc-meta { color: var(--rx-muted); font-size: .82rem; margin-top: 2px; }
.rx-ledger-card .lc-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; align-items: center; }

@media (max-width: 767.98px) {
  .rx-ledger-table { display: none; }
  .rx-ledger-cards { display: block; }
}

/* Edit modal receipt preview + inline lightbox (NOT a stacked modal) */
.rx-edit-receipt { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px dashed var(--rx-line); border-radius: 10px; margin-bottom: 12px; }
.rx-edit-receipt img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; cursor: zoom-in; }
.rx-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2000; display: none; align-items: center; justify-content: center; cursor: zoom-out; }
.rx-lightbox.show { display: flex; }
.rx-lightbox img { max-width: 92vw; max-height: 92dvh; border-radius: 8px; }

/* Bulk suggestions table */
.rx-bulk-table { width: 100%; font-size: .88rem; }
.rx-bulk-table th { text-align: left; color: var(--rx-muted); font-weight: 600; padding: 6px; }
.rx-bulk-table td { padding: 6px; border-top: 1px solid var(--rx-line); }
.rx-bulk-conf { font-variant-numeric: tabular-nums; }
