:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #222222;
  --muted: #6d6e71;
  --primary: #d50108;
  --green: #4cbb17;
  --accent: var(--green);
  --amber: #b96800;
  --red: #d00032;
  --border: #dddddf;
  --capillary-red: #d50108;
  --capillary-purple: #806ec6;
  --pink: #ffaaaf;
  --pink-light: #ffd2d4;
  --pink-soft: #ffe9ea;
  --surface: #f4f4f5;
  font-family: "Open Sans", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh; margin: 0; color: var(--text);
  background:
    radial-gradient(circle at 96% 0, rgba(255, 210, 212, 0.48), transparent 30rem),
    var(--bg);
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; width: 100%; min-width: 0;
  position: sticky; z-index: 20; top: 0; padding: 15px 28px;
  border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 14px rgba(65, 64, 66, 0.06); backdrop-filter: blur(10px);
}
.brand { display: flex; flex: 0 1 auto; align-items: center; min-width: 0; overflow: hidden; gap: 10px; color: #414042; font-weight: 800; font-size: 18px; letter-spacing: 0.045em; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.brand-icon { display: block; flex: none; width: 32px; height: 32px; border-radius: 6px; }
.user-area { display: flex; flex: 1 1 auto; align-items: center; justify-content: flex-end; min-width: 0; gap: 10px; }
.user-area > .small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-identity { display: flex; align-items: center; min-width: 0; gap: 8px; }
.user-identity .small { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.patient-id { color: var(--capillary-purple); font-size: 12px; font-weight: 800; }
#btn-logout { flex: 0 0 auto; white-space: nowrap; }

.container { max-width: 1380px; margin: 0 auto; padding: 32px 20px; }

.view { display: block; }
.view.hidden, .hidden { display: none !important; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; margin-bottom: 20px; box-shadow: 0 8px 26px rgba(65, 64, 66, 0.07);
}
.card.center { text-align: center; }

h1 { font-size: 24px; font-weight: 300; margin: 0 0 8px; }
h2 { font-size: 18px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.disclaimer { font-size: 12.5px; line-height: 1.5; }
.research-results-gate { padding: 24px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.research-results-gate > p { max-width: 75ch; }
.research-disclaimer { max-width: 85ch; margin-top: 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.research-consent-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.research-results-gate-acknowledged { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.metrics-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(23, 22, 24, 0.55); }
.metrics-modal.hidden { display: none; }
.metrics-modal-panel { position: relative; width: min(720px, 100%); max-height: 85vh; overflow-y: auto; padding: 26px 28px; border-radius: 14px; background: var(--card); box-shadow: 0 18px 50px rgba(23, 22, 24, 0.28); }
.metrics-modal-panel h3 { margin: 0 0 12px; padding-right: 40px; font-size: 20px; }
.metrics-modal-panel h4 { margin: 18px 0 6px; font-size: 15px; }
.metrics-modal-panel p { max-width: 75ch; line-height: 1.6; }
.metrics-modal-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.metrics-modal-close:hover { background: var(--pink-soft); }
.metrics-glossary { margin: 0; }
.metrics-glossary dt { margin-top: 14px; font-weight: 650; }
.metrics-glossary dd { margin: 4px 0 0; color: var(--muted); line-height: 1.55; }
.metrics-consent-checks { margin: 18px 0 0; padding: 0; border: 0; }
.metrics-consent-checks legend { padding: 0; font-weight: 650; }
.metrics-consent-checks label { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; line-height: 1.5; }
.metrics-consent-checks input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); }
.image-download { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 20px; }
.image-download .btn:disabled { opacity: 0.6; cursor: wait; }
.image-download .error { color: var(--red); }
.admin-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#export-submissions:disabled { opacity: 0.6; cursor: wait; }
.participant-link { color: var(--capillary-purple); text-decoration: underline; text-underline-offset: 3px; }
.participant-link code { color: inherit; font-weight: 750; overflow-wrap: anywhere; }
.participant-link:hover { color: var(--capillary-red); }

.btn {
  display: inline-block; min-height: 38px; padding: 8px 20px; border: 2px solid transparent; border-radius: 999px;
  cursor: pointer; font-weight: 700; font-size: 14px; transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #b90006; transform: translateY(-1px); }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: white; color: var(--capillary-red); border-color: var(--capillary-red); }
.btn.ghost:hover { color: white; background: var(--capillary-red); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea {
  width: 100%; padding: 10px 14px; border-radius: 999px;
  background: white; color: var(--text); border: 1px solid #bbbbbb;
}
input:focus, textarea:focus { outline: 3px solid rgba(213, 1, 8, 0.12); border-color: var(--primary); }
input[type="date"] { color-scheme: light; min-height: 42px; }
textarea { resize: vertical; min-height: 84px; border-radius: 12px; line-height: 1.45; }

.row { margin: 16px 0; }
.row label { display: block; margin-bottom: 6px; font-weight: 600; }

.intro-copy { margin: 0; line-height: 1.55; }
.eyebrow {
  display: block; margin-bottom: 7px; color: var(--capillary-red); font-size: 11px; font-weight: 800;
  letter-spacing: 0.11em; text-transform: uppercase;
}
.history-callout {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  overflow: hidden; padding: 25px 27px; border-color: rgba(97, 132, 246, 0.62);
  background:
    radial-gradient(circle at 88% 12%, rgba(128, 110, 198, 0.3), transparent 36%),
    linear-gradient(135deg, #1c2841, #1a2130 60%);
  box-shadow: 0 12px 32px rgba(4, 9, 18, 0.2);
}
.history-callout::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--primary), var(--capillary-purple));
}
.history-callout h1 { margin-bottom: 8px; font-size: 25px; }
.history-callout-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 0; font-size: 14px; }
.history-callout-summary strong { color: white; }
.history-callout-summary .muted::before { content: '·'; margin-right: 9px; }
.history-callout-action {
  flex: none; color: white; background: var(--primary); text-decoration: none; box-shadow: 0 7px 20px rgba(63, 107, 240, 0.25);
}
.history-callout-action:hover { background: #547cf3; }
.form-fields {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 0.55fr);
  gap: 16px; margin: 22px 0 26px;
}
.field { min-width: 0; }
.field label { display: block; margin-bottom: 7px; font-weight: 650; font-size: 14px; }
.field-description { grid-column: 1 / -1; }

.image-upload-section { border-top: 1px solid var(--border); padding-top: 22px; }
.section-heading.image-section-heading { align-items: flex-start; }
.image-section-heading h2 { margin-bottom: 5px; }
.upload-limits { margin: 0; line-height: 1.4; }
.image-total {
  flex: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); background: #121826; font-size: 12px; font-weight: 700;
}
.image-total.has-images { color: #b8c8ff; border-color: rgba(63, 107, 240, 0.65); background: rgba(63, 107, 240, 0.12); }

.finger-key {
  display: flex; align-items: center; gap: 24px; margin-top: 16px; padding: 13px 15px;
  border: 1px solid rgba(63, 107, 240, 0.35); border-radius: 10px; background: rgba(63, 107, 240, 0.08);
}
.finger-key-text { display: flex; align-items: flex-start; flex: 1; min-width: 0; gap: 12px; }
.finger-key-hands { display: block; flex: none; width: 244px; max-width: 100%; height: auto; border-radius: 8px; }
.finger-key-icon {
  display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 9px;
  background: var(--primary); color: white; font-size: 13px; font-weight: 800;
}
.finger-key strong { display: block; font-size: 14px; margin-bottom: 3px; }
.finger-key p { margin: 0; color: #b9c2cf; font-size: 13px; line-height: 1.5; }

.camera-workspace {
  margin-top: 18px; overflow: hidden; border: 1px solid #354363; border-radius: 16px;
  background: #0d131f; box-shadow: 0 18px 44px rgba(3, 8, 17, 0.28);
}
.camera-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px 19px;
  border-bottom: 1px solid var(--border); background: linear-gradient(120deg, #18233a, #151d2c 70%);
}
.camera-toolbar h3 { margin-bottom: 4px; font-size: 18px; }
.camera-toolbar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.camera-toolbar .eyebrow { margin-bottom: 4px; }
.camera-device-controls { flex: 0 1 620px; min-width: 440px; }
.camera-device-controls > label { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 700; }
.camera-device-row { display: flex; align-items: stretch; gap: 8px; }
.camera-device-row select {
  min-width: 0; flex: 1; padding: 9px 36px 9px 11px; border: 1px solid #3a4865; border-radius: 8px;
  color: var(--text); background: #0d1421; color-scheme: dark;
}
.camera-device-row select:focus { outline: 2px solid rgba(63, 107, 240, 0.4); border-color: var(--primary); }
.camera-device-row select:disabled { color: #7f8999; }
.camera-device-row .btn { padding: 9px 14px; white-space: nowrap; }
#camera-device-note, #camera-calibration-note:not(:empty) { display: block; margin-top: 5px; }
.camera-refresh { width: 42px; padding: 8px !important; font-size: 20px !important; line-height: 1; }
.camera-magnification-warning {
  display: flex; align-items: flex-start; gap: 14px; margin: 18px; padding: 18px 20px;
  color: #6a2300; background: #fff0b8; border: 3px solid #bc5700; border-radius: 10px;
}
.camera-magnification-warning strong { display: block; font-size: 21px; font-weight: 850; line-height: 1.25; }
.camera-magnification-warning p { margin: 8px 0 0; font-size: 16px; line-height: 1.5; }
.camera-magnification-symbol {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px;
  color: white; background: #a63e00; border-radius: 50%; font-size: 24px; font-weight: 900;
}

.camera-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; min-height: clamp(540px, 68vh, 820px); }
.camera-stage {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: clamp(540px, 68vh, 820px);
  overflow: hidden; background:
    radial-gradient(circle at center, rgba(50, 65, 91, 0.3), transparent 48%),
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(255,255,255,0.018) 32px),
    #05080e;
}
.camera-stage:focus-visible { z-index: 2; outline: 3px solid var(--primary); outline-offset: -3px; }
.camera-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #030508; }
.camera-placeholder {
  display: flex; flex-direction: column; align-items: center; max-width: 440px; padding: 30px;
  color: var(--muted); text-align: center; line-height: 1.55;
}
.camera-placeholder strong { margin: 13px 0 4px; color: var(--text); font-size: 20px; }
.camera-placeholder-icon {
  display: grid; place-items: center; width: 82px; height: 82px; border: 1px solid #33405a;
  border-radius: 24px; color: #8797b5; background: #111927;
}
.camera-placeholder-icon svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 3; }
.camera-reticle { position: absolute; z-index: 2; inset: 12%; pointer-events: none; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 10px; }
.camera-reticle::before, .camera-reticle::after, .camera-reticle span::before, .camera-reticle span::after {
  content: ''; position: absolute; width: 38px; height: 38px; border-color: rgba(255, 255, 255, 0.65); border-style: solid;
}
.camera-reticle::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-radius: 9px 0 0; }
.camera-reticle::after { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-radius: 0 9px 0 0; }
.camera-reticle span::before { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; border-radius: 0 0 0 9px; }
.camera-reticle span::after { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 9px; }
.camera-live-badge {
  position: absolute; z-index: 3; top: 14px; left: 14px; display: flex; align-items: center; gap: 7px;
  padding: 6px 9px; border: 1px solid rgba(255,255,255,0.16); border-radius: 999px;
  color: white; background: rgba(5, 8, 14, 0.72); backdrop-filter: blur(7px); font-size: 11px;
}
.camera-live-badge span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.16); }
.camera-live-badge em { color: #b8c0cf; font-style: normal; }
.camera-flash { position: absolute; z-index: 5; inset: 0; pointer-events: none; background: white; opacity: 0; }
.camera-flash.visible { animation: camera-flash 0.22s ease-out; }
.camera-countdown {
  position: absolute; z-index: 4; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; pointer-events: none;
  color: white; background: rgba(0, 0, 0, 0.28); text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}
.camera-countdown strong { font-size: clamp(80px, 12vw, 150px); line-height: 1; font-variant-numeric: tabular-nums; }
.camera-countdown span { font-size: 16px; font-weight: 600; }
.camera-delay-option { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 16px; font-size: 13px; }
.camera-delay-option select { padding: 7px 10px; border: 1px solid #bbbbbb; border-radius: 8px; color: var(--text); background: white; color-scheme: light; }
.camera-delay-option select:focus { outline: 3px solid rgba(213, 1, 8, 0.12); border-color: var(--capillary-red); }
.camera-countdown-cancel { width: 100%; margin-top: 8px; }
@keyframes camera-flash { 0% { opacity: 0.75; } 100% { opacity: 0; } }

.camera-capture-panel {
  display: flex; flex-direction: column; min-width: 0; padding: 17px; overflow-y: auto;
  border-left: 1px solid var(--border); background: #121a28;
}
.camera-capture-plan {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 15px; padding: 11px 12px; border: 1px solid #33405a; border-radius: 10px;
  background: #0e1522;
}
.camera-capture-plan label { min-width: 0; cursor: pointer; }
.camera-capture-plan label strong { display: block; margin-bottom: 2px; font-size: 13px; }
.camera-capture-plan label span { display: block; color: #a9b2c2; font-size: 10px; line-height: 1.35; }
.camera-capture-plan select {
  flex: 0 0 auto; min-width: 96px; padding: 8px 30px 8px 10px; border: 1px solid #3a4865;
  border-radius: 8px; color: #dce2ed; background: #0d1421; color-scheme: dark;
}
.camera-capture-plan select:focus { outline: 2px solid rgba(63, 107, 240, 0.4); border-color: var(--primary); }
.camera-finger-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.camera-finger-heading .eyebrow { margin-bottom: 3px; }
.camera-finger-heading strong { display: block; font-size: 15px; }
.camera-finger-heading .finger-code { color: #161c29; white-space: nowrap; }
.camera-finger-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 13px; }
.camera-finger-button {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 7px;
  min-width: 0; padding: 9px; border: 1px solid #33405a; border-radius: 9px; color: #dce2ed;
  background: #0e1522; text-align: left; cursor: pointer;
}
.camera-finger-button:hover { border-color: #687ba3; background: #172135; }
.camera-finger-button:focus-visible { outline: 2px solid rgba(63, 107, 240, 0.58); outline-offset: 1px; }
.camera-finger-button.selected { border-color: #6c8fff; background: rgba(63, 107, 240, 0.2); box-shadow: inset 0 0 0 1px rgba(63, 107, 240, 0.32); }
.camera-finger-button.complete { border-color: rgba(47, 191, 127, 0.58); }
.camera-finger-button span { grid-row: 1 / 3; color: white; font-size: 14px; font-weight: 850; }
.camera-finger-button small { overflow: hidden; color: #a9b2c2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.camera-finger-button em { position: absolute; top: 5px; right: 6px; color: #8995a8; font-size: 9px; font-style: normal; font-weight: 700; }
.camera-finger-button.complete em { color: #66d29f; }
.camera-shutter {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-top: 17px; padding: 15px;
  border: 0; border-radius: 12px; color: white; background: linear-gradient(135deg, #315ee7, #4e79f3);
  box-shadow: 0 9px 24px rgba(40, 82, 215, 0.3); cursor: pointer; font-size: 16px; font-weight: 700;
}
.camera-shutter:hover:not(:disabled) { background: linear-gradient(135deg, #426dec, #6388f4); }
.camera-shutter:focus-visible { outline: 3px solid rgba(126, 156, 255, 0.55); outline-offset: 2px; }
.camera-shutter:disabled { opacity: 0.46; cursor: default; box-shadow: none; }
.camera-shutter-icon { display: grid; place-items: center; width: 29px; height: 29px; border: 3px solid white; border-radius: 50%; }
.camera-shutter-icon::after { content: ''; width: 17px; height: 17px; border-radius: 50%; background: white; }
.camera-capture-status { min-height: 34px; margin: 8px 2px 0; line-height: 1.4; }
.camera-current-review { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.camera-current-review-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.camera-current-images { display: flex; align-items: center; gap: 7px; min-height: 78px; overflow-x: auto; }
.camera-current-thumbnail { position: relative; flex: 0 0 68px; width: 68px; height: 68px; overflow: hidden; border: 1px solid #34415a; border-radius: 8px; background: #070b12; }
.camera-current-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.camera-current-thumbnail span { position: absolute; left: 4px; bottom: 4px; padding: 2px 5px; border-radius: 999px; color: white; background: rgba(0,0,0,0.7); font-size: 9px; font-weight: 800; }
.camera-current-thumbnail button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,0.72); cursor: pointer; font-size: 17px; line-height: 1; }
.camera-current-thumbnail button:hover { background: var(--red); }
.camera-workspace > .alert { margin: 12px 15px 15px; }
#upload-form.uploading .camera-workspace { pointer-events: none; opacity: 0.72; }

.file-upload-options { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; background: #141b29; }
.file-upload-options > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px;
  color: #dce2ed; cursor: pointer; list-style: none;
}
.file-upload-options > summary::-webkit-details-marker { display: none; }
.file-upload-options > summary:hover { background: #182132; }
.file-upload-options > summary strong, .file-upload-options > summary small { display: block; }
.file-upload-options > summary small { margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.file-upload-chevron { color: var(--muted); font-size: 22px; transition: transform 0.16s ease; }
.file-upload-options[open] .file-upload-chevron { transform: rotate(180deg); }
.file-upload-options-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }

.folder-upload-zone {
  display: flex; align-items: center; gap: 13px; width: 100%; margin-top: 16px; padding: 13px 16px;
  border: 2px dashed var(--capillary-purple); border-radius: 12px; color: white;
  background: rgba(128, 110, 198, 0.88); text-align: left; cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.folder-upload-zone:hover { background: #8c7bcf; }
.folder-upload-zone:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.55); outline-offset: 2px; }
.folder-upload-zone.dragging { background: #9889d4; border-color: white; transform: translateY(-1px); }
.folder-upload-icon { display: grid; place-items: center; flex: 0 0 38px; }
.folder-upload-zone strong { display: block; font-size: 15px; margin-bottom: 2px; }
.folder-upload-zone small { display: block; opacity: 0.9; line-height: 1.4; }
.folder-status { margin-top: 9px; padding: 9px 12px; border-radius: 8px; line-height: 1.4; }
.folder-status.ok { color: #7bdbad; background: rgba(47, 191, 127, 0.1); border: 1px solid rgba(47, 191, 127, 0.32); }
.folder-status.warn { color: #f0c56e; background: rgba(232, 166, 36, 0.1); border: 1px solid rgba(232, 166, 36, 0.32); }

.hand-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.hand-panel { min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: #151c2a; }
.hand-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 10px; }
.finger-uploaders { display: flex; flex-direction: column; gap: 17px; }
.finger-uploader { min-width: 0; }
.finger-uploader-heading { display: flex; align-items: center; min-height: 30px; gap: 9px; margin-bottom: 7px; }
.finger-code {
  display: inline-grid; place-items: center; min-width: 38px; min-height: 27px; padding: 3px 7px;
  border-radius: 7px; background: #e9edf7; color: #161c29; font-size: 13px; font-weight: 850;
}
.finger-name { min-width: 0; flex: 1; color: #d8deea; font-size: 13px; font-weight: 650; }
.finger-count {
  display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 999px; background: #101622; color: var(--muted); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700;
}
.finger-uploader.has-files .finger-count { color: white; background: var(--primary); border-color: var(--primary); }
.finger-dropzone {
  display: flex; align-items: center; min-width: 0; height: 154px; padding: 9px 10px;
  overflow-x: auto; overflow-y: hidden; border: 2px dashed rgba(213, 1, 8, 0.72); border-radius: 16px;
  background: #111827; color: #c8d0de; cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
  scrollbar-color: var(--border) transparent; scrollbar-width: thin;
}
.finger-dropzone:hover, .finger-dropzone:focus-visible, .finger-dropzone.dragging {
  background: #182136; border-color: #f0474d; outline: none;
}
.finger-dropzone:focus-visible { box-shadow: 0 0 0 3px rgba(213, 1, 8, 0.18); }
.finger-dropzone-empty { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; text-align: left; }
.finger-dropzone-empty strong { display: block; font-size: 13px; }
.finger-dropzone-empty small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.add-image-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #46536a;
  border-radius: 50%; color: white; font-size: 24px; font-weight: 300; line-height: 1;
}
.thumbnail-list { display: flex; align-items: center; gap: 9px; min-width: 100%; height: 100%; }
.thumbnail-preview {
  position: relative; flex: 0 0 112px; width: 112px; height: 126px; overflow: hidden;
  border-radius: 8px; background: #0a0f19; border: 1px solid #303b50;
}
.thumbnail-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumbnail-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; color: #7f899b;
  background: linear-gradient(145deg, #1e2838, #101622); font-size: 11px; font-weight: 750; letter-spacing: 0.08em;
}
.thumbnail-preview:not(.preview-unavailable) .thumbnail-fallback { display: none; }
.thumbnail-preview.preview-unavailable img { display: none; }
.thumbnail-remove {
  position: absolute; z-index: 2; top: 5px; right: 5px; display: grid; place-items: center;
  width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%;
  color: white; background: rgba(8, 12, 20, 0.72); cursor: pointer; font-size: 20px; line-height: 1;
}
.thumbnail-remove:hover, .thumbnail-remove:focus-visible { background: var(--red); outline: none; }
.thumbnail-name {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 18px 7px 7px;
  overflow: hidden; color: white; background: linear-gradient(transparent, rgba(0, 0, 0, 0.86));
  font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap;
}
.thumbnail-add-more {
  display: flex; flex: 0 0 68px; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; height: 100%; color: var(--muted); text-align: center;
}
.thumbnail-add-more span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #46536a; border-radius: 50%; color: white; font-size: 21px; }
.thumbnail-add-more small { font-size: 11px; }
.finger-message { margin: 6px 3px 0; line-height: 1.4; }

.upload-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.upload-actions .btn { flex: none; }
#upload-progress { margin-top: 14px; }
#upload-form.uploading .finger-dropzone, #upload-form.uploading .folder-upload-zone { pointer-events: none; opacity: 0.65; }

.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress.hidden { display: none; }
.progress .bar { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.18s ease; }
.progress.indeterminate .bar { width: 100% !important; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.alert { border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-size: 14px; }
.alert.error { background: rgba(232,72,77,0.14); border: 1px solid var(--red); color: var(--red); }
.alert.warn { background: rgba(232,166,36,0.14); border: 1px solid var(--amber); color: var(--amber); }
.alert.success { background: rgba(47,191,127,0.12); border: 1px solid rgba(47,191,127,0.55); color: #73d6a7; }
.alert.success a { color: white; font-weight: 700; }
.magic-link-form { max-width: 440px; margin: 18px auto 0; text-align: left; }
.magic-link-form .btn { width: 100%; }
.ok { color: var(--accent); }
.warn { color: var(--amber); }
.error { color: var(--red); }

.quality { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.quality-pending { margin: 4px 0 10px; }
.quality-counts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0;
}
.quality-counts > div {
  display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 9px; background: #121826;
}
.quality-counts > div.has-quality-exclusions { border-color: rgba(232, 72, 77, 0.62); background: rgba(232, 72, 77, 0.08); }
.quality-counts strong { flex: none; color: white; font-size: 20px; }
.quality-counts span { color: var(--muted); font-size: 12px; line-height: 1.3; }
.quality-details { margin: 18px 0; padding-top: 17px; border-top: 1px solid var(--border); }
.quality-details-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.quality-details-heading h3 { font-size: 15px; }
.quality-image-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quality-image-card {
  display: grid; grid-template-columns: 138px minmax(0, 1fr); min-width: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: 10px; background: #121826;
}
.quality-image-card.excluded { border-color: rgba(232, 72, 77, 0.62); }
.quality-image-preview {
  display: grid; place-items: center; width: 138px; min-height: 142px; overflow: hidden;
  color: var(--muted); background: #090e17; cursor: zoom-in; text-decoration: none;
}
.quality-image-preview img { display: block; width: 100%; height: 100%; min-height: 142px; max-height: 178px; object-fit: contain; }
.quality-image-preview[aria-busy="true"] { cursor: progress; opacity: 0.68; }
.quality-image-unavailable { padding: 12px; text-align: center; font-size: 11px; }
.quality-image-body { min-width: 0; padding: 12px; }
.quality-image-title { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 10px; }
.quality-image-title > span:last-child { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.quality-image-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; color: var(--muted); font-size: 11px; }
.quality-image-meta strong { color: white; font-size: 12px; }
.quality-index.good { color: #73d6a7; }
.quality-index.fair { color: #efc36d; }
.quality-index.poor { color: #f1787c; }
.quality-image-status { padding: 3px 7px; border-radius: 999px; font-weight: 700; }
.quality-image-status.included { color: #73d6a7; background: rgba(47, 191, 127, 0.12); }
.quality-image-status.excluded { color: #f1787c; background: rgba(232, 72, 77, 0.14); }
.quality-problem-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; padding: 0; list-style: none; }
.quality-problem-list li {
  padding: 4px 7px; border: 1px solid rgba(232, 166, 36, 0.44); border-radius: 6px;
  color: #efc36d; background: rgba(232, 166, 36, 0.1); font-size: 10.5px; line-height: 1.25;
}
.quality-no-problems { margin: 10px 0 0; color: #73d6a7; font-size: 11px; }
.quality-image-pending { margin: 10px 0 0; }
.goverlay { background: rgba(9, 10, 13, 0.94); }
.glightbox-clean .gclose, .glightbox-clean .gnext, .glightbox-clean .gprev { background-color: var(--capillary-red); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric { background: #121826; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { font-size: 18px; }
.metric small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.history { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  padding: 0;
  background: #121826; border: 1px solid var(--border); border-radius: 8px;
}
.history-summary { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; }
.history-title { flex: 1; }
.history-title .small { display: block; margin-top: 3px; }
.history-result { border-top: 1px solid var(--border); padding: 18px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-green { background: var(--accent); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-grey { background: var(--muted); }

.spinner {
  width: 34px; height: 34px; margin: 40px auto; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.admin-container { max-width: 1380px; }
.admin-page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.admin-page-heading h1 { font-size: 30px; font-weight: 650; }
.admin-page-heading p { margin: 0; }
.admin-page-heading .btn { flex: none; }
.admin-view-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.admin-view-switch .btn[aria-pressed="true"] { color: var(--capillary-red); background: var(--pink-soft); border-color: var(--primary); }
.recent-submissions-list { display: flex; flex-direction: column; gap: 10px; }
.recent-submission { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border: 1px solid var(--border); border-radius: 8px; }
.recent-submission-info { display: flex; flex-direction: column; gap: 5px; flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; }
.recent-submission-actions { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.recent-submission-actions .history-result-link { margin-bottom: 0; }
.recent-submissions-pagination { display: flex; justify-content: center; margin-top: 20px; }
#recent-submissions-panel .section-heading { flex-wrap: wrap; align-items: flex-start; }
#recent-submissions-panel .btn:disabled { opacity: 0.5; cursor: default; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-grid.has-selection { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.participant-list-card { min-width: 0; }
.participant-toolbar { display: flex; align-items: end; gap: 16px; }
.participant-toolbar label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.participant-toolbar input, .participant-toolbar select {
  min-height: 42px; border: 1px solid #bbbbbb; border-radius: 8px; padding: 9px 12px; color: var(--text); background: white;
}
.participant-page-size { flex: none; }
.participant-page-size select:focus-visible { outline: 3px solid rgba(213, 1, 8, 0.12); border-color: var(--primary); }
.participant-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 18px; }
.participant-pagination .btn { padding: 7px 14px; }
.participant-pagination .btn:disabled { opacity: 0.4; cursor: default; background: white; color: var(--capillary-red); }
.participant-empty { padding: 24px 0; text-align: center; }
.participant-panel { position: sticky; top: 90px; padding: 0; overflow: hidden; min-width: 0; }
.participant-panel-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px; border-bottom: 1px solid var(--border); background: var(--pink-soft); }
.participant-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.participant-panel-header > div { min-width: 0; }
.participant-panel-header h2 { margin: 0; }
.participant-panel-header p { margin: 6px 0 0; overflow-wrap: anywhere; }
.participant-panel-header .btn { flex: none; padding: 6px 14px; }
.participant-panel-content { container: participant-results / inline-size; max-height: calc(100dvh - 235px); overflow-y: auto; padding: 22px; overscroll-behavior: contain; }
.participant-panel .quality-details-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
.participant-panel .quality-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.participant-panel .quality-image-card { grid-template-columns: minmax(0, 1fr); align-content: start; }
.participant-panel .quality-image-preview { width: 100%; min-height: 0; aspect-ratio: 16 / 10; }
.participant-panel .quality-image-preview img { min-height: 0; max-height: none; }
.participant-panel .quality-image-title { align-items: flex-start; }
.participant-panel .quality-image-title > span:last-child { white-space: normal; overflow-wrap: anywhere; }
.participant-panel .history-summary { flex-wrap: wrap; gap: 8px; }
.participant-panel .history-title { min-width: 0; overflow-wrap: anywhere; }
@container participant-results (max-width: 520px) {
  .participant-panel .quality-image-grid { grid-template-columns: minmax(0, 1fr); }
}
.participant-provision { scroll-margin-top: 90px; }
.participant-provision-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; margin-top: 24px; }
.participant-provision-grid > div + div { border-left: 1px solid var(--border); padding-left: 32px; }
.csv-upload { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 10px; padding: 14px; border: 1px dashed #536483; border-radius: 9px; background: #121826; cursor: pointer; }
.csv-upload:hover, .csv-upload:focus-within { border-color: var(--primary); background: #172036; }
.csv-upload input { margin-top: 8px; color: var(--muted); font-size: 12px; }
#create-users-csv-form .btn { width: 100%; }
.csv-issue-list { margin: 10px 0 0; padding-left: 20px; color: #f0c56e; font-size: 12px; line-height: 1.55; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.participant-search { flex: 1; min-width: 0; }
.participant-search label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.participant-search input { width: 100%; }
.user-list { display: flex; flex-direction: column; gap: 8px; max-height: min(62vh, 820px); overflow-y: auto; scrollbar-gutter: stable; }
.user-row {
  display: flex; align-items: stretch; flex: none; width: 100%; color: var(--text); background: #121826;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.user-row:hover { border-color: var(--primary); }
.user-select {
  flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px; text-align: left; color: inherit; background: transparent; border: 0; cursor: pointer;
}
.user-select:hover { background: rgba(255, 255, 255, 0.025); }
.user-select:focus-visible, .capillary-patient-link:focus-visible {
  outline: 3px solid rgba(213, 1, 8, 0.22); outline-offset: -3px;
}
.user-select span span { display: block; margin-top: 3px; }
.user-row-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.user-row-arrow { flex: none; color: var(--capillary-red); }
.user-row > .participant-link { display: flex; align-items: center; flex: 0 0 clamp(110px, 20%, 170px); min-width: 0; padding: 12px; }
.user-row > .participant-link code { text-align: left; }
.user-row.selected { border-color: var(--capillary-red); box-shadow: inset 3px 0 var(--capillary-red); }
.user-row.selected .user-select { background: var(--pink-soft); }
.user-row code { color: var(--muted); overflow-wrap: anywhere; text-align: right; }
.capillary-patient-link {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 12px;
  border-top: 1px solid var(--border); color: var(--primary); font-size: 12px; font-weight: 750;
  text-decoration: none;
}
.capillary-patient-link:hover { text-decoration: underline; text-underline-offset: 3px; }
a.btn { text-decoration: none; }

.history-page-container { max-width: 1040px; }
.history-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.history-page-header h1 { margin-bottom: 7px; font-size: 30px; }
.history-page-header p { margin: 0; line-height: 1.5; }
.history-page-card { padding: 18px; }
.history-page-card .section-heading { padding: 2px 3px 14px; }
.history-result-link {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 16px; color: var(--capillary-red);
  font-size: 13px; font-weight: 750; text-decoration: none;
}
.history-result-link:hover { color: #940005; text-decoration: underline; text-underline-offset: 3px; }
.history-result-actions { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-bottom: 16px; }
.history-result-actions .history-result-link { margin-bottom: 0; }
.history-page-header > .btn { flex: none; }
.comparison-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.comparison-heading h2 { margin-bottom: 5px; }
.comparison-heading p { margin: 0; }
.comparison-disclaimer { margin: 18px 0; padding: 14px 18px; border-left: 3px solid var(--capillary-purple); border-radius: 0 8px 8px 0; background: var(--surface); font-size: 14px; line-height: 1.6; }
.comparison-disclaimer p { margin: 0; }
.comparison-disclaimer p + p { margin-top: 8px; }
.comparison-selection { min-width: 0; margin: 20px 0; padding: 0; border: 0; }
.comparison-selection legend { font-weight: 650; }
.comparison-selection > p { margin: 6px 0 12px; }
.comparison-selection-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.comparison-submission-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.comparison-submission-option:has(input:checked) { border-color: var(--capillary-purple); background: #f7f5fc; }
.comparison-submission-option input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--capillary-purple); }
.comparison-submission-option > span { min-width: 0; overflow-wrap: anywhere; }
.comparison-submission-option span span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.comparison-chart-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; }
.comparison-chart-heading label { display: grid; gap: 5px; max-width: 100%; font-size: 13px; }
.comparison-chart-heading select { width: 100%; min-width: 0; max-width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.comparison-chart-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.comparison-chart-scroll:focus-visible { outline: 2px solid var(--capillary-purple); outline-offset: 3px; }
.comparison-chart { display: block; min-width: 100%; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis, .chart-missing { fill: var(--muted); font-size: 12px; }
.chart-line { fill: none; stroke: #6954b2; stroke-width: 2; }
.chart-point { fill: #6954b2; stroke: white; stroke-width: 2; }
.chart-value { fill: var(--text); font-size: 12px; font-weight: 650; }
.comparison-chart-empty { padding: 20px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); }
.comparison-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.comparison-scroll:focus-visible { outline: 2px solid var(--capillary-purple); outline-offset: 3px; }
.comparison-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.comparison-table caption { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.comparison-table th, .comparison-table td { min-width: 155px; max-width: 220px; padding: 12px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); border-right: 1px solid var(--border); overflow-wrap: anywhere; }
.comparison-table tr > :last-child { border-right: 0; }
.comparison-table thead th { background: var(--surface); }
.comparison-table tbody tr:nth-child(even) { background: #fafafa; }
.comparison-table tr > th:first-child { position: sticky; left: 0; z-index: 1; min-width: 175px; width: 175px; background: var(--surface); }
.comparison-table thead a { display: block; color: var(--text); text-decoration: none; }
.comparison-table thead a span { display: block; margin-top: 4px; font-weight: 400; }
.comparison-table .comparison-result-link { color: var(--capillary-red); font-weight: 650; }
.comparison-table thead a:hover .comparison-result-link { text-decoration: underline; }
.comparison-processing { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 400; }
@media (max-width: 560px) {
  .history-comparison-card { padding: 18px 14px; }
  .comparison-table th, .comparison-table td { min-width: 145px; padding: 10px; }
  .comparison-table tr > th:first-child { min-width: 145px; width: 145px; }
}
.submission-page-card { padding: 20px; }
.submission-page-card > .alert:first-child, .submission-page-card > .quality:first-child { margin-top: 0; }
.back-link {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 17px; color: #b9c7ff;
  font-size: 13px; font-weight: 650; text-decoration: none;
}
.back-link:hover { color: white; }

/* Capillary.io light visual system. The live camera stage remains deliberately
   dark so translucent specimens and focus edges retain maximum contrast. */
.capture-card { border-top: 3px solid var(--capillary-red); }
#view-login .card, #view-not-granted .card, #view-denied .card { max-width: 560px; margin: 46px auto; }
code { padding: 2px 5px; border-radius: 5px; color: #414042; background: var(--surface); }

.history-callout {
  border-color: var(--pink-light);
  background:
    radial-gradient(circle at 90% 5%, rgba(128, 110, 198, 0.14), transparent 38%),
    linear-gradient(135deg, var(--pink-soft), #ffffff 64%);
  box-shadow: 0 10px 28px rgba(213, 1, 8, 0.08);
}
.history-callout::before { background: linear-gradient(var(--capillary-red), var(--capillary-purple)); }
.history-callout-summary strong { color: #414042; }
.history-callout-action { background: var(--capillary-red); box-shadow: 0 7px 18px rgba(213, 1, 8, 0.18); }
.history-callout-action:hover { background: #b90006; }

.image-total { color: #6d6e71; background: white; }
.image-total.has-images { color: var(--capillary-red); border-color: var(--pink); background: var(--pink-soft); }
.finger-key { border-color: var(--pink-light); background: var(--pink-soft); }
.finger-key-icon { background: var(--capillary-red); }
.finger-key p { color: #5c5c5f; }

.camera-workspace { border-color: #cfcfd1; background: white; box-shadow: 0 14px 36px rgba(65, 64, 66, 0.12); }
.camera-toolbar { border-bottom-color: var(--border); background: linear-gradient(120deg, #ffffff, #fff7f7); }
.camera-device-row select { color: var(--text); border-color: #bbbbbb; background: white; color-scheme: light; border-radius: 999px; }
.camera-device-row select:focus { outline: 3px solid rgba(213, 1, 8, 0.12); border-color: var(--capillary-red); }
.camera-device-row select:disabled { color: #939598; background: #f4f4f5; }
.camera-placeholder { color: #bbc0ca; }
.camera-placeholder strong { color: white; }
.camera-placeholder-icon { color: #d7d9df; background: rgba(255,255,255,0.06); }
.camera-capture-panel { border-left-color: var(--border); background: #ffffff; }
.camera-capture-plan { border-color: var(--pink-light); background: var(--pink-soft); }
.camera-capture-plan label span { color: #6d6e71; }
.camera-capture-plan select { color: var(--text); border-color: #bbbbbb; background: white; color-scheme: light; }
.camera-capture-plan select:focus { outline: 3px solid rgba(213, 1, 8, 0.12); border-color: var(--capillary-red); }
.camera-finger-button { color: #414042; border-color: #d8d8d8; background: #f7f7f8; }
.camera-finger-button:hover { border-color: var(--pink); background: var(--pink-soft); }
.camera-finger-button:focus-visible { outline-color: rgba(213, 1, 8, 0.28); }
.camera-finger-button.selected { border-color: var(--capillary-red); background: var(--pink-soft); box-shadow: inset 0 0 0 1px rgba(213, 1, 8, 0.14); }
.camera-finger-button.complete { border-color: rgba(76, 187, 23, 0.62); }
.camera-finger-button span { color: #222222; }
.camera-finger-button small { color: #6d6e71; }
.camera-finger-button em { color: #939598; }
.camera-finger-button.complete em { color: #368c0d; }
.camera-shutter { border-radius: 999px; background: var(--capillary-red); box-shadow: 0 8px 20px rgba(213, 1, 8, 0.22); }
.camera-shutter:hover:not(:disabled) { background: #b90006; }
.camera-shutter:focus-visible { outline-color: rgba(213, 1, 8, 0.3); }
.camera-current-review { border-top-color: var(--border); }
.file-upload-options { border-color: var(--border); background: white; }
.file-upload-options > summary { color: #414042; }
.file-upload-options > summary:hover { background: #fff7f7; }
.folder-upload-zone { color: var(--capillary-purple); border-color: var(--capillary-purple); background: #faf8ff; }
.folder-upload-zone:hover { background: #f1edff; }
.folder-upload-zone:focus-visible { outline-color: rgba(128, 110, 198, 0.28); }
.folder-upload-zone.dragging { color: white; border-color: var(--capillary-purple); background: var(--capillary-purple); }
.folder-status.ok { color: #287408; background: #eef9e9; }
.folder-status.warn { color: #925600; background: #fff7df; }
.hand-panel { background: #fcfcfc; }
.finger-code { color: #4b405f; background: #eeeafa; }
.finger-name { color: #414042; }
.finger-count { color: #6d6e71; background: white; }
.finger-uploader.has-files .finger-count { color: white; background: var(--capillary-red); border-color: var(--capillary-red); }
.finger-dropzone { color: #414042; border-color: rgba(213, 1, 8, 0.55); background: #fffafa; }
.finger-dropzone:hover, .finger-dropzone:focus-visible, .finger-dropzone.dragging { border-color: var(--capillary-red); background: var(--pink-soft); }
.add-image-icon, .thumbnail-add-more span { color: var(--capillary-red); border-color: var(--pink); background: white; }
.progress { background: #ececee; }
.progress .bar { background: linear-gradient(90deg, var(--capillary-red), var(--pink)); }

.alert.error { color: #a80029; border-color: #e28aa0; background: #fff0f4; }
.alert.warn { color: #815000; border-color: #e4bd78; background: #fff8e9; }
.alert.success { color: #287408; border-color: #a9d994; background: #eef9e9; }
.alert.success a { color: #1e5d05; }
.ok { color: #287408; }
.quality-counts > div, .quality-image-card, .metric, .history-item { background: #fafafa; }
.quality-counts strong, .quality-image-meta strong { color: #222222; }
.quality-counts > div.has-quality-exclusions, .quality-image-card.excluded { border-color: #e6a0b1; background: #fff7f9; }
.quality-index.good, .quality-no-problems, .quality-image-status.included { color: #287408; }
.quality-index.fair, .quality-problem-list li { color: #815000; }
.quality-index.poor, .quality-image-status.excluded { color: #a80029; }
.quality-image-status.included { background: #eaf7e4; }
.quality-image-status.excluded { background: #ffe9ef; }
.quality-problem-list li { border-color: #e4bd78; background: #fff8e9; }
.history-summary:hover { background: #fff7f7; }

.csv-upload { border-color: #bbbbbb; background: #fafafa; }
.csv-upload:hover, .csv-upload:focus-within { border-color: var(--capillary-red); background: var(--pink-soft); }
.csv-issue-list { color: #815000; }
.user-row { color: var(--text); border-color: var(--border); background: #fafafa; }
.user-row:hover { border-color: var(--capillary-red); background: #fff7f7; }
.user-select:hover { background: #fffafa; }
.user-row code { color: var(--capillary-purple); font-weight: 800; }
.capillary-patient-link { color: var(--capillary-red); border-top-color: var(--border); }
.back-link { color: var(--capillary-red); }
.back-link:hover { color: #940005; }

@media (max-width: 960px) {
  .admin-grid.has-selection { grid-template-columns: 1fr; }
  .has-selection .participant-list-card { display: none; }
  .participant-panel { position: static; scroll-margin-top: 90px; }
  .participant-panel-content { max-height: none; overflow: visible; }
}

@media (max-width: 800px) {
  .participant-provision-grid { grid-template-columns: 1fr; gap: 24px; }
  .participant-provision-grid > div + div { border-left: 0; border-top: 1px solid var(--border); padding: 24px 0 0; }
  .metrics { grid-template-columns: 1fr; }
  .history-summary { align-items: flex-start; flex-wrap: wrap; }
  .hand-columns { grid-template-columns: 1fr; }
  .history-callout, .history-page-header { align-items: flex-start; flex-direction: column; }
  .quality-image-grid { grid-template-columns: 1fr; }
  .quality-details-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .camera-toolbar { align-items: flex-start; flex-direction: column; }
  .camera-device-controls { flex: none; width: 100%; min-width: 0; }
}

@media (max-width: 1050px) {
  .camera-layout { grid-template-columns: 1fr; }
  .camera-capture-panel { border-top: 1px solid var(--border); border-left: 0; }
  .camera-finger-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .admin-page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .participant-panel.card { padding: 0; }
  .participant-panel-header, .participant-panel-content { padding: 18px 14px; }
  .participant-panel .quality-image-grid { grid-template-columns: 1fr; }
  .user-row code.user-row-id { flex-basis: 46px; }
  .quality-counts { grid-template-columns: 1fr; }
  .quality-image-card { grid-template-columns: 108px minmax(0, 1fr); }
  .quality-image-preview { width: 108px; }
  .topbar { gap: 10px; padding: 12px 16px; }
  .brand { font-size: 16px; }
  .user-area { gap: 8px; }
  .user-area > .small, .user-identity .small { display: none; }
  #btn-logout { padding-right: 14px; padding-left: 14px; }
  .container { padding: 20px 12px; }
  .card { padding: 18px 14px; }
  .form-fields { grid-template-columns: 1fr; }
  .field-description { grid-column: auto; }
  .section-heading.image-section-heading { align-items: flex-start; }
  .finger-key { flex-direction: column; align-items: stretch; gap: 16px; padding: 12px; }
  .finger-key-hands { align-self: center; width: 306px; }
  .camera-workspace { border-radius: 12px; }
  .camera-toolbar { padding: 14px; }
  .camera-device-row { flex-wrap: wrap; }
  .camera-device-row select { flex-basis: 100%; }
  .camera-device-row #camera-connect { flex: 1; }
  .camera-layout, .camera-stage { min-height: 310px; }
  .camera-stage { height: 55vh; max-height: 460px; }
  .camera-placeholder { padding: 20px; font-size: 13px; }
  .camera-placeholder strong { font-size: 17px; }
  .camera-capture-panel { padding: 14px; }
  .camera-capture-plan { align-items: stretch; flex-direction: column; }
  .camera-capture-plan select { width: 100%; }
  .camera-finger-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-current-review-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .file-upload-options-body { padding: 0 12px 12px; }
  .folder-upload-zone { padding: 12px; }
  .hand-panel { padding: 12px; }
  .upload-actions { align-items: stretch; flex-direction: column; }
  .upload-actions .btn { width: 100%; }
}

.password-form { margin: 1.25rem 0; }
.password-form .row { margin-bottom: 1rem; }
.password-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.password-form input { width: 100%; max-width: 32rem; }
.password-form input[id$="password"] { font-family: monospace; }

/* Missing credentials are the exceptional participant state. */
.password-warning { color: #815000; }
.user-row.password-required { border-color: #e4bd78; background: #fff8e9; }
.user-row.password-required code.user-row-id { color: #815000; }
.user-row.password-required:hover, .user-row.password-required .user-select:hover,
.user-row.password-required.selected .user-select { background: #fff2d4; }
.user-row.password-required.selected { box-shadow: inset 3px 0 #b47711; }
