:root {
  /* Institute of Nuclear Medicine brand (shared with the Clinical Trials Academy) */
  --inm-navy: #34379c; --inm-navy-dark: #1e2065; --inm-mid: #7189c4; --inm-pale: #b9d0de;
  --inm-hero: linear-gradient(155deg, #15184f 0%, #252a7d 55%, #34379c 100%);
  --inm-button: linear-gradient(120deg, #7189c4, #34379c);
  --bg: #f6f7fb; --card: #fff; --text: #101014; --muted: #6b6b74; --line: #e7e7ec;
  --accent: var(--inm-navy); --ok: #15803d; --danger: #b91c1c; --warn-bg: #fff7e0; --warn-line: #e8c46a;
  --a: #2a78d6; --b: #eb6834; /* modality A / B in charts (validated colour-blind-safe pair) */
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; } h2 { font-size: 1.2rem; margin: 0 0 .6rem; } h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
kbd { border: 1px solid #c8ccd3; border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; background: #fafafa; color: #333; }
a:hover { color: var(--inm-navy-dark); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1.4rem; background: var(--inm-hero); color: #fff; flex-wrap: wrap; gap: .5rem; }
.topbar nav a { color: #dfe6f3; text-decoration: none; margin-left: 1.1rem; font-size: .92rem; }
.topbar nav a:hover { color: #fff; }
.topbar .muted { color: var(--inm-pale); margin-left: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .8rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { height: 22px; width: auto; display: block; filter: brightness(0) invert(1); }
.brand .brand-sep { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .35); }
.brand .brand-name { font-weight: 600; letter-spacing: .01em; }

/* ------------------------------------------------------------------ landing page */
body.landing { background: #fff; }
.landing main { margin: 0; max-width: none; padding: 0; }
.hero { background: var(--inm-hero); color: #fff; }
.hero-inner { max-width: 1040px; margin: 0 auto; padding: 44px 24px 120px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hero-top img { width: 120px; display: block; filter: brightness(0) invert(1); }
.hero-top a.admin-link { color: rgba(255, 255, 255, .7); font-size: 13px; text-decoration: none; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px; padding: 7px 14px; }
.hero-top a.admin-link:hover { color: #fff; border-color: #fff; }
.hero .org { font-size: 12px; font-weight: 600; letter-spacing: .26em; color: var(--inm-pale); margin-top: 26px; }
.hero h1 { font-size: 44px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; margin: 10px 0 0; }
.hero .bar { height: 2px; width: 120px; background: linear-gradient(120deg, var(--inm-pale), var(--inm-mid), #fff); margin: 22px 0 18px; }
.hero .tagline { font-size: 17px; line-height: 1.6; color: #dfe6f3; max-width: 620px; margin: 0; font-weight: 300; }
.landing-body { max-width: 1040px; margin: -84px auto 0; padding: 0 24px 56px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.signin { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px 30px; box-shadow: 0 18px 40px rgba(21, 24, 79, .12); }
.signin .meta { font-size: 12px; letter-spacing: .12em; color: #8a8a94; text-transform: uppercase; }
.signin h2 { font-size: 22px; font-weight: 500; margin: 6px 0 4px; }
.signin .lead { font-size: 15px; color: #45454f; line-height: 1.6; }
.signin .btn.primary { width: 100%; padding: .75rem 1rem; font-size: 1rem; margin-top: 1rem; }
.how { padding-top: 104px; }
.how h3 { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8a8a94; margin: 0 0 14px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 13px 16px 13px 54px; background: var(--bg); border-radius: 10px; font-size: 14px; line-height: 1.55; color: #45454f; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 13px; width: 24px; height: 24px; border-radius: 50%; background: var(--inm-navy); color: #fff; font-size: 12.5px; display: flex; align-items: center; justify-content: center; }
.steps strong { display: block; color: var(--text); font-weight: 500; }
.landing-footer { max-width: 1040px; margin: 0 auto; padding: 18px 24px 36px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #8a8a94; }
.landing-footer a { color: #8a8a94; }
@media (max-width: 820px) {
  .hero-inner { padding: 28px 16px 100px; }
  .hero h1 { font-size: 32px; }
  .hero-top img { width: 96px; }
  .landing-body { grid-template-columns: 1fr; padding: 0 16px 40px; margin-top: -72px; }
  .signin { padding: 22px 18px; }
  .how { padding-top: 8px; }
  .landing-footer { padding: 18px 16px 28px; }
}
.container { max-width: 1200px; margin: 1.5rem auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.3rem 1.5rem; margin-bottom: 1.2rem; }
.card.narrow { max-width: 640px; margin: 2rem auto; }
.card.center { text-align: center; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .row, .row.four { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .25rem; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: baseline; margin: .4rem 0; }
input:not([type=checkbox]):not([type=file]), select, textarea { width: 100%; padding: .55rem .65rem; border: 1px solid #c8ccd3; border-radius: 6px; font: inherit; background: #fff; }
input[type=file] { display: block; margin-bottom: .3rem; }
.btn { display: inline-block; border: 1px solid #c8ccd3; background: #fff; color: var(--text); padding: .5rem 1rem; border-radius: 6px; font: inherit; cursor: pointer; text-decoration: none; margin-top: .6rem; }
.btn:hover { border-color: #9aa1ab; }
.btn.primary { background: var(--inm-button); border-color: transparent; color: #fff; }
.btn.primary:hover { opacity: .92; border-color: transparent; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: .2rem .6rem; font-size: .85rem; margin-top: 0; }
.btn.ok { background: #dcfce7; border-color: #86efac; color: var(--ok); }
.btn.danger { color: var(--danger); border-color: #fca5a5; }
.icon-btn { background: none; border: none; cursor: pointer; color: inherit; font-size: .9rem; padding: .1rem .25rem; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: .85rem; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.actions .btn { margin-top: 0; }
.lead { font-size: 1.05rem; } .hint { color: var(--muted); font-size: .88rem; } .muted { color: var(--muted); }
small.hint { display: block; }
.error { color: var(--danger); }
.flash { padding: .7rem 1rem; border-radius: 8px; background: #e0ecff; border: 1px solid #a8c5fa; margin-bottom: 1rem; }
.flash.warning { background: var(--warn-bg); border-color: var(--warn-line); }
.footer-link { text-align: center; font-size: .85rem; }
.footer-link a { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; color: var(--muted); margin: 0; }
.instructions { white-space: pre-line; margin: .8rem 0; }
.facts li { margin: .3rem 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr.inactive td { color: #8a8f98; }
.card { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 99px; background: #e5e7eb; color: #374151; font-weight: 600; vertical-align: middle; }
.badge.demo { background: #ede9fe; color: #5b21b6; } .badge.ok { background: #dcfce7; color: var(--ok); }
.tree { background: #f6f7f9; border: 1px solid var(--line); padding: .6rem .8rem; border-radius: 6px; font-size: .82rem; }
.upload-status { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.upload-status details { margin: .4rem 0; } .upload-status .errors summary { color: var(--danger); font-weight: 600; }
.downloads li { margin: .4rem 0; }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.pair { border: 1px solid var(--line); border-radius: 8px; padding: .6rem; }
.pair-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.pair-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.pair-imgs figure { margin: 0; } .pair-imgs img { width: 100%; background: #000; display: block; aspect-ratio: 1; object-fit: contain; }
.pair-imgs figcaption { font-size: .75rem; word-break: break-all; }
.danger-zone { border-color: #fecaca; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: .5rem 0 1rem; }
.kpis > div { background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.kpis .k { display: block; font-size: 1.25rem; font-weight: 700; } .kpis .l { font-size: .8rem; color: var(--muted); }
.prefbar { position: relative; height: 10px; background: var(--b); border-radius: 5px; overflow: hidden; min-width: 120px; }
.prefbar .a { height: 100%; background: var(--a); }
.prefbar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #fff; }
.barcell { width: 160px; }

/* ------------------------------------------------------------------ study upload review */
.table.naming { margin: .4rem 0 .6rem; font-size: .85rem; }
.table.naming td, .table.naming th { padding: .35rem .5rem; }
.review-card h2 { margin: 0; }
.review-task { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .8rem; }
.review-task-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.review-task-head h3 { margin: 0; }
.review-table { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: .6rem; }
.review-table .table { margin: 0; }
.review-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.review-table tr.bad td { background: #fff5f5; }
.review-table .thumb { margin: 0; width: 120px; }
.review-table .thumb img { width: 120px; height: 90px; object-fit: contain; background: #000; display: block; border-radius: 4px; }
.review-table .thumb figcaption { font-size: .72rem; color: var(--muted); word-break: break-all; margin-top: 2px; }
.review-table .thumb .missing { width: 120px; height: 90px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed #e0a0a0; border-radius: 4px; color: var(--danger); font-size: .8rem; }
.status-ok { color: var(--ok); font-weight: 600; } .status-bad { color: var(--danger); font-weight: 600; }
.review-actions { margin-top: 1rem; }
.review-actions .btn { margin-top: 0; }
details.errors summary { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------------ results charts */
.viz { margin-bottom: 1.2rem; }
.viz-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; margin: 0 0 .9rem; }
.viz-filters label { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 600; font-size: .9rem; }
.viz-filters label.check { font-weight: 400; }
.viz-filters select { width: auto; min-width: 220px; }
.viz-note, .viz-meta { color: var(--muted); font-size: .85rem; }
.viz-meta { margin: 0 0 .8rem; }
.viz-charts { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.viz-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.3rem 1rem; overflow: hidden; }
.viz-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.viz-sub { color: var(--muted); font-size: .85rem; margin: 0 0 .6rem; }
.viz-card svg { display: block; overflow: visible; }
.viz-card svg .viz-row { cursor: default; outline: none; }
.viz-card svg .viz-row:focus-visible rect:first-child { stroke: var(--inm-navy); stroke-width: 1.5; }
.viz-label { font-size: 12.5px; fill: #52514e; }
.viz-label.strong { fill: #0b0b0b; font-weight: 600; }
.viz-value, .viz-tick { font-size: 11.5px; fill: #898781; font-variant-numeric: tabular-nums; }
.viz-value { fill: #52514e; }
.viz-dir { font-size: 11.5px; fill: #898781; }
.viz-star { font-size: 14px; font-weight: 700; fill: #52514e; }
.viz-inbar { font-size: 11.5px; font-weight: 600; }
.viz-legend { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .82rem; color: #52514e; margin: 0 0 .5rem; }
.viz-legend .item { display: inline-flex; align-items: center; gap: .4rem; }
.viz-legend .sw { display: inline-block; background: var(--c); }
.viz-legend .sw.dot { width: 10px; height: 10px; border-radius: 50%; }
.viz-legend .sw.bar { width: 14px; height: 10px; border-radius: 2px; }
.viz-legend .sw.diamond { width: 9px; height: 9px; transform: rotate(45deg); }
.viz-legend .sw.tick { width: 2px; height: 14px; }
.viz-controls { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; flex-wrap: wrap; }
.viz-controls .viz-sub { margin: 0; }
.viz-controls .viz-gap { width: .8rem; }
.viz-controls .btn.on { border-color: var(--inm-navy); color: var(--inm-navy); background: #eef0fa; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: #fff; border: 1px solid rgba(11,11,11,.12);
           border-radius: 8px; box-shadow: 0 8px 24px rgba(21,24,79,.14); padding: .5rem .7rem; font-size: .82rem;
           color: #52514e; max-width: 300px; }
.viz-tip .v { color: #0b0b0b; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .45rem; }
.viz-tip .l { margin-top: .15rem; }
.viz-tip .key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
@media (max-width: 700px) { .viz-filters select { min-width: 0; width: 100%; } .viz-card { padding: .9rem .8rem; } }

/* ------------------------------------------------------------------ reading screen
   Neutral, dark, low-distraction surround: no colour near the images, no labels that
   could reveal the modality, identical viewports for both images. */
body.reading { background: #121212; color: #c8c8c8; overflow: hidden; }
.reader { height: 100vh; display: flex; flex-direction: column; }
#reader { display: flex; flex-direction: column; height: 100%; padding: .6rem 1rem .8rem; }
.reader-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.reader .prompt { font-size: 1.25rem; font-weight: 600; color: #f0f0f0; }
.reader .status { display: flex; align-items: center; gap: .8rem; color: #9a9a9a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reader .badge { background: #5b21b6; color: #fff; }
.reader .icon-btn { font-size: 1.2rem; color: #9a9a9a; }
.progress { height: 3px; background: #2a2a2a; margin: .5rem 0 .7rem; border-radius: 2px; }
#progress-bar { height: 100%; width: 0; background: #6b6b6b; transition: width .2s; }
.panels { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.panel { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #000; border-radius: 3px;
            outline: 3px solid transparent; outline-offset: 4px; cursor: pointer; touch-action: none; }
.viewport img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0;
                visibility: hidden; user-select: none; -webkit-user-drag: none; }
.panel.shown img { visibility: visible; }
.panel.selected .viewport { outline-color: #8fb4ff; }
.panel figcaption { text-align: center; color: #7a7a7a; font-size: .85rem; padding-top: .4rem; }
.panel.selected figcaption { color: #cfe0ff; }
.panel.selected figcaption::after { content: " \2014  selected"; }
.reader kbd { background: #222; border-color: #444; color: #bbb; }
.controls { display: flex; justify-content: center; align-items: center; gap: 1.2rem; padding-top: .5rem; flex-wrap: wrap; }
.controls .btn { margin-top: 0; }
.controls .btn.primary { background: #3a5fb8; border-color: #3a5fb8; min-width: 210px; }
.controls .btn.primary kbd { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; margin-left: .3rem; }
.help { color: #6f6f6f; font-size: .8rem; }
.confidence { display: flex; align-items: center; gap: .5rem; }
.confidence[hidden] { display: none; }
.btn.conf { background: #1f1f1f; color: #cfcfcf; border-color: #444; margin: 0 .15rem; padding: .35rem .7rem; }
.btn.conf.on { background: #3a5fb8; border-color: #3a5fb8; color: #fff; }
.overlay { position: fixed; inset: 0; background: rgba(18,18,18,.96); display: flex; align-items: center; justify-content: center; z-index: 10; }
.overlay[hidden] { display: none; }
.overlay-card { max-width: 480px; text-align: center; }
.overlay-card h2 { color: #f0f0f0; }
@media (max-width: 700px) { .panels { grid-template-columns: 1fr; } body.reading { overflow: auto; } .reader { height: auto; } .viewport { min-height: 40vh; } }
