/* Finance (and the section nav). Same palette as app.css: green and red only
   ever mean money in and money out, steel is for structure. */

/* ── Sections in the bar ── */
.bar__nav { display: flex; gap: 4px; margin-inline-end: auto; margin-inline-start: 8px; }
.bar__nav a {
  padding: 8px 12px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--mist);
  transition: color .2s ease, background .2s ease;
}
.bar__nav a:hover { color: var(--paper); }
.bar__nav a[aria-current="page"] { color: var(--deep); background: var(--signal); }
.bar__nav a:focus-visible, .subtab:focus-visible, .seg__key:focus-visible, .link:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
@media (max-width: 640px) {
  .bar__nav { order: 3; width: 100%; margin: 0; }
}

/* ── Sub-tabs and the ledger switch ── */
.subtabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subtab {
  padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--text-2); white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.subtab:hover { color: var(--text); }
.subtab[aria-current="page"] { color: var(--text); border-bottom-color: var(--steel); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.seg__key { min-height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; cursor: pointer; color: var(--text-2); }
.seg__key[aria-pressed="true"] { background: var(--deep); color: var(--paper); }
@media (prefers-color-scheme: dark) { .seg__key[aria-pressed="true"] { background: var(--steel); color: #fff; } }

/* ── Money ── */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.money--in { color: var(--up); }
.money.money--out { color: var(--down); }
.total b .money { font: inherit; }
.total b .money:not(.money--in):not(.money--out) { color: inherit; }

/* ── Tables ── */
.tablewrap { overflow-x: auto; margin: 0 -4px; }
.tab { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tab th { text-align: start; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tab td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tab tbody tr:last-child td { border-bottom: 0; }
.tab tbody tr:hover td { background: color-mix(in srgb, var(--signal) 8%, transparent); }
.tab--num td:not(:first-child), .tab--num th:not(:first-child), .tab .num { text-align: end; font-variant-numeric: tabular-nums; }
.tab--edit td { padding: 4px; }
.tab--edit input, .tab--edit select { min-height: 34px; padding: 4px 8px; }
.tab--edit td:first-child input { width: 18px; min-height: 18px; }
.nowrap { white-space: nowrap; }
.small { font-size: .8125rem; }
.upper { text-transform: uppercase; }
.link { color: var(--steel); font-weight: 600; }

/* ── Share bars ── */
.share { display: block; width: 100%; min-width: 60px; height: 6px; }
.share__track { fill: var(--line); }
.share__fill { fill: var(--steel); }

/* ── Month by month ── */
.chartbox { margin: 0; }
.chart { display: block; width: 100%; height: auto; }
.chart__base { stroke: var(--line); stroke-width: 1; }
.chart__in { fill: var(--up); }
.chart__out { fill: var(--down); opacity: .85; }
.chart__label { font: 600 14px var(--figure); fill: var(--text-2); text-anchor: middle; letter-spacing: .04em; }
.chart__net { font: 600 15px var(--figure); text-anchor: middle; }
.chart__net--in { fill: var(--up); }
.chart__net--out { fill: var(--down); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: .8125rem; }
.legend__in::before, .legend__out::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: -1px; }
.legend__in::before { background: var(--up); }
.legend__out::before { background: var(--down); }

/* Two columns on a wide screen, one on a phone. */
.finbody .panes { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }

/* ── Forms and lists ── */
.finform .grid2 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.jodline { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 0; }
.jodline .fig { font-size: 1.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { width: auto; min-height: 34px; padding: 4px 10px; font-size: .875rem; font-family: var(--ui); letter-spacing: 0; text-transform: none; }
.filters--top { margin: 0 0 14px; }
.pane h2 .filters { font: 400 .875rem/1.4 var(--ui); letter-spacing: 0; }
.item__end { text-align: end; }
.item__end .keys { justify-content: flex-end; margin-top: 6px; }
.list li.is-off { opacity: .6; }
.narrow { max-width: 460px; }
