/* Base styles: reset, body, typography, links, forms, buttons, tables.
   Every colour/font/size comes from variables.css.
   Element rules sit inside :where() (zero specificity) so any component class
   always wins — a class that sets a light background can never inherit the
   white text of the primary button again. */
*, *::before, *::after { box-sizing: border-box; }
/* An element marked hidden stays hidden even when a component sets display. */
[hidden] { display: none !important; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
}
/* The status bar is fixed to the bottom: keep the last content row clear of it. */
body.has-statusbar { padding-bottom: calc(var(--statusbar-h) + var(--gap) * 2); }

.wrap { max-width: 960px; margin: 0 auto; padding: var(--gap); }

.site-header {
  background: var(--c-navy);
  color: var(--c-text-invert);
  min-height: var(--nav-h);
}
.site-header .wrap { display: flex; gap: var(--gap); align-items: center; }
.site-header .muted { color: var(--c-text-invert); opacity: 0.85; }

h1 { font-size: var(--fs-xl); font-weight: 700; line-height: 1.25; margin-bottom: var(--gap); }
h2 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; margin: var(--gap) 0; }
h3 { font-size: var(--fs-md); font-weight: 600; margin: calc(var(--gap) * 1.5) 0 var(--gap); }
p, ul { margin-bottom: var(--gap); }
ul { padding-left: 1.25rem; }
small { font-size: var(--fs-sm); }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--gap) 0; }

/* Links: one colour everywhere (no browser-default blue/purple). */
:where(a) { color: var(--c-link); text-decoration: none; }
:where(a):hover { color: var(--c-link-hover); text-decoration: underline; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

.muted { color: var(--c-text-muted); }
.footer { padding-bottom: calc(var(--gap) * 2); font-size: var(--fs-sm); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: calc(var(--gap) * 2);
  margin-top: calc(var(--gap) * 2);
}

.badge {
  display: inline-block;
  background: var(--c-pos);
  color: var(--c-text-invert);
  border-radius: var(--radius);
  padding: 2px var(--gap);
  font-size: var(--fs-sm);
}

/* Money and quantities always use tabular numerals so columns line up. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-family: var(--font-num);
}

/* ---------- Form controls ---------- */
label { display: block; margin: var(--gap) 0 calc(var(--gap) / 2); font-weight: 600; font-size: var(--fs-base); }

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea) {
  width: 100%;
  min-height: var(--input-h);
  padding: calc(var(--gap) / 2) var(--gap);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
}
:where(input[type="checkbox"], input[type="radio"]) { width: 16px; height: 16px; accent-color: var(--c-blue); }
:where(input[type="color"]) { width: 64px; height: var(--input-h); padding: 2px; border: 1px solid var(--c-border-strong); border-radius: var(--radius); background: var(--c-surface); }
:where(input, select, textarea)::placeholder { color: #6B7482; opacity: 1; }   /* 4.8:1 */
:where(input, select, textarea):focus {
  outline: 2px solid var(--c-focus);
  outline-offset: 0;
  border-color: var(--c-focus);
}
:where(input, select, textarea):disabled, :where(input, textarea)[readonly] { background: var(--c-toolbar); color: var(--c-text-muted); }
:where(input[type="file"]) { padding: 3px var(--gap); }

/* ---------- Buttons ----------
   Default (any <button> without a class) = neutral secondary look: dark text
   on a light surface, always readable. .btn / .btn-primary = the one primary
   style: white text on brand blue. */
:where(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--btn-h);
  padding: 0 calc(var(--gap) * 1.4);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
:where(button):hover { background: var(--c-toolbar); }
:where(button):disabled { opacity: 0.5; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--btn-h);
  padding: 0 calc(var(--gap) * 1.6);
  border: 1px solid var(--c-blue);
  border-radius: var(--radius);
  background: var(--c-blue);
  color: var(--c-text-invert);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--c-blue-hover); border-color: var(--c-blue-hover); color: var(--c-text-invert); text-decoration: none; }
.btn:active { background: var(--c-navy-dark); }

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: var(--c-surface); font-size: var(--fs-base); }
table.grid th, table.grid td {
  border: 1px solid var(--c-border);
  padding: calc(var(--gap) * 0.6) var(--gap);
  text-align: left;
  vertical-align: middle;
}
table.grid thead th, table.grid tr th { background: var(--c-thead); font-weight: 600; }
table.grid tbody tr:nth-child(even) { background: var(--c-row-alt); }
table.grid tbody tr:hover { background: var(--c-row-hover); }
.pass { color: var(--c-pos); font-weight: 700; }
.fail { color: var(--c-neg); font-weight: 700; }
code { font-family: var(--font-num); font-size: var(--fs-sm); }
