/* Credit history ledger (Credits page + Admin → Users → History) — UI1, 21 Oct 2026.
   Spent / added / refund each have one colour; a coloured stitch on the left of every row says which. */
:root { --lg-spent: #ff9d92; --lg-added: #5fe0a4; --lg-refund: #7cc4ff; }
[data-theme="ivory"], [data-theme="cotton"] { --lg-spent: #b3322a; --lg-added: #17784d; --lg-refund: #1d5d9b; }

.lg { min-width: 0; max-width: 780px; } /* a ledger reads label → amount; keep them close on a wide screen */
.lg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 0.4rem; }
.lg-filters { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-surface); max-width: 100%; }
.lg-filter { border: 0; background: none; font: inherit; font-size: 0.86rem; font-weight: 500; color: var(--text-secondary); padding: 0.38rem 0.9rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.lg-filter:hover { color: var(--text-primary); }
.lg-filter[aria-pressed="true"] { background: var(--bg-elevated); color: var(--text-primary); font-weight: 650; box-shadow: inset 0 0 0 1px var(--border-strong); }
.lg-filter:focus-visible, .lg-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lg-count { color: var(--text-tertiary); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.lg-day { margin-top: 1.15rem; }
.lg-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 650; color: var(--text-primary); }
.lg-net { font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.lg-net::before { content: 'Day total '; font-weight: 400; color: var(--text-tertiary); }
.lg-rows { list-style: none; }
.lg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1rem; row-gap: 0.1rem; align-items: baseline;
  padding: 0.55rem 0.2rem 0.55rem 0.9rem; border-bottom: 1px solid var(--border-color); border-left: 3px solid var(--lg-tone); }
.lg-row.is-spent { --lg-tone: var(--lg-spent); }
.lg-row.is-added { --lg-tone: var(--lg-added); }
.lg-row.is-refund { --lg-tone: var(--lg-refund); background: color-mix(in srgb, var(--lg-refund) 6%, transparent); }
.lg-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.7rem; min-width: 0; }
.lg-label { font-size: 0.95rem; font-weight: 550; color: var(--text-primary); overflow-wrap: anywhere; }
.lg-time { font-size: 0.8rem; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.lg-amt { font-size: 1.02rem; font-weight: 700; color: var(--lg-tone); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lg-bal { grid-column: 2; grid-row: 2; font-size: 0.76rem; color: var(--text-tertiary); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lg-link { grid-column: 1; grid-row: 2; font-size: 0.8rem; color: var(--lg-refund); margin: 0; }
.lg-link::before { content: '↳ '; }

.lg-state { padding: 2rem 1rem; text-align: center; color: var(--text-secondary); font-size: 0.92rem; }
.lg-state .btn { margin-top: 0.75rem; }
.lg-foot { display: flex; justify-content: center; margin-top: 1.1rem; }
.lg-foot:empty { display: none; }
.lg-skeleton { display: grid; gap: 0.5rem; margin-top: 1rem; }
.lg-skeleton span { height: 2.8rem; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-elevated) 50%, var(--bg-surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .lg-skeleton span { animation: none; } }
@media (max-width: 480px) {
  .lg-filters { display: flex; width: 100%; }
  .lg-filter { flex: 1; padding: 0.42rem 0.4rem; }
  .lg-row { padding-left: 0.7rem; }
}
