/* BioRadius Accounts + the BioRadius sign-in page. One stylesheet, no framework, no web fonts.
   Brand: warm paper / near-black with the BioRadius orange (as on bioradiuscro.com). Every colour is a token;
   the page follows the device's light / dark setting. The sign-in page's only script is the DNA helix (dna.js). */
:root {
  color-scheme: light;
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f1efea;
  --ink: #151412; --ink-2: #3d3a35; --muted: #6f6b64;
  --line: #e6e3dc; --line-strong: #d3cfc6; --input-bg: #ffffff;
  --brand: #c2410c; --brand-strong: #c73e0a; --brand-2: #b93a0b; --brand-soft: #fdeee6; --brand-ink: #9a3412;
  --on-brand: #ffffff; --mark: #ff4d12;
  --nav: #151412; --nav-ink: #bdb8ae; --nav-accent: #ff7a45;
  --ok: #15803d; --ok-soft: #e6f4ea;
  --warn: #a15c00; --warn-soft: #fff3d6;
  --danger: #b42318; --danger-soft: #fdecea;
  --row-hover: #faf8f4; --focus-ring: rgba(234, 88, 12, .24);
  --shadow: 0 1px 2px rgba(28, 22, 14, .04), 0 2px 8px rgba(28, 22, 14, .05);
  --shadow-lg: 0 24px 48px -24px rgba(28, 22, 14, .22);
  --panel-ink: #f3f1ed;   /* text on the dark top bar */
  /* the DNA helix behind the sign-in card (dna.js reads these) */
  --dna-strand: #3d3a35; --dna-rung: #b3ada3; --dna-accent: #ff4d12;
  --radius: 14px; --radius-sm: 9px; --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c0b0a; --surface: #161513; --surface-2: #1d1b19;
    --ink: #f3f1ed; --ink-2: #cdc8bf; --muted: #9a948a;
    --line: #2a2825; --line-strong: #3a3733; --input-bg: #121110;
    --brand: #ff8a5c; --brand-strong: #ff6a33; --brand-2: #ff8a5c; --brand-soft: rgba(255, 106, 51, .14); --brand-ink: #ffb899;
    --on-brand: #140a05; --mark: #ff6a33;
    --nav: #080707; --nav-ink: #a9a398; --nav-accent: #ff7a45;
    --ok: #5ad48a; --ok-soft: rgba(34, 197, 94, .15);
    --warn: #f5c451; --warn-soft: rgba(245, 158, 11, .15);
    --danger: #ff8a80; --danger-soft: rgba(239, 68, 68, .15);
    --row-hover: #1b1a17; --focus-ring: rgba(255, 122, 69, .32);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, .6);
    --panel-ink: #f3f1ed;
    --dna-strand: #ececee; --dna-rung: #6f6f78; --dna-accent: #ff6a33;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; background: var(--nav); color: var(--nav-ink); }
.topbar .brand { display: inline-flex; align-items: center; gap: 9px; color: var(--panel-ink); font-weight: 700; letter-spacing: -.01em; }
.topbar .brand em { color: var(--nav-accent); font-style: normal; font-weight: 500; }
.brand-mark { width: 24px; height: 24px; fill: var(--mark); }
.topbar nav { display: flex; gap: 4px; flex: 1; } .topbar nav a { color: var(--nav-ink); padding: 6px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--panel-ink); background: rgba(255, 255, 255, .08); text-decoration: none; }
.topbar form { margin: 0; } .topbar .who { font-size: .85rem; }
.topbar button { background: transparent; color: var(--nav-ink); border-color: rgba(255, 255, 255, .2); }
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; } h2 { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); } .small { font-size: .84rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.narrow { max-width: 440px; margin: 56px auto; }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--focus-ring); }
.error { color: var(--danger); font-weight: 500; font-size: .84rem; }
button, .button { font: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; }
button:hover, .button:hover { background: var(--surface-2); text-decoration: none; }
button.primary, .button.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
button.primary:hover { background: var(--brand-2); }
button.danger { color: var(--danger); } button.small { padding: 4px 10px; font-size: .84rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: var(--row-hover); }
td a { color: var(--ink); } td a:hover { color: var(--brand); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: var(--danger-soft); color: var(--danger); } .badge.role { background: var(--brand-soft); color: var(--brand-ink); }
.none { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.access-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(160px, 260px) auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.access-row:last-child { border-bottom: 0; }
.access-row label { margin: 0; } .checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { flex-direction: row; align-items: center; font-weight: 500; }
code, .mono { font-family: var(--mono); font-size: .85em; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .access-row { grid-template-columns: 1fr; }
  main { padding: 16px 16px 48px; }
  /* People list on phones: one block per person, only the apps they may use */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  table.stack td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 96px; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); }
  table.stack td.empty { display: none; }
  table.stack tr:hover td { background: none; }
}
.card.compact { padding: 12px 16px; } .card.flush { padding: 0; overflow: hidden; } .card.flush.table-scroll { overflow-x: auto; } label.tight { margin: 0; }
.inline-form { display: inline; }
a.brand:hover { text-decoration: none; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ the BioRadius sign-in page */
body.signin-page { background: var(--bg); }
/* One centred card over a slow DNA helix (a calm version of the one on bioradiuscro.com). */
.signin { position: relative; isolation: isolate; display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }
.signin .dna { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.signin-top { padding: 28px 36px 0; }
.lockup { display: inline-flex; align-items: center; gap: 12px; }
.lockup-mark { width: 34px; height: 34px; fill: var(--mark); }
.lockup b { display: block; font-size: 1.2rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; color: var(--ink); }
.lockup small { display: block; margin-top: 5px; font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); }
.signin-foot { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0; padding: 0 20px 26px;
  font-size: .8rem; color: var(--muted); text-align: center; }

.signin-main { display: grid; place-items: center; padding: 32px 20px; }
.signin-card { width: 100%; max-width: 500px; padding: 36px 40px 30px; border: 1px solid var(--line); border-radius: 22px;
  background: var(--surface); box-shadow: var(--shadow-lg); }
.signin-card h1 { font-size: 2.1rem; letter-spacing: -.03em; line-height: 1.1; margin: 0 0 8px; }
.lede { margin: 0 0 24px; color: var(--muted); }
.signin-form { display: flex; flex-direction: column; gap: 16px; }
.app-grid { border: 0; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.app-grid legend, .admin-choice input, .app-option input { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; }
.app-option { margin: 0; cursor: pointer; }
.app-card { display: flex; align-items: center; gap: 12px; height: 100%; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s, box-shadow .15s; }
.app-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); transition: background .15s, color .15s; }
.app-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-text b { font-size: .98rem; font-weight: 650; color: var(--ink); }
.app-text small { font-size: .78rem; color: var(--muted); }
.app-option:hover .app-card { border-color: var(--muted); }
.app-option input:checked + .app-card { border-color: var(--brand-strong); background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-strong); }
.app-option input:checked + .app-card .app-icon { background: var(--brand-strong); color: var(--on-brand); }
.app-option input:focus-visible + .app-card, .admin-choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus-ring); }
.field { margin: 0; gap: 6px; font-size: .86rem; color: var(--ink-2); }
.field input { height: 46px; padding: 0 14px; border-radius: 11px; font-size: 1rem; }
.signin-btn { justify-content: center; gap: 10px; height: 50px; margin-top: 6px; border: 0; border-radius: 12px;
  background: var(--brand-strong); color: var(--on-brand); font-size: 1rem; font-weight: 650; letter-spacing: -.005em;
  box-shadow: var(--shadow-lg); transition: background .15s, transform .15s; }
.signin-btn:hover { background: var(--brand-2); }
.signin-btn:active { transform: translateY(1px); }
.signin-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.signin-btn .i { transition: transform .15s; } .signin-btn:hover .i { transform: translateX(3px); }
/* "Sign in to eCRF" — the chosen app's name, where :has() is supported (otherwise just "Sign in") */
.signin-form:has(input[value="ecrf"]:checked) .to::before { content: " to eCRF"; }
.signin-form:has(input[value="lims"]:checked) .to::before { content: " to LIMS"; }
.signin-form:has(input[value="screening"]:checked) .to::before { content: " to Screening"; }
.signin-form:has(input[value="attendance"]:checked) .to::before { content: " to Attendance"; }
.signin-form:has(input[value="accounts"]:checked) .to::before { content: " to Accounts"; }
.signin-btn .to { white-space: pre; margin-left: -10px; }
.admin-choice { margin: 2px 0 0; align-self: center; font-size: .84rem; font-weight: 500; color: var(--muted); cursor: pointer; }
.admin-choice span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid transparent; }
.admin-choice:hover span { color: var(--ink); }
.admin-choice input:checked + span { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-strong); }
/* Test mode: the apps with a test copy (made-up data) go there instead; the others are dimmed */
.test-choice { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: -4px 0 0; font-size: .88rem; font-weight: 600;
  color: var(--ink-2); cursor: pointer; }
.test-choice small { font-weight: 400; color: var(--muted); }
.test-choice input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.switch { position: relative; width: 36px; height: 20px; flex: none; border-radius: 999px; background: var(--line-strong);
  transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); transition: transform .15s; }
.test-choice input:checked + .switch { background: var(--warn); }
.test-choice input:checked + .switch::after { transform: translateX(16px); }
.test-choice input:focus-visible + .switch { box-shadow: 0 0 0 3px var(--focus-ring); }
.app-card { position: relative; }
.test-tag { display: none; position: absolute; top: -9px; right: 10px; padding: 1px 8px; border: 1px solid var(--warn);
  border-radius: 999px; background: var(--surface); color: var(--warn); font-size: .7rem; font-weight: 650; }
.signin-form:has(input[name="test"]:checked) .test-tag { display: inline-block; }
.signin-form:has(input[name="test"]:checked) .app-option.no-test { opacity: .45; }
.signin-form:has(input[name="test"]:checked):not(:has(input[value="accounts"]:checked)) .to::after { content: " (test)"; }
.help { margin: 22px 0 0; font-size: .82rem; color: var(--muted); text-align: center; }
.help.tight { margin: -6px 0 0; text-align: left; }
.who-chip { display: inline-flex; align-items: center; gap: 8px; margin: -8px 0 18px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font: 500 .85rem/1.2 var(--mono); }
.signin-card .flash { margin-bottom: 18px; }

@media (max-width: 900px) {
  .signin-top { padding: 20px 20px 0; }
  .signin-main { padding: 20px 16px 28px; }
  .signin-card h1 { font-size: 1.75rem; }
  /* Phones: the helix becomes two thin strands in the space above and below the card (dna.js), scrolling with
     the page instead of hiding behind the card. */
  .signin .dna { position: absolute; }
  .signin-main { padding: 60px 16px 64px; }
}
@media (max-width: 520px) {
  .signin-card { padding: 26px 20px 22px; border-radius: 18px; }
  .app-card { padding: 10px 12px; gap: 10px; }
  .app-icon { width: 34px; height: 34px; }
  .app-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .signin * { transition: none !important; } }
