/* Clinical, quiet and dense: hairlines, small corners, one accent. The scan viewer stays dark. */
:root {
  --bg: #f7f8f9;
  --panel: #ffffff;
  --ink: #1b2228;
  --muted: #5f6b76;
  --line: #dde1e5;
  --line-soft: #eceff1;
  --accent: #0b5a7a;
  --accent-soft: #e8f1f5;
  --right: #1d4f9c;   /* right eye */
  --left: #a8480f;    /* left eye */
  --danger: #a32a1c;
  --warn-bg: #fdf3e2;
  --warn-line: #e5b566;
  --warn-ink: #7a4300;
  --ok: #17663f;
  --night: #0a0d10;
  --radius: 6px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
h1, h1.big { font-size: 22px; line-height: 1.25; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.005em; }
h2 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
h2.gap { margin-top: 32px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow, .label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0 0 6px; display: block; }
.err { color: var(--danger); min-height: 1.2em; margin: 4px 0; font-size: 13.5px; }
.ok { color: var(--ok); min-height: 1.2em; margin: 4px 0; font-size: 13.5px; }

/* buttons and fields */
.btn {
  appearance: none; border: 1px solid #c3c9cf; background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
  text-decoration: none; display: inline-block; white-space: nowrap; min-height: 40px; text-align: center;
}
.btn:hover { background: #f1f3f5; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #094a65; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn.quiet:hover { background: var(--accent-soft); }
.btn.wide { width: 100%; margin-top: 10px; min-height: 44px; }
.btn.onDark { background: transparent; border-color: rgba(255,255,255,0.3); color: #fff; }
.btn.onDark:hover { background: rgba(255,255,255,0.12); }
.btn.onDark.strong { background: #fff; color: var(--night); border-color: #fff; }
.link { appearance: none; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; padding: 8px 6px; min-height: 36px; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
input[type=text], input[type=password], input[type=search], input[type=date], select {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #c3c9cf; border-radius: var(--radius);
  background: #fff; color: var(--ink); min-height: 42px;
}
input.pin { font-size: 22px; letter-spacing: 0.35em; text-align: center; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

/* right and left eye marks: always a letter as well as a colour */
.eye { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; color: #fff; font-weight: 700; font-size: 12.5px; line-height: 1; flex: 0 0 auto; }
.eye.r { background: var(--right); }
.eye.l { background: var(--left); }
.eye.big { width: 30px; height: 30px; font-size: 16px; }

/* sign in and lock */
.center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.sign { width: 100%; max-width: 380px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; border-top: 3px solid var(--accent); }
.sign h1 { font-size: 22px; margin-bottom: 2px; }
.sign .eyebrow { margin-bottom: 14px; }
.logo-lg { max-height: 56px; max-width: 200px; display: block; margin-bottom: 16px; }
.logo-sm { max-height: 30px; max-width: 120px; display: block; }

/* top bar */
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.topin { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: stretch; gap: 28px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 12px; line-height: 1.2; }
.brand strong { font-size: 15px; font-weight: 600; display: block; }
.brand .sub { font-size: 12.5px; color: var(--muted); }
nav { display: flex; gap: 2px; align-items: stretch; margin-right: auto; }
.tab { appearance: none; border: 0; border-bottom: 2px solid transparent; border-top: 2px solid transparent; background: transparent; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); padding: 0 12px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; }
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 24px 40px; }
.foot { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.banner { background: #fbeceb; color: var(--danger); border: 1px solid #edc3bd; border-left-width: 4px; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.banner.info { background: var(--accent-soft); color: var(--accent); border-color: #b9d3df; }
.demo-tag { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; }

/* day page: list of days on the left, worklist on the right */
.daylayout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
.daylist { display: flex; flex-direction: column; }
.daylist .label { margin-top: 2px; }
.daylist label.label { margin-top: 18px; }
.dayrow { appearance: none; border: 0; border-left: 3px solid transparent; background: transparent; font: inherit; font-size: 14px; color: var(--ink); text-align: left; padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; border-radius: 0 4px 4px 0; }
.dayrow .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.dayrow:hover { background: #eceff1; }
.dayrow.on { border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.listnote { margin: 0; }
.search { width: 220px !important; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.bar select { width: auto; flex: 0 1 220px; }

.worklist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wrow { appearance: none; width: 100%; border: 0; border-top: 1px solid var(--line-soft); border-left: 3px solid transparent; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 76px 90px 70px 90px 130px minmax(0, 1fr); gap: 16px; align-items: center; padding: 8px 16px 8px 13px; }
.wrow:hover { background: #f4f6f8; }
.wrow.whead { cursor: default; border-top: 0; background: #f1f3f5; font-size: 12.5px; font-weight: 600; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
.wrow.whead:hover { background: #f1f3f5; }
.wrow.flag { border-left-color: var(--warn-line); background: var(--warn-bg); }
.wthumb { display: grid; place-items: center; width: 76px; height: 46px; background: var(--night); border-radius: 3px; overflow: hidden; }
.wthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wthumb .doc { font-size: 11px; padding: 3px 6px; }
.wnum { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.eyes { display: flex; gap: 5px; }
.wcount, .wtime { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wnote { font-size: 13.5px; font-weight: 600; color: var(--warn-ink); text-align: right; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); margin: 0; grid-column: 1 / -1; }
.doc { color: #fff; font-weight: 600; letter-spacing: 0.08em; font-size: 13px; border: 1px solid rgba(255,255,255,0.4); padding: 6px 10px; border-radius: 3px; }

/* one queue number: right eye on the left of the screen, as the patient faces you */
.back { margin-bottom: 18px; }
.eyecols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.eyecol { margin-top: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.eyecols .eyecol { margin-top: 0; }
.eyehead { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 0; overflow: hidden; cursor: pointer; font: inherit; color: inherit; text-align: left; display: flex; flex-direction: column; }
.tile:hover { border-color: var(--accent); }
.thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; background: var(--night); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .eye { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; font-size: 14px; outline: 1.5px solid rgba(255,255,255,0.85); }
.tmeta { padding: 10px 12px 11px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.tmeta strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* viewer (kept dark so the scan stands out) */
.viewer { position: fixed; inset: 0; background: var(--night); z-index: 10; display: flex; flex-direction: column; color-scheme: dark; }
.vbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; color: #fff; flex-wrap: wrap; border-bottom: 1px solid rgba(255,255,255,0.14); background: #12171c; }
.vtitle { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vtext { display: flex; flex-direction: column; min-width: 0; }
.vtext strong { font-size: 16px; font-weight: 600; }
.vtext .small { color: rgba(255,255,255,0.68); }
.vbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; }
.stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.stage.zoom { place-items: start; }
.stage.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.stage.pdf { display: block; }
.stage iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.stage.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(255,255,255,0.18); place-items: stretch; overflow: hidden; }
.half { background: var(--night); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.halfhead { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: #fff; font-weight: 600; font-size: 14px; background: #12171c; }
.halfbody { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; }
.halfbody img { cursor: default; }
.half.pdf .halfbody { display: block; }
.onDarkText { color: rgba(255,255,255,0.8); max-width: 420px; text-align: center; padding: 20px; margin: 0; }

/* keypad */
.kwrap { max-width: 360px; margin: 8px auto 0; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.kdate { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.kdisplay { font-size: 56px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; padding: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); letter-spacing: 0.04em; }
.kdisplay.dim { color: #b6bec6; }
.kstatus { min-height: 3em; color: var(--muted); font-size: 14px; margin: 12px 0; }
.kstatus.found { color: var(--ok); font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { appearance: none; border: 1px solid #c3c9cf; background: var(--panel); color: var(--ink); font: inherit; font-size: 24px; font-weight: 500; border-radius: var(--radius); min-height: 64px; cursor: pointer; touch-action: manipulation; }
.key:hover { background: #f1f3f5; }
.key:active { background: #e3e7ea; }
.key.soft { font-size: 15px; color: var(--muted); }
.key.go { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 17px; font-weight: 600; }
.key.go:disabled { background: #b6bec6; border-color: #b6bec6; cursor: default; }

/* new-scan notices */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { appearance: none; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--panel); color: var(--ink); font: inherit; border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 18px; align-items: center; cursor: pointer; box-shadow: 0 6px 20px rgba(27, 34, 40, 0.16); }
.toast strong { font-size: 14.5px; font-weight: 600; }
.toast span { font-size: 13.5px; font-weight: 600; color: var(--accent); }

/* admin */
.table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0 22px; }
.trow { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.trow:last-child { border-bottom: 0; }
.trow.off { opacity: 0.55; }
.trow.log { grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1.4fr); }
.trow.five { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); }
.trow.headrow { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #f1f3f5; }
.trow strong { font-weight: 600; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form { max-width: 460px; }
.form .btn { margin-top: 14px; }
.facts { display: grid; gap: 0; margin: 14px 0; padding: 0; }
.fact { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.fact:last-child { border-bottom: 0; }
.fact strong { overflow-wrap: anywhere; font-weight: 500; }
.report:empty { display: none; }
.report { margin: 20px 0 10px; }
.rhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.rtitle { font-size: 20px; margin: 0 0 6px; }

@media (max-width: 640px) {
  .topin { flex-wrap: wrap; gap: 0 16px; padding: 8px 16px 0; }
  .brand { padding: 4px 0; }
  .who { margin-left: auto; }
  nav { order: 3; width: 100%; overflow-x: auto; margin: 0; min-height: 40px; }
  .daylayout { grid-template-columns: 1fr; gap: 14px; }
  .daylist { flex-direction: row; overflow-x: auto; gap: 6px; align-items: center; padding-bottom: 4px; }
  .daylist .label { display: none; }
  .dayrow { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); white-space: nowrap; flex: 0 0 auto; }
  .dayrow.on { border-color: var(--accent); }
  .daylist .date { width: auto !important; flex: 0 0 auto; }
}
/* a narrow PC window: put the warning on its own line under the row */
@media (min-width: 641px) and (max-width: 1000px) {
  .wnote { grid-column: 2 / -1; text-align: left; }
  .wnote:empty { display: none; }
}
@media (max-width: 760px) {
  .eyecols { grid-template-columns: 1fr; }
  .stage.split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .fact { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 640px) {
  .shell { padding: 16px 16px 32px; }
  .search { width: 100% !important; }
  .pagehead { align-items: stretch; flex-direction: column; }
  .wrow { grid-template-columns: 64px 64px minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px 8px 9px; }
  .wrow.whead { display: none; }
  .wthumb { width: 64px; height: 40px; }
  .wcount { display: none; }
  .wnote { grid-column: 2 / -1; text-align: left; }
  .wnote:empty { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vbar { padding: 8px 12px; }
  .vbtns .btn { padding: 6px 10px; font-size: 13px; min-height: 38px; }
  .trow.log { grid-template-columns: 1fr; gap: 2px; }
  .trow.five { font-size: 12.5px; gap: 8px; padding: 10px 12px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { justify-content: space-between; }
}

@media print {
  .noprint, .toasts, .viewer { display: none !important; }
  .shell { max-width: none; padding: 0; }
  body { background: #fff; font-size: 12px; }
  .trow { padding: 5px 10px; font-size: 11px; break-inside: avoid; }
  .clip { white-space: normal; }
}
