/* Project Ledger. Uses the app's --jm-* colour variables, so every colour theme and text size applies automatically. */
.ledger-tabs { display: flex; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--jm-border, var(--line)); }
.ledger-tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; box-shadow: none; padding: 12px 18px; font-weight: 650; color: var(--jm-text-secondary, var(--muted)); }
.ledger-tabs button.active { color: var(--jm-accent-strong, var(--accent)); border-bottom-color: var(--jm-accent, var(--accent)); }
.ledger-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; align-items: end; padding: 16px 18px; margin-bottom: 18px; }
.ledger-filters .field { margin: 0; }
.ledger-filters label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--jm-text-secondary, var(--muted)); }
.ledger-filters .wide { grid-column: span 2; }
.ledger-check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; }
.ledger-check input { width: 20px; min-height: 20px; height: 20px; }
.ledger-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 8px; }
.ledger-cards .metric { min-height: 104px; padding: 14px 16px; }
.ledger-cards .metric .value { font-size: 1.35rem; }
.ledger-note { font-size: .82rem; color: var(--jm-text-secondary, var(--muted)); margin: 6px 0 20px; line-height: 1.5; }
.ledger-neg { color: var(--jm-danger, #a73535); font-weight: 600; }
.ledger-tablewrap { max-height: 68vh; overflow: auto; border-radius: 6px; }
.ledger-table { min-width: 1100px; font-size: .8rem; table-layout: auto; }
.ledger-table th:nth-child(3), .ledger-table td:nth-child(3) { min-width: 118px; }
.ledger-table td:nth-child(3) .sub { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.ledger-table th:nth-child(5), .ledger-table td:nth-child(5) { min-width: 230px; }
.ledger-table th:nth-child(6), .ledger-table td:nth-child(6) { min-width: 130px; }
.ledger-table td:nth-child(2), .ledger-table td:nth-child(4), .ledger-table td:nth-child(1) { white-space: nowrap; }
.ledger-table thead th { position: sticky; top: 0; z-index: 2; background: var(--jm-surface, #fff); white-space: nowrap; box-shadow: 0 1px 0 var(--jm-border, var(--line)); }
.ledger-table th button.sortable { border: 0; background: none; padding: 0; box-shadow: none; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
.ledger-table th button.sortable[data-active="1"] { color: var(--jm-accent-strong, var(--accent)); }
.ledger-table td { padding: 7px 8px; vertical-align: top; line-height: 1.35; }
.ledger-table td.right, .ledger-table th.right { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-num { font-family: var(--hud-mono, Consolas, monospace); font-size: .8rem; }
.ledger-table tr.ledger-void td { opacity: .55; }
.ledger-table tr.ledger-void td:nth-child(5) { text-decoration: line-through; }
.ledger-table tfoot td { position: sticky; bottom: 0; background: var(--jm-surface, #fff); font-weight: 650; box-shadow: 0 -1px 0 var(--jm-border, var(--line)); }
.ledger-table .why { display: block; font-size: .74rem; color: var(--jm-text-secondary, var(--muted)); margin-top: 3px; max-width: 200px; white-space: normal; }
.ledger-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ledger-table .row-actions button { padding: 4px 9px; min-height: 30px; font-size: .74rem; }
.ledger-table button.ledger-source, .ledger-source { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; padding: 0; border: 0; background: none; box-shadow: none; text-align: left; text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--jm-accent-strong, var(--accent)); text-decoration: underline; white-space: nowrap; }
.ledger-loading, .ledger-error { padding: 40px 20px; text-align: center; color: var(--jm-text-secondary, var(--muted)); }
.ledger-error strong { display: block; color: var(--jm-danger, #a73535); margin-bottom: 8px; }
.ledger-legend { font-size: .78rem; color: var(--jm-text-secondary, var(--muted)); margin: 10px 2px 0; line-height: 1.5; }
.ledger-print-head { display: none; }
.ledger-total-out { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .ledger-filters .wide { grid-column: auto; }
  .ledger-table { min-width: 880px; }
  .ledger-table .col-sm { display: none; }
}
@media (max-width: 600px) { .ledger-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ledger-cards .metric .value { font-size: 1.15rem; } .ledger-tabs button { flex: 1; padding: 12px 8px; } }
@media print {
  @page ledger { size: landscape; margin: 12mm; }
  .ledger-print-root { page: ledger; }
  .ledger-print-head { display: block; margin: 0 0 12px; }
  .ledger-print-head h1 { font: 700 18pt/1.2 Georgia, serif; margin: 0 0 2px; color: #000; text-transform: none; text-shadow: none; }
  .ledger-print-head p { margin: 0; font-size: 10pt; color: #333; }
  .ledger-filters, .ledger-tabs, .ledger-note, .ledger-legend, .row-actions, .ledger-actions-col { display: none !important; }
  .ledger-cards { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .ledger-cards .metric { min-height: 0; padding: 6px 8px; border: 1px solid #999; background: #fff; box-shadow: none; }
  .ledger-cards .metric .label, .ledger-cards .metric small { color: #333; font-size: 7.5pt; }
  .ledger-cards .metric .value { color: #000; font-size: 11pt; text-shadow: none; }
  .ledger-tablewrap { max-height: none; overflow: visible; }
  .ledger-table { min-width: 0; width: 100%; font-size: 7.5pt; color: #000; }
  .ledger-table thead th, .ledger-table tfoot td { position: static; background: #fff; color: #000; box-shadow: none; }
  .ledger-table td, .ledger-table th { padding: 3px 4px; border-bottom: 1px solid #ccc; color: #000; }
  .ledger-table thead { display: table-header-group; }
  .ledger-table tr { break-inside: avoid; }
  .ledger-neg { color: #000; }
  .ledger-neg::before { content: ''; }
  .ledger-source { color: #000; text-decoration: none; }
  .ledger-table .col-sm { display: table-cell !important; }
}
.shell .ledger-table button.ledger-source { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; }
.shell .ledger-table button.ledger-source:hover:not(:disabled) { background: none; box-shadow: none; text-decoration: none; }
