/* ==========================================================================
   FieldGrid UI v2 — Reset, typography, native element normalization
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv05' 1, 'cv08' 1, 'ss03' 1;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4, h5, h6 { font-size: var(--fs-md); }

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent-active); }

strong, b { font-weight: var(--fw-semibold); }
small { font-size: var(--fs-xs); }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--s-5) 0;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex: none; }

code, pre, kbd, samp { font-family: var(--font-num); font-size: 0.92em; }

::selection { background: var(--accent-subtle); color: var(--accent-active); }

/* ---- Focus -------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---- Native form elements ---------------------------------------------- */
button, input, select, textarea, optgroup {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
textarea { resize: vertical; }

input::placeholder, textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

/* Kill the spinner on number inputs — money/quantity fields read better without */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

table { border-collapse: collapse; border-spacing: 0; width: 100%; }
th { text-align: left; font-weight: var(--fw-semibold); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* ---- Scrollbars --------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--ink-faint); background-clip: content-box; }

/* ==========================================================================
   Utilities — a deliberately small set. Anything reused three times becomes
   a component in components.css instead of growing this list.
   ========================================================================== */

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tabular { font-variant-numeric: tabular-nums; }

.t-xs   { font-size: var(--fs-xs); }
.t-sm   { font-size: var(--fs-sm); }
.t-lg   { font-size: var(--fs-lg); }
.t-soft  { color: var(--ink-soft); }
.t-muted { color: var(--ink-muted); }
.t-danger  { color: var(--danger); }
.t-success { color: var(--success); }
.t-warning { color: var(--warning); }
.t-medium   { font-weight: var(--fw-medium); }
.t-semibold { font-weight: var(--fw-semibold); }
.t-right  { text-align: right; }
.t-center { text-align: center; }
.t-nowrap { white-space: nowrap; }

.t-truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.t-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.t-caps {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.row    { display: flex; align-items: center; gap: var(--s-2); }
.row-sm { display: flex; align-items: center; gap: var(--s-1); }
.row-lg { display: flex; align-items: center; gap: var(--s-4); }
.col    { display: flex; flex-direction: column; gap: var(--s-2); }
.col-lg { display: flex; flex-direction: column; gap: var(--s-4); }
.wrap   { flex-wrap: wrap; }
.grow   { flex: 1; min-width: 0; }
.push   { margin-left: auto; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }

.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-5); }

.hidden { display: none !important; }

.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.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;
}
