:root {
  /* Token VALUES below are pulled from the researcher dashboard's real
     tokens file (dashboard/src/styles/tokens.css) so the two surfaces read
     as one product — names are kept as this file's own (--bg/--ink/etc.)
     so no usage site below needs to change, only these definitions. */
  --bg: #F8FAFC;         /* = --cadence-surface (Cloud White) */
  --card: #ffffff;       /* = --cadence-surface-card (already identical) */
  --ink: #0F172A;        /* = --cadence-text (Near-Black) */
  --ink-soft: #64748B;   /* = --cadence-text-muted (Mid-Slate) */
  --line: #E2E8F0;       /* = --cadence-border (Pale Slate) */
  --accent: #0D9488;     /* = --cadence-teal / --cadence-primary */
  --accent-ink: #ffffff; /* = --cadence-primary-contrast (already identical) */
  --good: #059669;       /* = --cadence-accepted (Signal Green) */
  /* --warn has no dashboard equivalent: the dashboard's only amber tokens
     (--cadence-rejected / --cadence-rejected-text / --cadence-warning-surface-*)
     are reserved exclusively for rejected/excluded-data semantics (see
     --rejected below), not general warnings, so this stays the portal's
     own value rather than being pointed at a token that means something
     narrower on the dashboard side. */
  --warn: #a6650a;
  --bad: #DC2626;        /* = --cadence-error (Alert Red — true errors only) */
  /* Rejected/high-ADI health scores are NOT a system error — matches the
     researcher dashboard's brand policy (see dashboard/src/styles/tokens.css
     "never red for rejected/excluded data"): amber, not red. Value is the
     dashboard's actual AA-contrast-safe amber token
     (--cadence-rejected-text), not the raw brandbook #D97706 swatch, which
     fails contrast at small badge-text sizes. --bad stays reserved for true
     errors (e.g. wearable sync failures). */
  --rejected: #B45309;
  --radius: 16px;        /* = --cadence-radius-lg (dashboard's .card radius) */
}

* { box-sizing: border-box; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  margin: 0;
  /* Fallback ordering matched to the dashboard's --cadence-font-body stack
     (-apple-system, 'Segoe UI', Roboto, sans-serif) so both surfaces default
     to the same system fonts. Not adding the dashboard's actual webfont
     ('Inter') here — this is a static HTML page with no build step/bundler
     to self-host or @font-face it from, so this is an intentional partial
     unification: same fallback character, no webfont load. */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.card .card-sub {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.brand-sub {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 14px 0 6px;
}

input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

textarea { resize: vertical; min-height: 70px; }

button, .btn {
  display: inline-block;
  border: none;
  border-radius: 9px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-block { width: 100%; margin-top: 18px; }

.btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-danger {
  background: #fff;
  color: var(--bad);
  border: 1px solid var(--bad);
}

.link-row { text-align: center; margin-top: 16px; font-size: 0.9rem; }
.link-row a { color: var(--accent); }

.msg { border-radius: 9px; padding: 10px 12px; font-size: 0.88rem; margin-bottom: 14px; }
.msg-error { background: #fdecea; color: var(--bad); }
.msg-good { background: #e9f5ef; color: var(--good); }
.msg-warn { background: #fdf3e3; color: var(--warn); }
.msg-hidden { display: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.topbar .brand { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge-good { background: #e9f5ef; color: var(--good); }
.badge-warn { background: #fdf3e3; color: var(--warn); }
.badge-bad { background: #fdecea; color: var(--bad); }
.badge-rejected { background: #FEF3E7; color: var(--rejected); }
.badge-neutral { background: #eef1f5; color: var(--ink-soft); }

.mood-row { display: flex; gap: 8px; margin-top: 6px; }
.mood-btn {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 0;
  border-radius: 9px;
  font-size: 1.3rem;
}
.mood-btn.selected { border-color: var(--accent); background: #eaf1f7; }

.wearable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.wearable-row:last-child { border-bottom: none; }
.wearable-name { font-weight: 600; }
.wearable-meta { color: var(--ink-soft); font-size: 0.82rem; }

.empty-state { color: var(--ink-soft); font-size: 0.9rem; padding: 6px 0; }

.checkin-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.checkin-item:last-child { border-bottom: none; }
.checkin-date { color: var(--ink-soft); font-size: 0.78rem; }

/* ---------------------------------------------------------------------------
   Self-enrolment consent, personal-device pairing and settings (2026-09-04).
   --------------------------------------------------------------------------- */

/* `select` was never styled here — the only form controls the portal had were
   the check-in textarea and the login inputs. Without this it renders as a
   raw platform dropdown next to the rounded inputs above. */
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.consent-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 18px 0 4px;
  color: var(--ink);
}

.consent-body {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

/* A checkbox plus its label on one line. `label` above is display:block with
   a top margin, which would otherwise drop the text under the box. */
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 4px;
}

.consent-check input[type="checkbox"] {
  /* The default 13px box is an unreliable tap target on a phone. */
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.consent-check label {
  margin: 0;
  font-weight: 400;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* The one-time device key and the push URL. Both are long, unbreakable
   strings that must be readable and selectable in full — so they wrap on any
   character rather than forcing the card to scroll sideways. */
.token-box {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  /* Selectable by keyboard too, for anyone who cannot use the copy button. */
  user-select: all;
}
