/* Base: reset, typographic roles, numbers, rules, tonal panel, utilities. */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  html.no-scroll, html.no-scroll body { overflow: hidden; }
  body {
    margin: 0; min-height: 100dvh; overflow-x: hidden;
    background: var(--paper); color: var(--ink);
    font: 400 var(--fs-body)/1.45 var(--font-text);
    font-feature-settings: "kern", "liga";
    -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
  }
  [hidden] { display: none !important; }
  h1, h2, h3, h4 {
    margin: 0; font-family: var(--font-display); font-weight: var(--w-display);
    letter-spacing: var(--ls-display); line-height: 1.12; font-variation-settings: var(--fvs-display);
  }
  h1 { font-size: var(--fs-h1); }
  h2 { font-size: var(--fs-h2); }
  h3 { font-size: var(--fs-h3); }
  p { margin: 0; }
  a { color: inherit; text-decoration: none; }
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; touch-action: manipulation; }
  button:disabled { cursor: not-allowed; }
  img, svg { display: block; max-width: 100%; }
  ul { margin: 0; padding: 0; list-style: none; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
  ::selection { background: var(--accent-soft-2); }
  * { scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; }
  kbd, .kbd {
    display: inline-block; font: 600 11.5px/1 var(--font-text); letter-spacing: .04em; padding: 4px 6px; white-space: nowrap;
    background: var(--paper-2); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 6px; color: var(--ink-2);
  }
  code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--paper-2); padding: 2px 6px; border-radius: var(--r-xs); }

  /* numbers: always tabular, never wrapped — set in the display face, the text subset has no tnum (see --font-num) */
  .num, time, .amt, .t { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
  .num { text-align: right; }
  .amt { font-weight: 600; }
  .amt.neg, .neg, .text-danger { color: var(--danger); }
  .amt.pos, .pos, .text-good { color: var(--good); }
  .text-warn { color: var(--warn); }

  /* typographic roles */
  .kicker { font-size: var(--fs-kicker); font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); line-height: 1.3; }
  .kicker b, .kicker .count { color: var(--ink); font-weight: 600; }
  .kicker .amt, .kicker .num, .section-title h2 .amt { text-transform: none; letter-spacing: 0; }
  .kicker.ink { color: var(--ink); }
  .cap { font-size: var(--fs-caption); color: var(--ink-2); line-height: 1.35; }
  .muted { color: var(--ink-2); }
  .faint { color: var(--ink-3); }
  .lead { font-size: var(--fs-lead); line-height: 1.4; }
  .display { font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: var(--ls-display); font-variation-settings: var(--fvs-display); }
  .fig {
    font-family: var(--font-display); font-weight: var(--w-display); font-size: var(--fs-fig); line-height: 1;
    letter-spacing: var(--ls-fig); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; font-variation-settings: var(--fvs-fig);
  }
  .fig small { font-size: .5em; font-weight: 500; letter-spacing: 0; margin-left: .06em; }
  .fig-lg { font-size: var(--fs-fig-lg); }
  .ital { font-family: var(--font-display); font-style: var(--ital-style); font-weight: var(--ital-weight); font-variation-settings: var(--fvs-ital); }
  .nowrap { white-space: nowrap; }
  .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* rules */
  .rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
  .rule-2 { border: 0; border-top: 1px solid var(--rule-2); margin: 0; }
  .rule-ink { border: 0; border-top: 2px solid var(--ink); margin: 0; }

  /* tonal panel: the one boxed surface, used by role (hero, inbox tray, limit, plan) — never by default */
  .panel { background: var(--paper-2); border-radius: var(--r-lg); padding: 16px; }
  .panel.tint { background: var(--hue-soft); }
  .panel.surface { background: var(--surface); box-shadow: 0 0 0 1px var(--rule); }

  /* links and small utilities */
  .link, .link-btn { color: var(--accent); font-weight: 600; }
  .link-btn { display: inline-flex; align-items: center; gap: 4px; }
  .grad { color: var(--accent); }
  .spacer { flex: 1; }
  .pad { padding: 14px 0; } .pad-b { padding-bottom: 12px; } .pad-t { padding-top: 12px; } .pad-sm { padding: 8px 0; }
  .ico, .ic { flex: none; }
  @media (hover: hover) { .link:hover, .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; } }
  @media (max-width: 760px) { .hide-sm { display: none !important; } }
  @media (max-width: 560px) { .hide-xs { display: none !important; } }
  @media (max-width: 380px) { :root { --fs-body: 15px; } }
}
