.finance-page { min-width: 0; }
.finance-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 20px 0 30px; }
.finance-stat { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; background: var(--surface); }
.finance-label { display: block; color: var(--ink-2); font-size: 13px; margin-bottom: 9px; }
.finance-stat strong { display: block; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.finance-stat p { margin: 10px 0 0; }
.finance-section { margin: 28px 0; }
.finance-section h2 { font-size: 17px; margin-bottom: 14px; }
.finance-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.finance-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.finance-caption { text-align: left; padding: 12px 16px; font-size: 12px; color: var(--ink-3); }
.finance-table th, .finance-table td { padding: 13px 16px; border-top: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
.finance-table th:first-child { text-align: left; }
.finance-table thead th { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.finance-table tbody th { font-weight: 500; }
.finance-sources { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.finance-source { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.finance-source-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.finance-source h3 { font-size: 14px; margin: 0; }
.finance-status { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.finance-source p { margin: 9px 0 0; }
.finance-note { max-width: 82ch; }
@media (max-width: 700px) {
  .finance-stats, .finance-sources { grid-template-columns: 1fr; }
  .finance-stat { padding: 16px; }
  .finance-table th, .finance-table td { padding: 11px 12px; }
}

/* The lab's caps: a card each, the meter under its name, what is used beside the way to change it. */
.finance-section h2 { display: flex; align-items: center; gap: 6px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.cap-row { min-width: 0; display: grid; gap: 9px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--ring); }
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.cap-name { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.chip.cap-near { background: var(--warn-soft); color: var(--warn); }
.cap-meter { height: 6px; border-radius: 6px; background: var(--field); overflow: hidden; }
.cap-meter > i { display: block; height: 100%; border-radius: 6px; background: var(--ink); transition: width 0.4s; }
.cap-near .cap-meter > i { background: var(--warn); }
.cap-over .cap-meter > i { background: var(--danger); }
.cap-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 30px; }
.cap-numbers { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cap-numbers b { color: var(--ink); font-weight: 600; }
.cap-edit { display: inline-flex; align-items: center; gap: 4px; flex: 1 1 110px; min-width: 0; }
.cap-edit input { width: 100%; min-width: 0; padding: 5px 8px; min-height: 0; }

/* The month by category: a card a category, its total at the right of its name, where the number is from under it, then its largest lines. */
.fin-overview-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fin-overview-head h2 { margin: 0; }
.finance-page select.fin-month { width: auto; flex: none; min-height: 0; padding: 5px 30px 5px 10px; font-size: 13px; }
.fin-total { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; }
.fin-total strong { font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; align-items: start; }
.fin-card { min-width: 0; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--ring); }
.fin-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fin-card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.fin-card-head strong { font-size: 18px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-source { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.fin-not_connected { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.fin-not_connected .fin-card-head strong { color: var(--ink-3); }
.fin-rows { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line-soft); display: grid; gap: 5px; font-size: 13px; }
.fin-rows li { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.fin-rows li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.fin-rows li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-more { margin-top: 8px; font-size: 12.5px; }
.fin-more summary { cursor: pointer; color: var(--ink-2); }
.fin-more .fin-rows { margin-top: 6px; }
.fin-notes { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.fin-ledger-title { font-size: 17px; margin: 34px 0 0; }
.fin-ledger-title + .finance-stats { margin-top: 14px; }
.fin-reviews td:last-child { font-weight: 500; }
@media (max-width: 640px) { .fin-total { margin-left: 0; width: 100%; justify-content: space-between; } }

/* The tables of figures on a phone: a row is a block, its name over each figure with its label (nothing sideways, the figures in one column). */
@media (max-width: 700px) {
  .finance-table.fin-stack, .finance-table.fin-stack tbody, .finance-table.fin-stack tfoot { display: block; }
  .finance-table.fin-stack thead { display: none; }
  .finance-table.fin-stack caption { display: block; }
  .finance-table.fin-stack tr { display: grid; gap: 5px; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
  .finance-table.fin-stack tbody tr:first-child { border-top: 0; }
  .finance-table.fin-stack th, .finance-table.fin-stack td { border: 0; padding: 0; text-align: left; }
  .finance-table.fin-stack th[scope="row"] { font-weight: 600; }
  .finance-table.fin-stack td { display: flex; justify-content: space-between; gap: 12px; white-space: normal; }
  .finance-table.fin-stack td::before { content: attr(data-label); color: var(--ink-3); }
  .finance-table.fin-stack tfoot tr { border-top: 1px solid var(--line); }
}
