/* Hemalogic Rad. Dark by default: radiologists read in dim rooms. Light theme follows the system setting. */
:root {
  --bg: #0e1520; --panel: #151e2b; --panel2: #1b2636; --line: #263346; --ink: #e6ebf2; --muted: #8b98ab;
  --navy: #14304f; --accent: #3aa6b9; --accent-ink: #04161b; --red: #ef6a5e; --amber: #e0a43a; --green: #4cbf7f;
  --focus: #5cc8db; --radius: 8px;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f8; --panel: #fff; --panel2: #f7f9fb; --line: #dde3ea; --ink: #18212d; --muted: #5d6a7b; --accent: #0f7c8c; --accent-ink: #fff; --red: #b3261e; --amber: #9a5b00; --green: #1e7b45; --focus: #0f7c8c; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
h2 { font-size: 16px; margin: 0 0 8px; } h3 { font-size: 13px; } h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; width: 100%; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
label > input, label > select, label > textarea { margin-top: 3px; font-size: 14px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; }
label.inline input[type=number] { width: 64px; }
input[type=checkbox], input[type=radio] { width: auto; }
code { background: var(--panel2); padding: 1px 4px; border-radius: 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 12px; }
.ok { color: var(--green); }
small { color: var(--muted); }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger, .link.danger { color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.badge { background: var(--red); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.pill { font-size: 10px; padding: 1px 6px; border-radius: 9px; border: 1px solid var(--line); margin-left: 4px; }
.pill.final { color: var(--green); border-color: var(--green); }
.chip { font: inherit; font-size: 12px; text-transform: capitalize; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 14px; padding: 3px 10px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* header */
.top { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.brand b { color: #7fd6e3; }
.tabs { display: flex; gap: 2px; }
.tabs button { font: inherit; background: none; border: 0; color: #c9d6e6; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tabs button.on { background: rgba(255,255,255,.12); color: #fff; }
.model { margin-left: auto; font-size: 11px; color: #9fb3cc; }
.demo-banner { background: #3a2a07; color: #f5d69a; font-size: 12px; padding: 4px 16px; text-align: center; }
@media (prefers-color-scheme: light) { .demo-banner { background: #fff4d6; color: #6b4a00; } }

main { flex: 1; min-height: 0; }
.view { display: none; height: 100%; overflow: auto; }
.view.on { display: block; }
#view-read.on { display: grid; grid-template-columns: 230px minmax(0, 1fr) 380px; overflow: hidden; }

/* worklist */
.worklist { border-right: 1px solid var(--line); background: var(--panel); padding: 12px; overflow: auto; }
.wl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wl-head h2 { margin: 0; }
#studyList { list-style: none; margin: 0 0 12px; padding: 0; }
#studyList li { padding: 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px; }
#studyList li:hover { background: var(--panel2); }
#studyList li.on { border-color: var(--accent); background: var(--panel2); }
#studyList li.empty { color: var(--muted); cursor: default; }
.wl-exam { font-weight: 600; font-size: 13px; }
.wl-meta { font-size: 12px; color: var(--muted); }

/* report */
.report { overflow: auto; padding: 16px 24px 40px; }
.placeholder { margin: 15vh auto; text-align: center; color: var(--muted); }
.rhead { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 4px; }
.grid4 { display: grid; grid-template-columns: 2fr .7fr .7fr 2.6fr; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.prior { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.prior summary { cursor: pointer; }
.sect-h { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sections { display: flex; flex-direction: column; gap: 6px; }
.sec { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; padding: 4px; border-radius: 6px; border-left: 3px solid transparent; }
.sec.active { border-left-color: var(--accent); background: var(--panel); }
.sec-l { padding-top: 7px; font-weight: 600; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.sec-l .link { align-self: flex-start; }
.sec textarea { overflow: hidden; min-height: 34px; }
.sec textarea::placeholder { color: var(--muted); opacity: .45; }
.imp { font-size: 15px; min-height: 90px; }
.recs { margin: 0; padding-left: 20px; } .recs li.off { opacity: .5; } .recs label { display: inline; color: var(--ink); font-size: 14px; }
.ractions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.signed { color: var(--green); margin-right: auto; }

/* assistant */
.assist { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.assist-tabs { display: flex; border-bottom: 1px solid var(--line); }
.assist-tabs button { flex: 1; font: inherit; font-size: 12px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 4px; cursor: pointer; }
.assist-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.pane { display: none; padding: 12px; overflow: auto; flex: 1; }
.pane.on { display: block; }
.note { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 8px 0; font-size: 12px; }
.note.amber { border-color: var(--amber); }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.cmds, .log { padding-left: 18px; font-size: 12px; }
details { margin: 8px 0; } summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.checks, .reccards, .acklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.checks li { border-left: 3px solid var(--line); background: var(--panel2); padding: 7px 9px; border-radius: 4px; font-size: 13px; }
.checks li.red { border-left-color: var(--red); } .checks li.amber { border-left-color: var(--amber); } .checks li.info { border-left-color: var(--green); }
.checks li small { display: block; margin-top: 3px; }
.reccards li { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 9px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.reccards li.na { opacity: .6; }
.reccards .btn { align-self: flex-start; }
.rc-f { font-weight: 600; }
.src { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 9px; margin-left: 4px; }
.src.code { background: rgba(76,191,127,.15); color: var(--green); } .src.model { background: rgba(224,164,58,.15); color: var(--amber); }
.psum { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 14px; line-height: 1.6; }
.gloss dt { font-weight: 600; } .gloss dd { margin: 0 0 6px; color: var(--muted); }
.calc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; align-items: center; }
.calc output { grid-column: 1 / -1; font-weight: 600; min-height: 18px; color: var(--accent); }
#cPsa { grid-template-columns: 1fr 1fr; }

/* dictation bar */
.dictbar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--panel); border-top: 1px solid var(--line); }
.mic { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; flex: none; }
.mic.live { background: var(--red); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,106,94,.5); } 50% { box-shadow: 0 0 0 8px rgba(239,106,94,0); } }
.meter { width: 120px; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s; }
.dstatus { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode { display: flex; gap: 10px; font-size: 12px; }
.mode label { display: flex; gap: 4px; align-items: center; margin: 0; color: var(--ink); }

/* follow-ups / settings */
.fu-wrap, .set-wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.set-wrap { max-width: 760px; } .set-wrap h2 { margin-top: 22px; }
.prose li { margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile b { display: block; font-size: 26px; } .tile span { color: var(--muted); font-size: 12px; }
.tile.red b { color: var(--red); } .tile.amber b { color: var(--amber); } .tile.green b { color: var(--green); }
#fuQ { width: 220px; margin-left: auto; }
table.fu { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; font-size: 13px; }
.fu th, .fu td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.fu th { font-size: 11px; text-transform: uppercase; color: var(--muted); }
.fu tr.overdue td:first-child { color: var(--red); font-weight: 600; }
.fu select { width: auto; }
.nowrap { white-space: nowrap; }
.macros { width: 100%; border-collapse: collapse; } .macros td { padding: 3px; } .macros td:first-child { width: 30%; }

/* modal / toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 10; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; width: min(620px, 94vw); max-height: 88vh; overflow: auto; }
.acklist li { background: var(--panel2); padding: 8px; border-radius: 6px; } .acklist label { color: var(--ink); font-size: 13px; margin: 0; }
.toast { position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 20; max-width: 90vw; }

/* narrow screens (phones, the Android app) */
@media (max-width: 1000px) {
  body { height: auto; overflow: auto; }
  #view-read.on { display: flex; flex-direction: column; overflow: visible; }
  .worklist { border-right: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
  .assist { border-left: 0; border-top: 1px solid var(--line); }
  .grid4, .grid2 { grid-template-columns: 1fr 1fr; }
  .sec { grid-template-columns: 1fr; gap: 2px; }
  .sec-l { flex-direction: row; justify-content: space-between; padding-top: 0; }
  .dictbar { position: sticky; bottom: 0; flex-wrap: wrap; gap: 8px; }
  .dstatus { order: 5; flex-basis: 100%; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .model { display: none; }
  .tabs button { padding: 6px 8px; }
  table.fu { display: block; overflow-x: auto; }
}
