/* REOI shared web components — the website/portal layer of the design system.
   Import order: fonts/fonts.css → tokens.css → web.css.
   The website inherits the report's language (CLAUDE.md, Design block): same
   tokens, same display serif at the first impressions (wordmark, login).
   Every value is a var(--token). Investment tiers per DESIGN.md: login and
   report-delivery get the polish; admin interior is held to the quality floor.
   Mono is sanctioned HERE (filenames, IDs, hashes) — web-admin only, never
   in reports. */

/* ---------- base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  color: var(--color-ink);
  background: var(--color-paper);
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }

h1, h2 { font-family: var(--font-display); font-weight: var(--weight-medium); }
h1 { font-size: var(--text-2xl-size); line-height: var(--text-2xl-line); }
h2 { font-size: var(--text-xl-size);  line-height: var(--text-xl-line); }

.mono { font-family: var(--font-mono); font-size: var(--text-xs-size); }

/* the wordmark — display serif, letterspaced; the same voice as the report cover */
.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg-size);
  letter-spacing: 0.26em;
  color: var(--color-accent);
}

/* ---------- buttons ----------
   Labels say the action ("Download report"), never "OK"/"Submit". */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
}

.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--color-accent); color: var(--color-surface); }
.btn-primary:hover:not([disabled]) { background: var(--color-accent-dark); }

.btn-secondary { border-color: var(--color-rule-strong); color: var(--color-ink); background: var(--color-surface); }
.btn-secondary:hover:not([disabled]) { border-color: var(--color-accent); color: var(--color-accent); }

.btn-ghost { color: var(--color-accent); }
.btn-ghost:hover:not([disabled]) { background: var(--color-accent-tint); }

/* destructive only, and it always confirms before acting */
.btn-danger { background: var(--color-danger); color: var(--color-surface); }
.btn-danger:hover:not([disabled]) { opacity: 0.92; }

/* ---------- forms ----------
   Label above, help below; the error replaces the help and states the fix. */

.field { margin-bottom: var(--space-5); max-width: 26em; }

.field label {
  display: block;
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-1);
}

.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--font-ui-body);
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}

.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-ink-faint); }

.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-focus);
}

.field .help, .field .error {
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  margin-top: var(--space-1);
}

.field .help { color: var(--color-ink-faint); }
.field .error { color: var(--color-danger); display: none; }

.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--color-danger); }
.field.invalid .help { display: none; }
.field.invalid .error { display: block; }

/* ---------- status chips ----------
   Dot + label, never color alone. Failed states are actionable (pair with a ghost button). */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-rule);
  background: var(--color-surface);
}

.chip .dot { width: var(--space-2); height: var(--space-2); border-radius: var(--radius-lg); }

.chip-success   .dot { background: var(--color-success); }
.chip-warning   .dot { background: var(--color-warning); }
.chip-danger    .dot { background: var(--color-danger); }
.chip-tracking  .dot { background: var(--color-accent); }
.chip-neutral   .dot { background: var(--color-ink-faint); }

/* ---------- cards & modals ----------
   Elevation is meaningful: flat page, shadow-sm on cards, modal shadow only on modals. */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg-size);
  line-height: var(--text-lg-line);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-3);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: var(--space-6);
  max-width: 32em;
}

/* ---------- admin tables ----------
   Quality floor: sticky header, hairline rows, hover tint, right-aligned
   actions, mono for filenames/IDs, tabular numerals. Dense and consistent. */

.admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm-size); line-height: var(--text-sm-line); }

.admin-table th {
  position: sticky;
  top: 0;
  background: var(--color-paper);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-line);
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  text-align: left;
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  border-bottom: 1px solid var(--color-rule-strong);
}

.admin-table td {
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--color-rule);
  font-feature-settings: var(--font-features-figures);
}

.admin-table tbody tr:hover td { background: var(--color-accent-tint); }

.admin-table th.num, .admin-table td.num { text-align: right; }
.admin-table th.actions, .admin-table td.actions { text-align: right; padding-right: 0; }
.admin-table td.file { font-family: var(--font-mono); font-size: var(--text-xs-size); }
