/* ==========================================================================
   base.css — reset and element defaults. No component styling lives here.
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  font-size: 100%; /* respect the user's browser size; rem does the rest */
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

/* Figures line up column-wise everywhere they appear in a table or KPI. */
.tabular,
table,
input[type="number"] { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
}

a { color: inherit; text-decoration: none; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

svg { display: block; flex-shrink: 0; }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; padding: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

/* A single, consistent focus treatment. Never removed, only restyled. */
:focus-visible {
  outline: 2px solid var(--gray-950);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--gray-950);
  color: var(--text-inverse);
}

/* Scrollbars: present but quiet. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
*::-webkit-scrollbar { width: 0.5rem; height: 0.5rem; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* The hidden attribute must win.
   The browser's own rule is `[hidden] { display: none }`, which any class
   that sets a display loses to on specificity. An error box styled with
   `display: flex` therefore stays on screen no matter what the script does.
   This one line makes the attribute mean what it says everywhere. */
[hidden] { display: none !important; }

/* Utility: visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
