*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font: 400 var(--fs-body)/1.4 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; font-optical-sizing: auto;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a, button, input, select, summary, [role="button"] { touch-action: manipulation; } /* no 300ms tap delay */
a { color: var(--accent); text-decoration: none; }

/* money is always tabular so digits line up in columns */
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.t-large { font-size: min(var(--fs-large-title), 11vw); overflow-wrap: anywhere; /* never wider than the screen, even at huge text sizes */ font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.t-title { font-size: var(--fs-title); font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.t-headline { font-size: var(--fs-headline); font-weight: 600; }
.t-footnote { font-size: var(--fs-footnote); }
.t-caption { font-size: var(--fs-caption); font-weight: 500; }
.muted { color: var(--label-2); }
.faint { color: var(--label-3); }
.pos { color: var(--positive-text); }
.neg { color: var(--negative-text); }
.warn { color: var(--warning-text); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Reduced motion means gentler, not nothing: slides, sweeps and springs go away, short fades stay so changes are still understandable. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .donut .seg, .bar-fill, .fade-in, .fab:active, .btn:active, .chip:active, .icon-btn:active { animation: none !important; transform: none !important; }
  .progress.indeterminate > i { animation: none; width: 40%; margin-left: 30%; }
  .toast { transform: translate(-50%, 0); }
}

/* Switching theme eases the colours over a moment instead of snapping (prefs.js adds this class briefly). */
html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color 280ms ease, color 280ms ease, border-color 280ms ease, fill 280ms ease, stroke 280ms ease, box-shadow 280ms ease !important;
}
@media (prefers-reduced-motion: reduce) { html.theme-fade * { transition: none !important; } }
