/* =============================================================================
   JES CRM · base.css — element defaults (body, headings, links, tables, inputs),
   vtiger v7's: body 12 px Open Sans, strong / b / th semibold, controls 30 px high
   with a 1 px border and 13 px text. Every value comes from tokens.css. The control
   rules are wrapped in :where() so they weigh nothing: any class in components.css
   or layout.css overrides them without having to fight a selector.
   The public forms and the login page load this file through public.css, which
   points the tokens at their --public-* values first: their look does not change.
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  line-height: var(--line-height);
}

h1, h2, h3, h4 { margin: 0 0 var(--space-3); line-height: 1.25; font-weight: var(--font-weight-semibold); }
h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
h3, h4 { font-size: var(--font-size-btn); }
p { margin: 0 0 var(--space-3); }
small { font-size: var(--font-size-sm); }
strong, b { font-weight: var(--font-weight-semibold); }
hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-4) 0; }
code, pre, kbd { font-family: var(--font-family-mono); font-size: var(--font-size-sm); }
pre { margin: 0 0 var(--space-3); overflow-x: auto; }
img { max-width: 100%; }

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
:where(:focus-visible) { outline: 2px solid var(--color-focus-ring); outline-offset: 1px; }

/* ---------- tables ---------- */
:where(table) { border-collapse: collapse; }
:where(th, td) { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
:where(th) { font-weight: var(--font-weight-semibold); }

/* ---------- inputs ---------- */
:where(input, select, textarea, button) { font: inherit; color: inherit; }
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"]), select, textarea) {
  min-height: var(--control-height);
  padding: var(--control-padding);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--font-size-btn);
  max-width: 100%;
}
:where(textarea) { resize: vertical; }
:where(input:disabled, select:disabled, textarea:disabled) { background: var(--color-surface-alt); color: var(--color-text-muted); }
:where(input, textarea)::placeholder { color: var(--color-text-muted); }
:where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--color-primary); }
:where(label) { cursor: default; }
:where(fieldset) { margin: 0; padding: 0; border: 0; }
:where(legend) { padding: 0; font-weight: var(--font-weight-semibold); }

/* ---------- buttons: a plain bordered button unless a component class says otherwise ---------- */
:where(button) {
  padding: var(--btn-padding);
  border: 1px solid var(--color-btn-border);
  border-radius: var(--radius-sm);
  background: var(--color-btn-bg);
  font-size: var(--font-size-btn);
  line-height: var(--line-height);
  cursor: pointer;
}
:where(button:hover) { background: var(--color-row-hover); }
:where(button:disabled) { color: var(--color-text-muted); cursor: not-allowed; }

/* ---------- helpers every page may use ---------- */
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.is-number { text-align: right; font-variant-numeric: tabular-nums; }
