/* Compare (#/budget?v=compare). Builds on plan.css and the Summary components. The table scrolls inside .cmp-wrap so the page never
   scrolls sideways (390 px). Direction is never colour alone: every difference has an arrow and a sign. */
.cmp { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.cmp .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.cmp-pick { padding: 16px 20px; display: grid; gap: 10px; }
.cmp-pick-h b { font-size: 15px; font-weight: 600; }
.cmp-pick-l { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 4px 20px; }
.cmp-pick-l li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.cmp-chk { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; min-width: 0; font-weight: 500; }
.cmp-chk span { overflow-wrap: anywhere; }
.cmp-chk input { width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.cmp-chk input:focus-visible { outline: none; box-shadow: var(--focus); }

.cmp-promote { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.cmp-prom { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.cmp-prom b { overflow-wrap: anywhere; font-weight: 600; }

.cmp-heads { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.cmp-head { min-width: 0; align-content: start; }
.cmp-head-i { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.cmp-head-n { flex: 1 1 100%; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.cmp-head-i .fig { font-size: 20px; line-height: 26px; }
.cmp-head-i.base .fig { color: var(--ink-2); }

.cmp-d { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-d.good { color: var(--ok); }
.cmp-d.bad { color: var(--bad); }
.cmp-d.info, .cmp-d.flat { color: var(--ink-2); }

.cmp-bar { padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.cmp-focus { display: flex; align-items: center; gap: 8px; }
.cmp-focus label { font-weight: 500; font-size: 13px; color: var(--ink-3); }
.cmp-sum { margin-left: auto; }

.cmp-table-card { overflow: hidden; }
.cmp-wrap { overflow: auto; max-width: 100%; max-height: 70vh; }
.cmp-wrap:focus-visible { outline: none; box-shadow: inset var(--focus); }
.cmp-t { min-width: max-content; font-size: 14px; }
.cmp-t td { height: 52px; background: var(--surface); }
.cmp-t thead th { position: sticky; top: 0; z-index: 4; }
.cmp-t th.cmp-lab { position: sticky; left: 0; z-index: 3; background: var(--surface); min-width: 220px; max-width: 280px; white-space: normal; text-align: left; border-right: 1px solid var(--line); }
.cmp-t tbody th.cmp-lab { color: var(--ink); font-weight: 500; font-size: 14px; border-bottom: 1px solid var(--line); padding: 8px 12px 8px 20px; }
.cmp-t thead th.cmp-lab { z-index: 5; }
.cmp-t .r { text-align: right; }
.cmp-c { font-variant-numeric: tabular-nums; }
.cmp-c .cmp-v { display: block; color: var(--ink); }
.cmp-c .cmp-d { display: block; }
.cmp-row.subtotal th, .cmp-row.subtotal td { font-weight: 600; color: var(--ink); background: #faf9f7; border-top: 1px solid var(--line-2); }
.cmp-row.pct th, .cmp-row.pct td { color: var(--ink-3); font-weight: 500; }
.cmp-row.chg th.cmp-lab { box-shadow: inset 3px 0 0 var(--brand); }

@media (max-width: 760px) {
  .cmp-pick, .cmp-bar { padding: 10px 12px; }
  .cmp-t th.cmp-lab { min-width: 140px; max-width: 160px; }
  .cmp-wrap { max-height: 60vh; }
  .cmp-bar > * { min-width: 0; }
  .cmp-sum { margin-left: 0; }
}
