/* Jacquard Trust Centre: v1 visual design on the Jacquard Design System "Wove v4.1".
 *
 * Tokens below are copied from Wove (tokens/colors.css, typography.css, spacing.css,
 * borders.css, motion.css), light theme only. Components consume the semantic roles,
 * never the raw palette. The CSP allows no scripts, no inline styles and no outside
 * fonts, so everything here is plain CSS with self-hosted fonts.
 */

/* --- Fonts (self-hosted, font-src 'self') --------------------------------------------- */
/* Each URL carries a hash of the file (?v=), checked by a test: a new font is a new URL. */
@font-face {
  font-family: "J Relais";
  src: url("/static/fonts/JQRDRelais-Medium.otf?v=518092353281") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/Outfit-Variable.ttf?v=947f6b8fe5ac") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens (Wove v4.1) ----------------------------------------------------------------- */
:root {
  /* Primitives used by the roles below */
  --maroon-300: #95336F; --maroon-400: #7A004B; --maroon-500: #670041; --maroon-600: #540037;
  --gold-50: #FBF7F0; --gold-100: #F6EFE0; --gold-200: #EFE2C8;
  --yellow-200: #FFF3B0; --yellow-400: #FFE661; --yellow-500: #F2CE00; --yellow-600: #C1A300;
  --grey-100: #C5C0C2; --grey-300: #847B80; --grey-400: #5E5559;
  --error-red-50: #F9D0D0;
  --rich-black: #15020C; --white: #FFFFFF;
  --rag-red: #DC2A50; --rag-green: #31B08A;

  /* Surfaces */
  --color-bg-canvas: var(--gold-50);
  --color-bg-surface: var(--gold-100);
  --color-bg-raised: var(--white);
  --color-bg-sunken: var(--gold-200);
  --color-bg-hover: rgba(21, 2, 12, 0.04);

  /* Text */
  --color-text-default: var(--rich-black);
  --color-text-muted: var(--grey-400);
  --color-text-link: var(--maroon-400);

  /* Borders */
  --color-border-default: var(--grey-100);
  --color-border-strong: var(--grey-300);
  --color-border-subtle: rgba(35, 26, 31, 0.10);
  --color-border-focus: var(--maroon-400);

  /* Actions: primary = Yellow with dark text; secondary = Maroon with white text */
  --color-primary: var(--yellow-400);
  --color-primary-hover: var(--yellow-500);
  --color-primary-active: var(--yellow-600);
  --color-on-primary: var(--rich-black);
  --color-secondary: var(--maroon-400);
  --color-secondary-hover: var(--maroon-500);
  --color-secondary-active: var(--maroon-600);
  --color-on-secondary: var(--white);

  /* Status */
  --color-success: var(--rag-green);
  --color-danger: var(--rag-red);
  --color-success-bg: #D9F2E9;
  --color-danger-bg: var(--error-red-50);

  /* Type */
  --font-display: "J Relais", "Outfit", system-ui, -apple-system, sans-serif;
  --font-sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --weight-light: 300; --weight-regular: 400; --weight-medium: 500;
  --text-display-size: 40px; --text-display-lh: 48px;
  --text-h1-size: 30px; --text-h1-lh: 38px;
  --text-h2-size: 24px; --text-h2-lh: 32px;
  --text-h3-size: 20px; --text-h3-lh: 28px;
  --text-body-lg-size: 16px; --text-body-lg-lh: 24px;
  --text-body-md-size: 14px; --text-body-md-lh: 20px;
  --text-body-sm-size: 13px; --text-body-sm-lh: 18px;
  --text-label-size: 12px; --text-label-lh: 16px;
  --tracking-caps: 0.03em;
  --tracking-tight: -0.01em;

  /* Space (4-8-16) */
  --space-4: 4px; --space-8: 8px; --space-12: 12px; --space-16: 16px;
  --space-24: 24px; --space-32: 32px; --space-48: 48px; --space-64: 64px;
  --grid-margin: 80px;

  /* Radius, borders, elevation */
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-full: 9999px;
  --border-width-hairline: 0.5px; --border-width-default: 1px; --border-width-strong: 2px;
  --shadow-sm: 0 1px 2px rgba(21, 2, 12, 0.06);
  --shadow-md: 0 4px 12px rgba(21, 2, 12, 0.08);
  --shadow-focus: 0 0 0 2px var(--color-border-focus);

  /* Motion */
  --ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-micro: 150ms;
}

@media (max-width: 1023px) { :root { --grid-margin: 40px; } }
@media (max-width: 767px) { :root { --grid-margin: 16px; } }

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-canvas);
  color: var(--color-text-default);
  font-family: var(--font-sans);
  font-size: var(--text-body-lg-size);
  line-height: var(--text-body-lg-lh);
  font-weight: var(--weight-light);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-8);
}
h1 { font-size: var(--text-h1-size); line-height: var(--text-h1-lh); }
h2 { font-size: var(--text-h2-size); line-height: var(--text-h2-lh); }
h3 { font-size: var(--text-h3-size); line-height: var(--text-h3-lh); }

p { margin: 0 0 var(--space-16); }

a {
  color: var(--color-text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-micro) var(--ease-enter);
}
a:hover { color: var(--color-secondary-hover); }

:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* --- Header and footer ------------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-16) var(--grid-margin);
  border-bottom: var(--border-width-default) solid var(--color-border-subtle);
  background: var(--color-bg-canvas);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-12);
  color: var(--color-text-default);
  text-decoration: none;
}
.brand:hover { color: var(--color-text-default); }

.wordmark { display: block; width: 116px; height: auto; color: var(--color-text-default); }

.brand-product {
  padding-left: var(--space-12);
  border-left: var(--border-width-default) solid var(--color-border-default);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.env-badge {
  display: inline-block;
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-full);
  background: var(--yellow-200);
  color: var(--color-on-primary);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.site-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-48) var(--grid-margin) var(--space-64);
}

.site-footer {
  padding: var(--space-24) var(--grid-margin);
  border-top: var(--border-width-default) solid var(--color-border-subtle);
  font-size: var(--text-body-sm-size);
  line-height: var(--text-body-sm-lh);
  font-weight: var(--weight-regular);
  color: var(--color-text-muted);
}
.site-footer p { margin: 0; }

/* --- Panels (sign-in and message pages) -------------------------------------------------- */
.panel {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-48);
  background: var(--color-bg-raised);
  border: var(--border-width-default) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
@media (max-width: 767px) { .panel { padding: var(--space-32) var(--space-24); } }

.eyebrow {
  margin: 0 0 var(--space-12);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-secondary);
}

.lede { color: var(--color-text-muted); }

.panel-footer {
  margin: var(--space-24) 0 0;
  padding-top: var(--space-16);
  border-top: var(--border-width-default) solid var(--color-border-subtle);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
}

/* --- Forms -------------------------------------------------------------------------------- */
form { margin: 0; }

label {
  display: block;
  margin: var(--space-24) 0 var(--space-8);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
}

input:not([type="hidden"]) {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  background: var(--color-bg-raised);
  color: var(--color-text-default);
  /* Wove's border-default (grey-100) is 1.8:1 on white: too faint to mark a field (WCAG
     1.4.11 needs 3:1), so fields use border-strong (grey-300, about 4:1). */
  border: var(--border-width-default) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-body-lg-size);
  font-weight: var(--weight-regular);
  transition: border-color var(--duration-micro) var(--ease-enter),
    box-shadow var(--duration-micro) var(--ease-enter);
}
input:not([type="hidden"]):hover { border-color: var(--grey-400); }
input:not([type="hidden"]):focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

.input-code {
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-lh);
  letter-spacing: 0.3em;
  text-align: center;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* --- Buttons (pill, uppercase labels; one primary per region) ----------------------------- */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: 40px;
  margin-top: var(--space-24);
  padding: 0 var(--space-24);
  border: var(--border-width-default) solid transparent;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-micro) var(--ease-enter),
    border-color var(--duration-micro) var(--ease-enter);
}
button:hover, .button:hover { background: var(--color-primary-hover); color: var(--color-on-primary); }
button:active, .button:active { background: var(--color-primary-active); }
button:focus-visible, .button:focus-visible { border-radius: var(--radius-full); }

.button-block { width: 100%; }

.button-secondary { background: var(--color-secondary); color: var(--color-on-secondary); }
.button-secondary:hover { background: var(--color-secondary-hover); color: var(--color-on-secondary); }
.button-secondary:active { background: var(--color-secondary-active); }

.button-ghost {
  background: transparent;
  color: var(--color-text-default);
  border-color: var(--color-border-default);
}
.button-ghost:hover { background: var(--color-bg-hover); color: var(--color-text-default); }
.button-ghost:active { background: var(--color-bg-hover); }

/* --- Messages (Wove Banner) ---------------------------------------------------------------- */
[role="alert"],
[role="status"] {
  padding: var(--space-12) var(--space-16);
  border-radius: var(--radius-md);
  border: var(--border-width-default) solid transparent;
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
}
[role="alert"] {
  background: var(--color-danger-bg);
  border-color: rgba(220, 42, 80, 0.35);
}
[role="status"] {
  background: var(--color-success-bg);
  border-color: rgba(49, 176, 138, 0.35);
}

/* --- Page header (signed-in pages) --------------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-16);
  margin-bottom: var(--space-32);
}
.page-header h1 { margin: 0; }
.page-header .lede { margin: var(--space-8) 0 0; }
.page-header form button { margin-top: 0; }

/* --- Cards and empty states ---------------------------------------------------------------- */
.card {
  padding: var(--space-24);
  background: var(--color-bg-raised);
  border: var(--border-width-default) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  padding: var(--space-48) var(--space-24);
  text-align: center;
  background: var(--color-bg-surface);
  border: var(--border-width-default) dashed var(--color-border-default);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
}
.empty-state h2 { color: var(--color-text-default); }
.empty-state p { margin: 0; }

/* Admin section tiles: each tile is one link */
.tile-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-16);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  display: block;
  height: 100%;
  padding: var(--space-24);
  background: var(--color-bg-raised);
  border: var(--border-width-default) solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--color-text-default);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-lh);
  font-weight: var(--weight-medium);
  transition: box-shadow var(--duration-micro) var(--ease-enter),
    border-color var(--duration-micro) var(--ease-enter);
}
.tile:hover { color: var(--color-text-default); border-color: var(--color-border-default); box-shadow: var(--shadow-md); }
.tile:focus-visible { border-radius: var(--radius-lg); }

/* --- Admin forms and tables ---------------------------------------------------------------- */
.form-card { margin-bottom: var(--space-32); }
.form-card h2 { margin-bottom: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0 var(--space-16);
  align-items: end;
}
@media (max-width: 767px) { .form-row { grid-template-columns: 1fr; } }

.table-wrap {
  overflow-x: auto;
  background: var(--color-bg-raised);
  border: var(--border-width-default) solid var(--color-border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
  font-feature-settings: "tnum" 1, "lnum" 1;
}
th, td {
  padding: var(--space-12) var(--space-16);
  text-align: left;
  border-bottom: var(--border-width-default) solid var(--color-border-subtle);
}
th {
  background: var(--color-bg-surface);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--color-bg-hover); }

.back-link {
  margin-top: var(--space-32);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
}

/* --- Staff page (TC-52). Scoped to the page so other sections' selects are unaffected. ----- */
.staff-page select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  background: var(--color-bg-raised);
  color: var(--color-text-default);
  border: var(--border-width-default) solid var(--color-border-strong); /* as inputs: 3:1 */
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-body-lg-size);
  font-weight: var(--weight-regular);
}
.staff-page select:hover { border-color: var(--grey-400); }
.staff-page select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}
.staff-page td form { display: flex; align-items: center; gap: var(--space-8); }
.staff-page td form + form { margin-top: var(--space-8); }
.staff-page td select { width: auto; min-height: 40px; font-size: var(--text-body-md-size); }
.staff-page td button { margin-top: 0; }
.staff-page .member-detail { display: block; color: var(--color-text-muted); }
.staff-page .object-id {
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.staff-page .muted { color: var(--color-text-muted); }

/* --- Error page ---------------------------------------------------------------------------- */
.error-code {
  font-family: var(--font-display);
  font-size: var(--text-display-size);
  line-height: var(--text-display-lh);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-tight);
  color: var(--color-secondary);
}

.nowrap { white-space: nowrap; }

/* --- Invitations and NDA (invitations + NDA session) --------------------------------------- */
textarea {
  display: block;
  width: 100%;
  padding: var(--space-12);
  background: var(--color-bg-raised);
  color: var(--color-text-default);
  border: var(--border-width-default) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--weight-regular);
}
textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}

.field-hint {
  margin: 0 0 var(--space-8);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  color: var(--color-text-muted);
}

.form-error { font-weight: var(--weight-medium); }

/* A checkbox with its label beside it (the base rule makes inputs full-width blocks). */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
  margin: var(--space-24) 0;
}
.checkbox-row input[type="checkbox"] {
  display: inline-block;
  flex: none;
  width: 20px;
  min-height: 20px;
  height: 20px;
  margin: 2px 0 0;
  padding: 0;
}
.checkbox-row label { margin: 0; }

.nda-current { margin-bottom: var(--space-32); }
.nda-meta {
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  color: var(--color-text-muted);
}

/* The NDA text: normal size and contrast, never a small scrolling box (NDA-5, P8). */
.nda-text {
  max-width: 72ch;
  padding-top: var(--space-16);
  border-top: var(--border-width-default) solid var(--color-border-subtle);
}
.nda-text h3, .nda-text h4, .nda-text h5 { margin-top: var(--space-24); }
.nda-text ul { margin: 0 0 var(--space-16); padding-left: var(--space-24); }
.nda-text strong { font-weight: var(--weight-medium); }

/* --- Motion -------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

/* --- Logs and People (admin) --------------------------------------------------------------- */
/* Filter bars: fields side by side on wide screens, stacked on narrow ones. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-8) var(--space-16);
  margin-bottom: var(--space-24);
}
.filter-field { flex: 1 1 200px; }
.filter-field label { margin-top: 0; }
.filter-field select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  background: var(--color-bg-raised);
  color: var(--color-text-default);
  border: var(--border-width-default) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-body-lg-size);
}
.filter-field select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: var(--shadow-focus);
}
.filter-check {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 44px;
}
.filter-check input[type="checkbox"] {
  display: inline-block;
  width: 20px;
  min-height: 0;
  height: 20px;
  margin: 0;
  accent-color: var(--color-secondary);
}
.filter-check label { margin: 0; }
.filter-actions { display: flex; gap: var(--space-8); }
.filter-actions button,
.filter-actions .button { margin-top: 0; }
.filter-note {
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
}

/* Status labels on the People page. Text says the status; colour only supports it. */
.status {
  display: inline-block;
  margin: 0 var(--space-4) var(--space-4) 0;
  padding: 0 var(--space-8);
  border-radius: var(--radius-full);
  border: var(--border-width-default) solid var(--color-border-default);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.status-active { background: var(--color-success-bg); border-color: rgba(49, 176, 138, 0.35); }
.status-invited { background: var(--yellow-200); border-color: var(--yellow-600); }
.status-revoked { background: var(--color-bg-sunken); color: var(--color-text-muted); }
.status-locked { background: var(--color-danger-bg); border-color: rgba(220, 42, 80, 0.35); }
.status-note {
  margin: var(--space-4) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-label-size);
  line-height: var(--text-label-lh);
}

.company-group { margin-bottom: var(--space-32); }
.company-group h2 { margin-bottom: var(--space-12); }

/* The same column widths under every company, so the tables line up down the page. */
.people-table { table-layout: fixed; min-width: 960px; }
.people-table th:nth-child(1) { width: 12%; }
.people-table th:nth-child(2) { width: 18%; }
.people-table th:nth-child(3) { width: 14%; }
.people-table th:nth-child(4) { width: 10%; }
.people-table th:nth-child(5) { width: 13%; }
.people-table th:nth-child(6) { width: 9%; }
.people-table th:nth-child(7) { width: 24%; }
.people-table td { overflow-wrap: anywhere; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8) var(--space-12);
}
.row-actions button,
.row-actions .button {
  margin-top: 0;
  min-height: 32px;
  padding: 0 var(--space-12);
  white-space: nowrap;
}

.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-8) var(--space-24);
  margin: 0 0 var(--space-24);
}
.detail-list dt { color: var(--color-text-muted); }
.detail-list dd { margin: 0; }

.button-row { display: flex; flex-wrap: wrap; gap: var(--space-12); align-items: center; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: var(--space-16);
  margin-top: var(--space-16);
}
