/* PathoPod LIS: one stylesheet, system fonts, no CDN. Palette: haematoxylin (indigo) + eosin (pink). */
:root {
  color-scheme: light;
  --bg: #f6f5fa; --surface: #ffffff; --surface-2: #f3f2fa; --surface-3: #e8e7f6;
  --ink: #1c1b2e; --ink-2: #44435c; --muted: #5f6075;
  --line: #dedeeb; --line-strong: #c3c2d9;
  --hema: #38358c; --hema-hover: #2d2b73; --hema-soft: #e8e7f6; --on-hema: #ffffff;
  --eosin: #a7365a; --eosin-fill: #d9577e; --eosin-soft: #fbe4eb; --badge-bg: #b93e63;
  --ok: #1f7a4d; --ok-bg: #e1f3e9; --warn: #8f5209; --warn-bg: #fbebd0; --bad: #b3322c; --bad-bg: #fbe3e1; --info: #2b5fb4; --info-bg: #e0eaf8;
  --side: #25235f; --on-side: #e9e8f7; --side-muted: #9d9bd0; --bar: #ffffff; --focus: #2a6bd6;
  --shadow: 0 1px 2px rgba(28,27,46,.07), 0 2px 8px rgba(28,27,46,.05);
  --s1: #2a78d6; --s2: #eb6834; --s3: #4a3aa7; --grid: #e6e4f0;
  --radius: 8px; --radius-sm: 5px; --side-w: 216px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131229; --surface: #1b1a38; --surface-2: #232246; --surface-3: #2c2a55;
  --ink: #edebfa; --ink-2: #c9c7e3; --muted: #a8a6c8;
  --line: #34325f; --line-strong: #4b4980;
  --hema: #8c8ae6; --hema-hover: #a5a3f0; --hema-soft: #25244f; --on-hema: #131229;
  --eosin: #f283a4; --eosin-fill: #d9577e; --eosin-soft: #3a1c2d; --badge-bg: #b93e63;
  --ok: #62d696; --ok-bg: #15301f; --warn: #f2b84f; --warn-bg: #382a0c; --bad: #ff8d83; --bad-bg: #3b1613; --info: #80b6f6; --info-bg: #12273f;
  --side: #0e0d22; --on-side: #e9e8f7; --side-muted: #8f8dc4; --bar: #131229; --focus: #7db4f5;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  --s1: #3987e5; --s2: #d95926; --s3: #9085e9; --grid: #312d49;
}
* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.005em; }
h1 { font-size: 1.43rem; line-height: 1.2; } h2 { font-size: 1.02rem; } h3 { font-size: .95rem; }
p { margin: 0 0 .6em; }
a { color: var(--hema); text-underline-offset: 2px; } a:hover { color: var(--hema-hover); }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
kbd { background: var(--surface-3); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; font-size: .85em; color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--hema); color: var(--on-hema); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
td.num, th.num { white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.flip { transform: rotate(180deg); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: 56px 1fr; grid-template-areas: "nav bar" "nav main"; }
.topbar { grid-area: bar; background: var(--bar); color: var(--ink); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 22px 0 24px; position: sticky; top: 0; z-index: 30; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--hema); text-decoration: underline; }
.crumbs b { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; } .crumbs .sl { color: var(--line-strong); }
.topbar .spacer { flex: 1; }
.scanbox { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 10px; height: 34px; width: min(420px, 36vw); color: var(--muted); }
.scanbox:focus-within { background: var(--surface); border-color: var(--hema); box-shadow: 0 0 0 3px var(--hema-soft); color: var(--ink); }
.scanbox input { flex: 1; min-width: 0; background: none; border: 0; color: var(--ink); font: inherit; outline: none; height: 100%; padding: 0; box-shadow: none; }
.scanbox input::placeholder { color: var(--muted); }
.scanbox svg { color: var(--hema); }
.topbar .icon-btn { color: var(--ink-2); } .topbar .icon-btn:hover { background: var(--surface-3); }
.topclock { text-align: right; line-height: 1.15; white-space: nowrap; } .topclock b { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; } .topclock span { font-size: .78rem; color: var(--muted); }
.langswitch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); flex: none; }
.langswitch button { font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); background: none; border: 0; padding: 0 9px; height: 30px; cursor: pointer; }
.langswitch button + button { border-left: 1px solid var(--line); }
.langswitch button:hover { background: var(--surface-2); }
.langswitch button.on, .langswitch button[aria-pressed="true"] { background: var(--hema); color: var(--on-hema); }
.login-lang { position: absolute; top: 16px; right: 18px; }
.login-panel { position: relative; }
.mockflag { white-space: nowrap; background: var(--badge-bg); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; }
.nav { --mark: #46BFB2; --mark-track: .28; grid-area: nav; background: var(--side); color: var(--on-side); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 35; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 14px 16px; height: 56px; border-bottom: 1px solid rgba(255,255,255,.1); flex: none; }
.brand:hover { color: #fff; }
.labid { padding: 9px 16px 10px; border-bottom: 1px solid rgba(255,255,255,.1); line-height: 1.25; flex: none; }
.labid b { display: block; font-size: .9rem; color: #fff; }
.labid span { display: block; font-size: .74rem; color: var(--side-muted); margin-top: 1px; }
.labid.with-logo { display: flex; align-items: center; gap: 10px; }
.labid-logo { flex: none; width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.labid-text { min-width: 0; }
.labid small { display: block; font-size: .7rem; color: var(--side-muted); }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .01em; line-height: 1.1; } .brand small { display: block; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); font-weight: 600; }
.nav-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.nav h3 { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--side-muted); margin: 16px 10px 4px; font-weight: 650; }
.nav a.item { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--on-side); text-decoration: none; font-weight: 500; opacity: .86; }
.nav a.item:hover { background: rgba(255,255,255,.08); opacity: 1; color: #fff; }
.nav a.item[aria-current="page"] { background: rgba(255,255,255,.13); opacity: 1; font-weight: 650; color: #fff; }
.nav a.item[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 4px 4px 0; background: var(--eosin-fill); }
.nav a.item:focus-visible { outline-color: #fff; }
.nav .badge-n { margin-left: auto; background: var(--badge-bg); color: #fff; font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 99px; min-width: 20px; text-align: center; }
.usermenu { position: relative; flex: none; border-top: 1px solid rgba(255,255,255,.1); }
.userbtn { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; color: #fff; font: inherit; padding: 12px 14px; cursor: pointer; text-align: left; }
.userbtn:hover { background: rgba(255,255,255,.08); }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #8c8ae6; color: #131229; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.userbtn .who { min-width: 0; line-height: 1.2; } .userbtn .who b { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .userbtn .who span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: .76rem; line-height: 1.2; color: var(--side-muted); overflow: hidden; }
.menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(20,16,50,.3); padding: 6px; z-index: 50; }
.menu button, .menu a { display: flex; gap: 10px; align-items: center; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .menu-head { padding: 8px 10px 6px; } .menu .menu-head b { display: block; } .menu .menu-head span { color: var(--muted); font-size: .85rem; }
.main { grid-area: main; padding: 20px 24px 60px; min-width: 0; max-width: 1560px; }
.topbar .nav-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "bar" "main"; }
  .nav { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-105%); transition: transform .15s; box-shadow: 8px 0 24px rgba(0,0,0,.3); }
  .nav.open { transform: none; }
  .topbar .nav-toggle { display: inline-grid; }
  .main { padding: 14px 12px 48px; }
  .scanbox { width: auto; flex: 1; }
  .topclock, .crumbs .sl, .crumbs a, .scanbox kbd { display: none; }
  .scanbox { min-width: 120px; }
  .topbar { padding: 0 10px; gap: 8px; }
}

/* ---------------------------------------------------------------- buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.sm { height: 28px; padding: 0 10px; font-size: .88rem; }
.btn.lg { height: 42px; padding: 0 22px; font-size: 1.02rem; }
.btn.primary, a.btn.primary { background: var(--hema); color: var(--on-hema); } .btn.primary:hover, a.btn.primary:hover { background: var(--hema-hover); color: var(--on-hema); }
.btn.secondary, a.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); } .btn.secondary:hover, a.btn.secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn.ghost, a.btn.ghost { background: transparent; color: var(--ink-2); } .btn.ghost:hover, a.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger, a.btn.danger { background: var(--bad); color: #fff; } .btn.danger:hover { filter: brightness(.92); color: #fff; }
:root[data-theme="dark"] .btn.danger { color: #1a0a08; }
.btn.eosin { background: var(--badge-bg); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: none; color: var(--ink-2); border-radius: 6px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.field .req { color: var(--bad); } .field .unit { font-weight: 400; color: var(--muted); }
.field .hint { color: var(--muted); font-size: .82rem; }
.field-error { color: var(--bad); font-size: .84rem; min-height: 0; font-weight: 500; }
.field-error:empty { display: none; }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=datetime-local], input[type=search], input[type=email], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 10px; height: 34px; width: 100%; min-width: 0; }
textarea { height: auto; padding: 7px 10px; resize: vertical; line-height: 1.4; }
select { padding-right: 6px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--hema); }
.field.check label { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); cursor: pointer; }
.segmented { align-self: flex-start; display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.segmented .seg { display: block; margin: 0; font-weight: 600; cursor: pointer; }
.segmented .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented .seg span { display: block; padding: 6px 13px; color: var(--ink-2); border-right: 1px solid var(--line); min-width: 44px; text-align: center; }
.segmented .seg:last-child span { border-right: 0; }
.segmented .seg input:checked + span { background: var(--hema); color: var(--on-hema); }
.segmented .seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.segmented .seg:hover span { background: var(--surface-2); } .segmented .seg input:checked + span:hover { background: var(--hema-hover); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form-grid .wide { grid-column: 1 / -1; } .form-grid .w2 { grid-column: span 2; }
@media (max-width: 560px) { .form-grid .w2 { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- layout helpers */
.stack { display: flex; flex-direction: column; gap: 14px; } .stack.sm { gap: 8px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .cluster.lg { gap: 16px; } .cluster.nowrap { flex-wrap: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .split, .grid3, .grid2 { grid-template-columns: minmax(0, 1fr); } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-head .back { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: .86rem; margin-bottom: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.card-body { padding: 14px 16px; }
.card.flush .card-body { padding: 0; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 7px 12px; border-bottom: 1px solid var(--line-strong); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " \25B2"; font-size: .7em; } th[aria-sort="descending"]::after { content: " \25BC"; font-size: .7em; }
td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.dense td { padding: 5px 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; } tbody tr.clickable:hover { background: var(--surface-2); }
tbody tr.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--hema-soft); } to { background: transparent; } }
.flash { animation: flash 1.6s ease-out; }
td.nowrap { white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.id, .id { font-family: var(--mono); font-size: .92em; white-space: nowrap; }
a.id { font-weight: 650; text-decoration: none; } a.id:hover { text-decoration: underline; }
th.id { font-family: var(--font); font-size: .76rem; }
tr.prio-stat td:first-child { box-shadow: inset 3px 0 0 var(--bad); } tr.prio-urgent td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); } .badge.accent { background: var(--hema-soft); color: var(--hema); } .badge.neutral { background: var(--surface-3); color: var(--ink-2); }
.badge.prio-stat { background: var(--bad); color: #fff; } .badge.prio-urgent { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); } .badge.prio-routine { background: var(--surface-3); color: var(--ink-2); }
:root[data-theme="dark"] .badge.prio-stat { color: #200806; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; font-family: var(--mono); }

/* ---------------------------------------------------------------- states */
.state { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 36px 16px; color: var(--ink-2); }
.state.loading { flex-direction: row; justify-content: center; color: var(--muted); }
.state.error { color: var(--bad); } .state.error p { color: var(--muted); } .state.forbidden { color: var(--ink-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--hema); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } * { scroll-behavior: auto !important; } .flash, tbody tr.flash { animation: none; } }

/* ---------------------------------------------------------------- dialogs, toasts */
dialog.modal { border: 1px solid var(--line-strong); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(10,8,30,.4); }
dialog.modal.wide { width: min(880px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(14,12,30,.55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px; overflow-y: auto; max-height: calc(100vh - 190px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 12px 12px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(10,8,30,.22); animation: toast-in .18s ease-out; }
.toast span { flex: 1; } .toast.ok { border-left-color: var(--ok); } .toast.error { border-left-color: var(--bad); } .toast.info { border-left-color: var(--info); }
.toast.ok svg:first-child { color: var(--ok); } .toast.error svg:first-child { color: var(--bad); } .toast.info svg:first-child { color: var(--info); }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* the OncoPrint mark (js/icons.mjs logoMark): one colour, pale tracks at the brand's opacity */
.logo-mark { flex: none; } .logo-mark rect { fill: var(--mark, #0F7D74); } .logo-mark rect.track { opacity: var(--mark-track, .22); }
:root[data-theme="dark"] .logo-mark { --mark: #46BFB2; --mark-track: .28; }
/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 14px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 8px 14px; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--ink); } .tab[aria-selected="true"] { color: var(--hema); border-bottom-color: var(--hema); }
.tab .count { margin-left: 6px; background: var(--surface-3); color: var(--ink-2); font-size: .74rem; padding: 0 6px; border-radius: 99px; }

/* ---------------------------------------------------------------- login */
.login-wrap { grid-column: 1 / -1; grid-row: 1 / -1; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.login-brand { --mark: #46BFB2; --mark-track: .28; background: var(--side); color: var(--on-side); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-brand p { color: rgba(236,233,250,.8); max-width: 44ch; }
/* the top: the mark, PathoPod and the product line under it; the middle: the site, hospital and campus over the department */
.login-product { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-name { display: block; font-size: 1.45rem; letter-spacing: .01em; line-height: 1.2; }
.login-product-line { font-size: .92rem; color: rgba(236,233,250,.85); line-height: 1.35; margin-top: 2px; }
.login-site { font-size: 1.9rem; line-height: 1.2; margin: 0 0 14px; overflow-wrap: break-word; }
.login-site span { display: block; } .login-site .site-1 { max-width: 30ch; }
/* the department on one line: js fitOneLine steps the size down to fit the panel (wraps only at its smallest) */
.login-site .site-2 { font-size: 1.55rem; margin-top: 8px; white-space: nowrap; }
.login-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); font-size: .8rem; line-height: 1.5; }
.login-brand .login-foot p { color: rgba(236,233,250,.72); max-width: none; margin: 0 0 4px; }
.login-foot a { color: #9fe3da; }
.verline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; }
.verline code { font-family: var(--mono, ui-monospace, monospace); font-size: .76rem; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.08); color: inherit; }
.verline button { font: inherit; font-size: .74rem; font-weight: 600; color: inherit; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); border-radius: 5px; padding: 2px 8px; cursor: pointer; }
.verline button:hover { background: rgba(255,255,255,.18); }
.login-panel .login-ver { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: var(--muted); font-size: .78rem; }
.login-panel .login-ver .verline { justify-content: center; }
.login-panel .verline code { background: var(--surface-3); }
.login-panel .verline button { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.about-box .verline code { background: var(--surface-3); }
.about-box .verline button { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.about-box .about-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.about-box dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 10px 0; }
.about-box dt { color: var(--muted); } .about-box dd { margin: 0; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-card { width: min(100%, 380px); }
.login-card h1 { margin-bottom: 4px; } .login-card .stack { margin-top: 18px; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-brand { display: none; } }

/* ---------------------------------------------------------------- home widgets */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--hema); color: var(--ink); }
.tile .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; } .tile .n small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.tile .l { color: var(--ink-2); font-weight: 600; } .tile .s { color: var(--muted); font-size: .84rem; }
.tile.hot { border-color: var(--bad); background: var(--bad-bg); } .tile.hot .n { color: var(--bad); }
.tile .lab { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert svg { flex: none; margin-top: 2px; } .alert .a-body { color: var(--ink); } .alert .a-body b { color: inherit; }
.alert ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink); }

/* ---------------------------------------------------------------- case page */
.case-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .case-head { grid-template-columns: minmax(0, 1fr); } }
.case-head .acc { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .01em; }
.tat { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.tat .clock { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tat.over .clock { color: var(--bad); } .tat.near .clock { color: var(--warn); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .meter > i { display: block; height: 100%; background: var(--ok); } .tat.near .meter > i { background: var(--warn); } .tat.over .meter > i { background: var(--bad); }
.flow { display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.flow li { flex: 1 0 auto; min-width: 84px; text-align: center; position: relative; padding: 0 4px; font-size: .78rem; color: var(--muted); }
.flow li::before { content: ""; position: absolute; top: 10px; left: -50%; right: 50%; height: 3px; background: var(--line-strong); }
.flow li:first-child::before { display: none; }
.flow .dot { position: relative; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; margin: 0 auto 4px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); color: #fff; }
.flow li.done { color: var(--ink-2); } .flow li.done .dot { background: var(--ok); border-color: var(--ok); } .flow li.done::before { background: var(--ok); }
:root[data-theme="dark"] .flow li.done .dot { color: #0c1f14; }
.flow li.now { color: var(--hema); font-weight: 700; } .flow li.now .dot { border-color: var(--hema); background: var(--hema-soft); box-shadow: 0 0 0 4px var(--hema-soft); } .flow li.now::before { background: var(--ok); }
.flow .when { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 12px; }
.tree > li { margin: 0 0 8px; }
.tree .node { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 6px; border-radius: 6px; }
.tree .node.focus { background: var(--hema-soft); box-shadow: 0 0 0 2px var(--hema); }
.tree .lbl { font-family: var(--mono); font-weight: 700; }
.tree .tree.slides { display: flex; flex-wrap: wrap; gap: 2px 14px; } .tree .tree.slides > li { margin: 0; }
.tree .sub { color: var(--muted); font-size: .86rem; }
.steps-badges { display: inline-flex; gap: 3px; margin-left: 4px; }
.step-b { font-size: .68rem; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); border: 1px solid transparent; }
.step-b.done { background: var(--ok-bg); color: var(--ok); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 12px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--hema); border: 2px solid var(--surface); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .t { color: var(--muted); font-size: .82rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.thumb { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.thumb.focus { box-shadow: 0 0 0 3px var(--hema); }
.thumb img { display: block; width: 100%; aspect-ratio: 1.8; object-fit: cover; background: #f6f4f7; }
.thumb figcaption { padding: 6px 8px; font-size: .82rem; } .thumb figcaption b { display: block; font-family: var(--mono); font-size: .8rem; }
figure { margin: 0; }
.tests td .result { font-size: .9rem; }
.ai-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 99px; background: var(--eosin-soft); color: var(--eosin); font-size: .74rem; font-weight: 700; }

/* ---------------------------------------------------------------- wizard / scan boxes */
.stepper { display: flex; gap: 0; list-style: none; padding: 0; margin: 0 0 18px; counter-reset: s; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 0; color: var(--muted); font-weight: 600; counter-increment: s; }
.stepper li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); font-size: .8rem; }
.stepper li.done { color: var(--ink-2); } .stepper li.done::before { content: "\2713"; background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper li.now { color: var(--hema); } .stepper li.now::before { border-color: var(--hema); background: var(--hema); color: var(--on-hema); }
.stepper li:not(:last-child)::after { content: ""; width: 28px; height: 2px; background: var(--line-strong); margin-left: 8px; }
.scanfield { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--hema); border-radius: 10px; padding: 8px 12px; }
.scanfield input { border: 0; background: none; font-size: 1.15rem; height: 38px; font-family: var(--mono); outline: none; box-shadow: none; }
.scanfield:focus-within { box-shadow: 0 0 0 3px var(--hema-soft); }
.scanfield svg { color: var(--hema); flex: none; }
.part-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface-2); }
.part-card > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.part-label { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--hema); color: var(--on-hema); font-weight: 700; font-family: var(--mono); }
.pa-flags { display: flex; flex-direction: column; gap: 2px; font-size: .84rem; margin-top: 8px; }
.pa-flags .e { color: var(--bad); } .pa-flags .w { color: var(--warn); } .pa-flags .o { color: var(--ok); }
.label-preview { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--line-strong); border-radius: 6px; padding: 8px 10px; background: #fff; color: #111; width: 260px; }
.dm { width: 44px; height: 44px; display: grid; grid-template-columns: repeat(14, 1fr); background: #fff; flex: none; }
.dm i { display: block; background: #fff; } .dm i.on { background: #111; }
.pdf-frame { width: 100%; height: min(70vh, 700px); border: 1px solid var(--line); border-radius: 6px; background: #fff; }

/* ---------------------------------------------------------------- report editor / synoptic */
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1150px) { .report-layout { grid-template-columns: minmax(0, 1fr); } }
.side-sticky { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.syn { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.syn > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; flex-wrap: wrap; }
.syn > header h3 { display: flex; gap: 8px; align-items: center; }
.syn .syn-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.syn.missing { opacity: .8; } .syn.missing .syn-body { color: var(--muted); }
.calc { display: flex; flex-wrap: wrap; gap: 8px 18px; background: var(--hema-soft); border-radius: 8px; padding: 9px 12px; align-items: baseline; }
.calc .item { display: flex; flex-direction: column; } .calc .item span { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; }
.calc .item b { font-size: 1.2rem; font-variant-numeric: tabular-nums; } .calc .item b small { font-weight: 500; font-size: .8rem; color: var(--ink-2); }
.derived { border-left: 4px solid var(--eosin); background: var(--eosin-soft); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.derived .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--eosin); font-weight: 700; }
.ai-box { border: 1px dashed var(--eosin); border-radius: 8px; padding: 10px 12px; background: var(--eosin-soft); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.ai-box .proposal { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.ai-box .proposal b { font-size: 1.1rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; } .checklist svg { flex: none; margin-top: 2px; }
.checklist .ok svg { color: var(--ok); } .checklist .bad svg { color: var(--bad); } .checklist .warn svg { color: var(--warn); }
.preview-doc { background: #fff; color: #111; border: 1px solid var(--line-strong); border-radius: 4px; padding: 28px 32px; max-width: 760px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; line-height: 1.4; box-shadow: var(--shadow); }
.preview-doc h2 { font-family: var(--font); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #bbb; margin: 16px 0 6px; padding-bottom: 2px; color: #333; }
.preview-doc h1 { font-family: var(--font); font-size: 1.3rem; } .preview-doc .draft-mark { color: #b3261e; font-family: var(--font); font-weight: 700; letter-spacing: .08em; }
.preview-doc table { font-size: .9rem; } .preview-doc td, .preview-doc th { padding: 2px 8px 2px 0; border: 0; background: none; position: static; color: #111; text-transform: none; letter-spacing: 0; font-size: inherit; font-weight: normal; }
.preview-doc th { font-weight: 700; }
/* the letterhead as the PDF prints it: logo at the left, the hospital in capitals, campus, department, address */
.letterhead { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #999; font-family: var(--font); }
.letterhead .lh-logo { flex: none; height: 64px; max-width: 124px; object-fit: contain; }
.letterhead .lh-hospital { font-size: 1.15rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.letterhead .lh-campus { font-size: .82rem; color: #555; }
.letterhead .lh-dept { font-size: .95rem; font-weight: 700; color: #222; }
.letterhead .lh-addr { font-size: .76rem; color: #666; }
.preview-doc .pv-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.preview-doc .pv-title h1 { margin: 4px 0; letter-spacing: .03em; }
.preview-doc .pv-acc { text-align: right; font-family: var(--font); display: flex; flex-direction: column; }
.preview-doc .pv-icd { margin-top: 6px; font-size: .9rem; } .preview-doc .pv-icd ul { display: inline; }
.icd-list { list-style: none; margin: 0; padding: 0; } .icd-list li { margin: 1px 0; }
.preview-doc .pv-icd .icd-list { display: inline-block; vertical-align: top; }
/* the ICD-10 picker */
.icd-picker { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2, transparent); }
.icd-label { font-weight: 600; font-size: .86rem; }
.icd-rows { display: flex; flex-direction: column; gap: 4px; }
.icd-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icd-row .icd-t { flex: 1 1 240px; min-width: 0; }
.icd-c { font-family: var(--mono, ui-monospace, monospace); font-weight: 700; }
.icd-searchbox { position: relative; display: flex; align-items: center; gap: 6px; }
.icd-searchbox input { flex: 1; min-width: 0; }
.icd-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 2px 0 0; padding: 4px; list-style: none; max-height: 320px; overflow: auto; background: var(--bg, #fff); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); }
.icd-opt { display: grid; grid-template-columns: 64px 1fr; gap: 0 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.icd-opt .icd-en, .icd-opt .icd-flag { grid-column: 2; }
.icd-opt .icd-flag { color: var(--warn, #9a6700); }
.icd-opt.active, .icd-opt:hover { background: var(--accent-soft, rgba(15,125,116,.12)); }
.icd-empty { padding: 6px 8px; }
.icd-codes .icd-code { font-family: var(--mono, ui-monospace, monospace); font-size: .8rem; }
.icd-codes .icd-code[data-primary="1"] { font-weight: 700; }
details.icd-recode > summary { cursor: pointer; font-weight: 600; }
/* the logo in the settings */
.logo-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 180px; height: 110px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 6px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-doc .sig { margin-top: 20px; border-top: 1px solid #999; padding-top: 6px; font-family: var(--font); font-size: .86rem; }

/* ---------------------------------------------------------------- charts (inline SVG) */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-2); font-family: var(--font); font-size: 11px; }
.chart .axis line, .chart .grid line { stroke: var(--grid); } .chart .axis path { stroke: var(--line-strong); fill: none; }
.chart .ttl { fill: var(--ink); font-weight: 650; font-size: 12px; }
.chart .bar { fill: var(--s1); } .chart .bar.s2 { fill: var(--s2); } .chart .bar.s3 { fill: var(--s3); } .chart .bar:hover { filter: brightness(1.12); }
.chart .line { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .chart .line.s2 { stroke: var(--s2); }
.chart .area { fill: var(--s1); opacity: .12; }
.chart .dot { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.chart .ref { stroke: var(--bad); stroke-dasharray: 4 3; stroke-width: 1.5; } .chart .ref-l { fill: var(--bad); font-weight: 650; }
.chart .hit { fill: transparent; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); margin: 2px 0 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; background: var(--s1); } .legend i.s2 { background: var(--s2); } .legend i.s3 { background: var(--s3); }
.chart-tip { position: fixed; z-index: 300; pointer-events: none; background: var(--ink); color: var(--bg); padding: 5px 9px; border-radius: 6px; font-size: .82rem; box-shadow: 0 4px 14px rgba(0,0,0,.3); max-width: 260px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; } .stat span { display: block; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; } .stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.bars-h { display: flex; flex-direction: column; gap: 6px; } .bars-h .r { display: grid; grid-template-columns: 150px 1fr 130px; gap: 8px; align-items: center; font-size: .88rem; } .bars-h .track { height: 12px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .bars-h .fill { height: 100%; background: var(--s1); border-radius: 99px; }

/* ---------------------------------------------------------------- misc */
.matrix { border-collapse: separate; border-spacing: 0; } .matrix th, .matrix td { text-align: center; padding: 4px 8px; } .matrix td:first-child, .matrix th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix tr.grp td { background: var(--surface-2); font-weight: 650; text-align: left; }
.matrix th.role { writing-mode: vertical-rl; transform: rotate(180deg); height: 100px; vertical-align: bottom; }
.hash { font-family: var(--mono); font-size: .78rem; color: var(--muted); word-break: break-all; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; } .status-dot.up { background: var(--ok); } .status-dot.degraded { background: var(--warn); } .status-dot.down { background: var(--bad); }
.progress { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--s1); } .progress.high > i { background: var(--s2); }
.json { font-family: var(--mono); font-size: .86rem; width: 100%; min-height: 160px; }
.sep { color: var(--line-strong); padding: 0 4px; }
.shortcuts dt { font-family: var(--mono); } 
@media print {
  .topbar, .nav, .page-actions, .toast, #toasts, .no-print { display: none !important; }
  .app { display: block; } .main { padding: 0; } body { background: #fff; }
}

/* ---------------------------------------------------------------- case page, second pass */
.tabs .tab-extra { margin-left: auto; align-self: center; font-weight: 600; text-decoration: none; padding: 0 6px; white-space: nowrap; }
.big-name { font-size: 1.25rem; font-weight: 650; }
.facts { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: .9rem; }
.facts b { color: var(--ink-2); font-weight: 600; }
.mini-progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .mini-progress > i { display: block; height: 100%; background: var(--ok); }
.attention { display: flex; flex-direction: column; gap: 8px; }
.part-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }

/* report editor, second pass */
.jump { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 56px; z-index: 6; background: var(--bg); padding: 8px 0; margin: -8px 0 0; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: .88rem; padding: 4px 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { background: var(--surface-3); }
.chip-btn.good { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); } .chip-btn.bad { color: var(--bad); border-color: var(--bad); }
.thumbs.small { grid-template-columns: repeat(3, 1fr); gap: 6px; } .thumbs.small figcaption { padding: 3px 5px; font-size: .72rem; } .thumbs.small figcaption b { font-size: .7rem; }
.diag-box { background: var(--hema-soft); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; font-weight: 650; white-space: pre-wrap; }
fieldset.checked { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; } fieldset.checked legend { padding: 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--hema); font-weight: 700; }
dl.kv dt { white-space: nowrap; }
.chart .guide { display: none; stroke: var(--line-strong); stroke-dasharray: 2 3; stroke-width: 1; }
.chart .guide.on { display: block; }

@media (max-width: 700px) {
  .page-head { align-items: flex-start; } .page-actions { width: 100%; }
  .tree .node, .part-line { min-width: 0; } .tree .sub { overflow-wrap: anywhere; }
  .card-head { flex-wrap: wrap; } .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stepper li { padding-right: 8px; } .stepper li:not(:last-child)::after { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); } .form-grid .w2 { grid-column: auto; }
  table { font-size: .9rem; } td, th { padding-left: 8px; padding-right: 8px; }
  dialog.modal { width: calc(100vw - 16px); } .modal-body { max-height: calc(100vh - 170px); }
}

.stack.sm > .btn.sm { align-self: flex-start; }

/* ---------------------------------------------------------------- the slide viewer (js/pages/viewer.mjs, js/viewer/) */
.main.main-viewer { padding: 0; max-width: none; height: calc(100vh - 56px); overflow: hidden; }
.vw-page { display: flex; flex-direction: column; height: 100%; }
.vw-head { display: flex; align-items: center; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.vw-head-main { flex: 1; min-width: 0; }
.vw-specimen { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 188px minmax(0, 1fr) 330px; }
.vw-strip { overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 6px 8px 12px; }
.vw-block-head { font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 8px 2px 6px; }
.vw-slide { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 4px; margin-bottom: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.vw-slide:hover:not(:disabled) { border-color: var(--line-strong); }
.vw-slide.on { border-color: var(--hema); box-shadow: 0 0 0 2px var(--hema-soft); }
.vw-slide:disabled { opacity: .55; cursor: not-allowed; }
.vw-thumb { height: 72px; display: grid; place-items: center; background: var(--surface-2); border-radius: 4px; overflow: hidden; color: var(--muted); }
.vw-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vw-slide-cap { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.vw-stain { font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--hema-soft); color: var(--hema); }
.vw-stain.he { background: var(--eosin-soft); color: var(--eosin); }
.vw-labelbtn { margin-top: 6px; }
.vw-centre { position: relative; min-width: 0; min-height: 0; background: #1b1f23; }
.vw-host { position: absolute; inset: 0; }
.vw-canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; touch-action: none; }
.vw-canvas.dragging { cursor: grabbing; }
.vw-canvas[data-tool="ruler"], .vw-canvas[data-tool="rect"], .vw-canvas[data-tool="polygon"] { cursor: crosshair; }
.vw-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.vw-bar { position: absolute; top: 10px; left: 10px; right: 230px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.vw-group { display: flex; gap: 2px; background: rgba(20,24,28,.84); border-radius: 8px; padding: 3px; pointer-events: auto; }
.vw-btn { min-width: 32px; height: 30px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: none; color: #e8eaed; cursor: pointer; font: 600 .82rem var(--font); padding: 0 6px; }
.vw-btn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.vw-btn.on { background: #16a394; color: #fff; }
.vw-btn:disabled { opacity: .4; cursor: default; }
.vw-mag.digital:not(.on) { color: #f2c14e; }
.vw-readout { position: absolute; top: 10px; right: 12px; background: rgba(20,24,28,.84); color: #fff; border-radius: 6px; padding: 5px 10px; font: 700 .9rem var(--font); }
.vw-readout:empty { display: none; }
.vw-scale { position: absolute; left: 12px; bottom: 12px; color: #fff; font: 600 .78rem var(--font); background: rgba(20,24,28,.72); padding: 4px 8px 3px; border-radius: 6px; }
.vw-scale-rule { height: 5px; border: 2px solid #fff; border-top: 0; margin-bottom: 2px; }
.vw-mini { position: absolute; right: 12px; bottom: 12px; width: 200px; height: 140px; background: rgba(20,24,28,.84); border: 1px solid rgba(255,255,255,.25); border-radius: 6px; cursor: crosshair; }
.vw-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 60%; background: rgba(20,24,28,.92); color: #fff; padding: 12px 16px; border-radius: 8px; text-align: center; }
.vw-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: 50%; background: rgba(20,24,28,.86); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: .8rem; }
.vw-status { position: absolute; right: 12px; bottom: 160px; color: #e8eaed; font-size: .75rem; background: rgba(20,24,28,.72); padding: 2px 8px; border-radius: 6px; }
.vw-status:empty, .vw-msg[hidden], .vw-hint[hidden], .vw-mini[hidden], .vw-scale[hidden] { display: none; }
.vw-side { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 12px; min-width: 0; }
.vw-fs:fullscreen { background: var(--bg, #fff); width: 100vw; height: 100vh; }
.vw-fsbar { display: none; position: absolute; top: 48px; right: 12px; z-index: 5; }
.vw-fs:fullscreen .vw-fsbar { display: flex; }
.vw-btn.vw-fs-side { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; white-space: nowrap; }
.vw-label-img { max-width: 100%; display: block; margin: 0 auto; }
.vw-label-none { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.qt-membrane { display: flex; flex-direction: column; gap: 4px; }
.qt-mtable { width: 100%; border-collapse: collapse; }
.qt-mtable td { padding: 2px 4px; border-bottom: 1px solid var(--line, #d8dde3); }
.qt-mtable td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qt-mtable tr.muted td { color: var(--muted, #6b7280); }
@media (max-width: 1100px) {
  .vw-body { grid-template-columns: 150px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .vw-side { grid-column: 1 / -1; max-height: 38vh; border-left: 0; border-top: 1px solid var(--line); }
}
.vw-title { font-size: 1.05rem; margin: 0; }
/* the AI scoring panel (js/pages/scoring.mjs), in the viewer's side slot */
.sc { display: flex; flex-direction: column; gap: 10px; }
.sc-title { display: flex; align-items: center; gap: 6px; font-size: 1rem; margin: 0; }
.sc-sec { border-top: 1px solid var(--line); padding-top: 8px; }
.sc-sec .b { font-weight: 600; }
.sc-warn { color: var(--warn, #9a6700); }
.sc-progress:empty { display: none; }
.sc-progress .spinner { width: 14px; height: 14px; }
.sc .card { margin: 0; }
.sc .form-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.sc-edited:empty { display: none; }
.sc-edited { color: var(--eosin); }
.sc-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.sc-list li:last-child { border-bottom: 0; }
.syn .prov { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 14px 0; color: var(--muted); }


/* ---------- the viewer: slide + work panel side by side; the menu and the tray collapse ---------- */
.app.nav-collapsed { grid-template-columns: 0 1fr; }
.app.nav-collapsed .nav { display: none; }
.vw-tgl { flex: none; }
.vw-tgl.on { background: var(--accent-12, rgba(75, 63, 160, .12)); color: var(--accent, #4b3fa0); }
.vw-body2 { flex: 1; min-height: 0; display: grid; grid-template-columns: 188px minmax(0, 1fr) 6px auto; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.vw-page.tray-collapsed .vw-body2 { grid-template-columns: 0 minmax(0, 1fr) 6px auto; }
.vw-page.tray-collapsed .vw-strip { display: none; }
.vw-body2 > .vw-centre { position: relative; min-width: 0; min-height: 0; display: flex; }
.vw-body2 > .vw-centre > .vw-host { flex: 1; min-width: 0; min-height: 0; }
.vw-grip { cursor: col-resize; background: var(--line, #d8dde3); }
.vw-grip:hover { background: var(--accent, #4b3fa0); }
.vw-grip[hidden], .vw-side2[hidden] { display: none; }
.vw-side2 { width: 460px; max-width: 70vw; min-height: 0; height: 100%; overflow: auto; background: var(--bg, #fff); border-left: 1px solid var(--line, #d8dde3); }
.vw-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line, #d8dde3); position: sticky; top: 0; background: var(--bg, #fff); z-index: 2; padding: 0 8px; }
.vw-tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 10px 12px; font-weight: 600; color: var(--muted, #5b6470); border-bottom: 2px solid transparent; cursor: pointer; }
.vw-tab.on { color: var(--ink, #1b1f2a); border-bottom-color: var(--accent, #4b3fa0); }
.vw-tabbody[hidden] { display: none; }
/* the report editor in the panel: one column */
.vw-side2 .report-layout { display: flex !important; flex-direction: column; gap: 12px; }
.vw-side2 .report-layout > * { width: 100% !important; max-width: none !important; }
.vw-side2 .grid2, .vw-side2 .grid3, .vw-side2 .form-grid { grid-template-columns: 1fr !important; }
.vw-side2 .report-layout .card:has(a[href*="/slides"]) { display: none; }
.vw-side2 .vw-tabbody > .stack { padding: 12px; }
/* the quantification panel */
.qt { display: flex; flex-direction: column; gap: 14px; padding: 12px 14px 24px; }
.qt-title { display: flex; align-items: center; gap: 8px; }
.qt-title h3 { margin: 0; font-size: 1rem; }
.qt-row { display: flex; align-items: center; gap: 10px; }
.qt-row > span { min-width: 64px; }
.qt-steps { margin: 4px 0 0; padding-left: 18px; color: var(--muted, #5b6470); display: grid; gap: 2px; }
.qt-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qt-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.qt-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line, #d8dde3); border-radius: 8px; }
.qt-field.on { border-color: #22d3ee; box-shadow: 0 0 0 2px rgba(34, 211, 238, .18); }
.qt-fname { display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 0; font-weight: 650; cursor: pointer; color: inherit; text-align: left; }
.qt-field > .small, .qt-field > b { grid-column: 1; }
.qt-factions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 4px; }
.qt-run { color: #b7791f; }
.qt-bad, .qt-warn { color: var(--danger, #c0392b); }
.qt-segs { display: inline-flex; border: 1px solid var(--line, #d8dde3); border-radius: 8px; overflow: hidden; margin: 6px 0; }
.qt-segs .seg-btn { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--muted, #5b6470); }
.qt-segs .seg-btn.on { background: var(--accent, #4b3fa0); color: #fff; }
.qt-legend { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.qt-legend li { display: flex; align-items: center; gap: 6px; }
.qt-legend b { margin-left: auto; }
.qt-sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .15); }
.qt-toggle { display: inline-flex; align-items: center; gap: 6px; }
.qt-card { padding: 12px; display: grid; gap: 10px; }
.qt-card header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.qt-summary { margin: 0; font-weight: 600; }
.qt-kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.qt-kv { display: flex; flex-direction: column; gap: 2px; }
.qt-note { width: 100%; }
.pr-box:empty { display: none; }
.pr-box { margin-bottom: 12px; }
.pr-ruo { margin: 0; padding: 8px 10px; border-left: 3px solid var(--warn); background: var(--warn-bg); color: var(--ink-2); border-radius: 4px; }
.pr-state { display: grid; gap: 6px; }
.pr-state p { margin: 0; }
.pr-prob { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pr-num { font-size: 1.6rem; font-weight: 750; }
.pr-bar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.pr-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: #d64500; }
.pr-thr { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-2); }
.pr-above { color: var(--warn); font-weight: 650; }
.pr-below { color: var(--ok); font-weight: 650; }
.pr-facts { margin: 0; padding-left: 18px; }
.pr-decide { display: grid; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line, #d8dde3); }
.pr-decided { font-weight: 600; }
.pr-op p { margin: 4px 0; }
/* the second-opinion card (js/pages/consult-card.mjs) */
.consult-req { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.consult-req:first-child { border-top: 0; padding-top: 0; }
.consult-msgs { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.consult-msg { background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }
.consult-msg.reply { margin-left: 14px; }
.consult-msg.withdrawn .pre-wrap { text-decoration: line-through; color: var(--muted); }
.pre-wrap { white-space: pre-wrap; }
.warn-box { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 8px 10px; }

/* ---- case images: the photo panel, the camera, the large view, the report's figures (js/photos.mjs) ---- */
.ph-panel .ph-defaults { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.ph-panel .ph-defaults .field { min-width: 130px; flex: 0 1 170px; margin: 0; }
.ph-panel .ph-defaults .field.check { flex: 0 0 auto; align-self: center; }
.ph-deflabel { font-weight: 650; font-size: .86rem; color: var(--ink-2); align-self: center; }
.ph-drop { position: relative; border: 2px dashed transparent; border-radius: var(--radius); padding: 2px; transition: border-color .12s, background .12s; }
.ph-drop.over { border-color: var(--hema); background: var(--hema-soft); }
.ph-drop.over::after { content: attr(data-hint); position: absolute; inset: 0; display: grid; place-items: center; font-weight: 650; color: var(--hema); background: color-mix(in srgb, var(--hema-soft) 85%, transparent); border-radius: var(--radius); }
.ph-drophint { margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.ph-item { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.ph-item.deleted { opacity: .7; }
.ph-thumb { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #1b1f23; cursor: zoom-in; }
.ph-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.ph-inrep { position: absolute; left: 6px; top: 6px; display: inline-flex; gap: 3px; align-items: center; font-size: .74rem; font-weight: 650; background: var(--hema); color: var(--on-hema); border-radius: 4px; padding: 1px 6px; }
.ph-item figcaption { padding: 7px 8px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.ph-cap { font-size: .88rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ph-ctl { gap: 2px; margin-top: auto; justify-content: flex-end; } .ph-ctl .icon-btn { width: 28px; height: 28px; }
.ph-rep { display: inline-flex; gap: 5px; align-items: center; font-size: .8rem; cursor: pointer; } .ph-rep input { width: auto; height: auto; }
.ph-del:hover { color: var(--bad); }
.ph-empty { padding: 22px 12px; }
.ph-progress:empty { display: none; }
dialog.modal.ph-modal, dialog.modal.ph-cammodal { width: min(1180px, calc(100vw - 24px)); }
.ph-viewer { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .ph-viewer { grid-template-columns: 1fr; } }
.ph-stage { position: relative; overflow: hidden; background: #1b1f23; border-radius: 6px; display: grid; place-items: center; min-height: 240px; user-select: none; touch-action: none; }
.ph-stage.cropping { cursor: crosshair; }
.ph-big { max-width: 100%; max-height: calc(100vh - 290px); display: block; }
.ph-sel { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
.ph-meta div + div { margin-top: 2px; }
.ph-vwrap { background: #111; border-radius: 6px; display: grid; place-items: center; min-height: 260px; }
.ph-video { max-width: 100%; max-height: calc(100vh - 380px); display: block; transition: opacity .15s; }
.ph-video.flash { opacity: .25; }
.ph-cammsg .alert { margin-bottom: 6px; }
.ph-shoot { min-width: 150px; height: 40px; font-size: 1rem; }
.ph-strip { display: flex; gap: 6px; flex-wrap: wrap; } .ph-strip:empty { display: none; }
.ph-shot { width: 84px; height: 63px; border-radius: 4px; overflow: hidden; background: #111; border: 2px solid var(--ok); }
.ph-shot.saving { border-color: var(--line-strong); opacity: .6; }
.ph-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-devices { width: auto; max-width: 420px; }
.ph-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin-top: 6px; }
.ph-fig { margin: 0; break-inside: avoid; } .ph-fig img { width: 100%; max-height: 280px; object-fit: contain; background: #f2f2f2; display: block; }
.ph-fig figcaption { font-size: .82rem; margin-top: 4px; color: #333; }
.vw-snap { white-space: nowrap; }
