/* Area styles: money. Only what the shared components (components.css) cannot
   express. Use the tokens from tokens.css — never a literal colour. */

/* ------------------------------------------------------------- hero --- */

.money-hero { display: flex; flex-direction: column; gap: var(--sp-4); }
.money-hero__sub { color: var(--ink-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

.money-dot--paid { background: var(--accent); }
.money-dot--open { background: var(--accent-soft); }
.money-dot--over { background: var(--danger); }
.money-dot--buffer {
  background: repeating-linear-gradient(135deg, var(--accent-soft) 0 2px, transparent 2px 4px);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

/* ------------------------------------------------ arithmetic column --- */

.money-chain { margin: 0; padding: var(--sp-1) 0; }

.money-chain__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3);
  min-height: 40px; padding: var(--sp-2) var(--sp-4);
}

.money-chain__row dt { min-width: 0; color: var(--ink); }
.money-chain__row dd {
  margin: 0; flex: none; font-weight: 600; white-space: nowrap;
  font-variant-numeric: tabular-nums; text-align: right;
}

.money-chain__row--detail { min-height: 32px; padding-block: 2px; padding-left: calc(var(--sp-4) + var(--sp-4)); }
.money-chain__row--detail dt, .money-chain__row--detail dd { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; }

.money-chain__row--subtotal, .money-chain__row--total, .money-chain__row--open, .money-chain__row--gap {
  border-top: 1px solid var(--line);
}
.money-chain__row--subtotal dt, .money-chain__row--total dt { font-weight: 600; }
.money-chain__row--total dd { font-size: var(--fs-lg); font-weight: 700; }
.money-chain__row--open { border-top: 2px solid var(--line-strong); }
.money-chain__row--open dt { font-weight: 700; }
.money-chain__row--open dd { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.01em; }
.money-chain__row--gap dt, .money-chain__row--gap dd { color: var(--danger); font-weight: 700; }
.money-chain__row--gap dd { font-size: var(--fs-xl); }
.money-chain__row--tentative dt, .money-chain__row--tentative dd { color: var(--ink-3); font-size: var(--fs-sm); font-weight: 500; }

/* ---------------------------------------------------- tinted notes --- */

.money-note { line-height: 1.45; }
.money-note--ok { background: var(--success-wash); color: var(--ink); }
.money-note--warn { background: var(--warning-wash); color: var(--ink); }
.money-note--danger { background: var(--danger-wash); color: var(--ink); }
.money-note--muted { background: none; padding-inline: var(--sp-1); color: var(--ink-3); }

.money-lines { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--sp-1); }
.money-line { margin: 0; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }

.money-explain { padding: 0 var(--sp-1); color: var(--ink-2); font-size: var(--fs-sm); }
.money-explain summary {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--touch); cursor: pointer; color: var(--accent-ink); font-weight: 500;
  list-style: none;
}
.money-explain summary::-webkit-details-marker { display: none; }
.money-explain p { margin: 0 0 var(--sp-2); line-height: 1.45; }

/* ------------------------------------------- per-measure cards, pots --- */

.money-measures {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}

.money-measure {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); color: inherit; text-decoration: none;
}
.money-measure + .money-measure { border-top: 1px solid var(--line); }
a.money-measure:active { background: var(--surface-sunken); }

.money-measure__head { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.money-measure__name { font-weight: 600; overflow-wrap: anywhere; }
.money-measure__rooms { color: var(--ink-2); font-size: var(--fs-sm); }

.money-measure--tentative .money-measure__name,
.money-measure--tentative .money-cell__value { color: var(--ink-3); }
.money-measure--done .money-measure__name { color: var(--ink-2); }
.money-measure--sum { background: var(--surface-sunken); border-top: 2px solid var(--line-strong) !important; }

.money-cells {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-3);
}
@media (min-width: 26rem) {
  .money-cells { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .money-cells--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.money-cells--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.money-cell { display: flex; flex-direction: column; min-width: 0; }
.money-cell__label { color: var(--ink-2); font-size: var(--fs-xs); }
.money-cell__value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.money-cell__src { color: var(--ink-3); font-size: var(--fs-xs); }
.money-cell--muted .money-cell__value { color: var(--ink-3); font-weight: 500; }

/* --------------------------------------------------------- invoices --- */

.money-filter { display: flex; flex-direction: column; gap: var(--sp-3); }
.money-filter__dates {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: var(--sp-3);
}

.money-inv-results { gap: var(--sp-4); }

.money-inv { padding: 0 var(--sp-1) 0 0; gap: 0; }
.money-inv__link {
  flex: 1; min-width: 0; min-height: 60px;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  color: inherit; text-decoration: none;
}
.money-inv__link:active { background: var(--surface-sunken); }
.money-inv__amount { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.money-inv__status { color: var(--ink-2); font-size: var(--fs-xs); }
.money-inv__nofile { width: var(--touch); flex: none; }

.money-bundle__status { margin: 0; font-weight: 500; }

/* --------------------------------------------------------- shopping --- */

.money-shop { padding: 0 var(--sp-1) 0 var(--sp-4); gap: var(--sp-2); }
.money-shop .check { margin: 0 -6px 0 -10px; }
.money-shop__body {
  flex: 1; min-width: 0; min-height: 60px;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) 0;
  border: 0; background: none; color: inherit; text-align: left;
}
.money-shop__body:active { background: var(--surface-sunken); }
.money-shop--bought .row__title { color: var(--ink-3); }

.money-shop-list { gap: var(--sp-5); }
.money-shop-group__meta { color: var(--ink-2); font-weight: 500; text-align: right; }
.money-shop-group .section__head { flex-wrap: wrap; }
