/*
  HS Evaluator 0.9.9 — Laboratory Method Evaluation Workstation (screen design).
  Desktop-style shell: title bar, collapsible grouped navigation, workspace tabs, context toolbar, status bar.
  Everything that changes the look is inside @media screen, so printed reports keep the layout defined in app.css.
*/
@media screen {
  :root { --radius: 4px; --sh-title: 38px; --sh-tabs: 32px; --sh-tool: 38px; --sh-status: 24px; --sh-nav: 232px; --sh-navc: 44px; --sh-dark: #10343A; --sh-dark2: #0C2A2F; }
  html, body { font-size: 13px; line-height: 1.42; height: 100%; overflow: hidden; background: #E9EDEF; }
  #app { height: 100%; }

  /* ---------- shell grid ---------- */
  .shell { display: grid; height: 100vh; grid-template-columns: var(--sh-nav) minmax(0, 1fr);
    grid-template-rows: var(--sh-title) var(--sh-tabs) var(--sh-tool) minmax(0, 1fr) var(--sh-status);
    grid-template-areas: "title title" "nav tabs" "nav tool" "nav main" "status status"; }
  .shell.navcol { grid-template-columns: var(--sh-navc) minmax(0, 1fr); }
  .shell.max { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: var(--sh-title) 0 var(--sh-tool) minmax(0, 1fr) var(--sh-status); }
  .shell.max .shell-nav, .shell.max .shell-tabs { display: none; }
  .shell:has(> .shell-main.setup) { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: var(--sh-title) 0 0 minmax(0, 1fr) var(--sh-status); }

  .shell-title { grid-area: title; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--sh-dark); color: #E4F1EF; }
  .sh-brand { display: flex; align-items: center; gap: 8px; color: #FFFFFF; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 15px; white-space: nowrap; }
  .sh-brand svg rect { fill: #14A394; }
  .sh-sub { font-family: var(--font); font-weight: 400; font-size: 12px; color: #9CC5BF; padding-left: 10px; border-left: 1px solid #2E5B60; }
  .sh-spacer { flex: 1 1 auto; }
  .sh-lab { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #BFDCD8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
  .sh-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 3px; background: transparent; color: inherit; cursor: pointer; }
  .sh-iconbtn:hover { background: #ffffff1f; }
  .ico { flex: 0 0 auto; vertical-align: middle; }

  /* navigation */
  .shell-nav { grid-area: nav; background: #F7F9FA; border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding: 6px 0 0; }
  .nav-group { padding: 2px 0 6px; }
  .nav-gh { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6B7B86; padding: 8px 12px 3px; white-space: nowrap; }
  .nav-item { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 14px; min-height: 26px; color: var(--ink2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid transparent; }
  .nav-item span { overflow: hidden; text-overflow: ellipsis; }
  .nav-item:hover { background: #E8EEF0; }
  .nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; border-left-color: var(--accent); }
  .nav-collapse { margin-top: auto; position: sticky; bottom: 0; display: flex; align-items: center; justify-content: center; height: 28px; border: 0; border-top: 1px solid var(--line); background: #EEF2F4; color: var(--ink2); cursor: pointer; }
  .shell.navcol .nav-gh { font-size: 0; height: 1px; padding: 4px 0; border-top: 1px solid var(--line); margin: 3px 8px; }
  .shell.navcol .nav-group:first-child .nav-gh { border-top: 0; }
  .shell.navcol .nav-item { justify-content: center; padding: 5px 0; border-left-width: 0; }
  .shell.navcol .nav-item span { display: none; }

  /* workspace tabs */
  .shell-tabs { grid-area: tabs; display: flex; align-items: flex-end; gap: 1px; padding: 0 6px; background: #DCE3E6; border-bottom: 1px solid #C4CED3; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
  .wtab { display: flex; align-items: center; max-width: 230px; min-width: 0; height: 27px; border: 1px solid #C4CED3; border-bottom: 0; border-radius: 3px 3px 0 0; background: #EAEFF1; flex: 0 0 auto; }
  .wtab a { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; height: 100%; color: var(--ink2); text-decoration: none; min-width: 0; }
  .wtab a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wtab.on { background: #FFFFFF; height: 29px; margin-bottom: -1px; border-color: #C4CED3; box-shadow: inset 0 2px 0 var(--accent); }
  .wtab.on a { color: var(--ink); font-weight: 600; }
  .wtab-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-right: 4px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; }
  .wtab-x:hover { background: #D5DDE1; color: var(--ink); }

  /* toolbar */
  .shell-toolbar { grid-area: tool; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: #FFFFFF; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .tb-btn { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--ink); font: 500 12.5px var(--font); cursor: pointer; white-space: nowrap; }
  .tb-btn:hover:not(:disabled) { background: #EEF3F4; border-color: #D5DEE2; }
  .tb-btn.primary { color: var(--accent-ink); font-weight: 600; }
  .tb-btn.primary .ico { color: var(--accent); }
  .tb-btn:disabled { opacity: .42; cursor: default; }
  .tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: 0 0 auto; }

  /* main working area */
  .shell-main { grid-area: main; overflow: auto; min-width: 0; min-height: 0; background: #EEF1F3; position: relative; }
  .shell-main.setup { background: var(--bg); }

  /* status bar */
  .shell-status { grid-area: status; display: flex; align-items: center; gap: 0; padding: 0 6px; background: var(--sh-dark2); color: #B9D3CF; font-size: 11.5px; white-space: nowrap; overflow: hidden; }
  .st-item { display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; border-right: 1px solid #ffffff1a; color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
  .st-item:last-child { border-right: 0; }
  .st-item.warn { color: #FCD38A; }
  .st-dot { width: 7px; height: 7px; border-radius: 50%; background: #F2B544; }
  .st-item.ok .st-dot { background: #36C2A8; }

  /* ---------- compact re-skin of existing controls ---------- */
  .page { max-width: none; margin: 0; padding: 12px 14px 20px; gap: 10px; }
  .page.narrow { max-width: 1060px; }
  h1 { font-size: 19px; }
  h2 { font-size: 13.5px; }
  .eyebrow { font-size: 11px; }
  .small { font-size: 12px; } .tiny { font-size: 11px; }
  .card { border-radius: 4px; padding: 10px 12px; gap: 8px; box-shadow: none; border-color: #D3DBDF; }
  .row, .stack { gap: 10px; }
  .grid2, .grid3, .gridauto { gap: 8px; }
  .btn { min-height: 28px; padding: 0 10px; border-radius: 3px; font-size: 12.5px; gap: 5px; }
  .tabs { border-radius: 3px; }
  .tabs button { min-height: 28px; padding: 0 12px; font-size: 12.5px; }
  label.field { font-size: 12px; gap: 3px; }
  .input, select.input, textarea.input { padding: 4px 7px; border-radius: 3px; font-size: 13px; min-height: 28px; }
  .input.cell { width: 72px; padding: 3px 5px; font-size: 13px; min-height: 24px; }
  .hint { font-size: 11px; }
  .check { font-size: 12.5px; gap: 7px; }
  .check input, .choice input { width: 15px; height: 15px; }
  .choice { padding: 6px 9px; border-radius: 3px; }
  .note { font-size: 12px; padding: 6px 9px; border-radius: 3px; }
  .chip { padding: 1px 7px; font-size: 11.5px; border-radius: 3px; }
  .banner { border-radius: 4px; padding: 8px 12px; border-width: 1px; border-left-width: 5px; gap: 10px; }
  .banner .big { font-size: 16px; }
  .banner .text { font-size: 12px; }
  table.t { font-size: 12.5px; }
  table.t th { font-size: 10.5px; padding: 5px 8px; }
  table.t td, table.t tbody th { padding: 4px 8px; }
  table.t tbody th { font-size: 12.5px; }
  .dl { padding: 5px 0; font-size: 12.5px; }
  dl.dl dt, dl.dl dd { padding: 4px 0; }
  .tile { border-radius: 4px; padding: 7px 10px; }
  .tile .n { font-size: 18px; }
  .tile .l { font-size: 11.5px; }
  .pagehead { gap: 8px; }

  /* ---------- reusable workstation components ---------- */
  /* study workspace: view tabs + explorer + content */
  .ws { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
  .ws-head { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: #FFFFFF; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .ws-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .ws-title h1 { font-size: 15px; white-space: nowrap; }
  .ws-title .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ws-views { display: flex; gap: 0; margin-left: auto; border: 1px solid #C4CED3; border-radius: 3px; overflow: hidden; }
  .ws-views button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border: 0; border-right: 1px solid #C4CED3; background: #F6F8F9; color: var(--ink2); font: 500 12px var(--font); cursor: pointer; white-space: nowrap; }
  .ws-views button:last-child { border-right: 0; }
  .ws-views button.on { background: var(--accent); color: #FFFFFF; }
  .ws-views button .badge { background: #ffffff33; border-radius: 2px; padding: 0 4px; font-size: 10.5px; }
  .ws-views button:not(.on) .badge { background: #E1E8EB; }
  .ws-body { display: grid; grid-template-columns: var(--ws-x, 236px) minmax(0, 1fr); min-height: 0; }
  .ws-body.nox { grid-template-columns: minmax(0, 1fr); }
  .ws-body.xcol { grid-template-columns: 30px minmax(0, 1fr); }
  .ws-x { background: #FFFFFF; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; position: relative; }
  .ws-xh { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #5F707B; }
  .ws-xh .sh-spacer { flex: 1; }
  .ws-xh button { border: 0; background: transparent; cursor: pointer; color: var(--ink2); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; }
  .ws-xh button:hover { background: #EEF3F4; }
  .ws-xl { overflow-y: auto; flex: 1 1 auto; padding: 3px 0; }
  .ws-xi { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; padding: 5px 10px 5px 11px; border: 0; border-left: 3px solid transparent; background: transparent; cursor: pointer; font: 12.5px var(--font); color: var(--ink); }
  .ws-xi:hover { background: #F1F5F6; }
  .ws-xi.on { background: var(--accent-soft); border-left-color: var(--accent); }
  .ws-xi b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ws-xi .meta { display: flex; gap: 5px; align-items: center; color: var(--muted); font-size: 11px; }
  .ws-xi .meta .chip { font-size: 10.5px; padding: 0 5px; }
  .ws-xadd { border-top: 1px solid var(--line2); padding: 8px; display: flex; flex-direction: column; gap: 5px; }
  .ws-body.xcol .ws-xl, .ws-body.xcol .ws-xadd, .ws-body.xcol .ws-xh span { display: none; }
  .ws-body.xcol .ws-xh { flex-direction: column; padding: 6px 2px; }
  .ws-content { overflow: auto; min-width: 0; min-height: 0; padding: 10px 12px 18px; display: flex; flex-direction: column; gap: 10px; }
  .ws-content.flush { padding: 0; }

  /* DataLayout-style configuration form */
  .dlay { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 8px; align-items: start; }
  .dlg { background: #FFFFFF; border: 1px solid #D3DBDF; border-radius: 4px; min-width: 0; }
  .dlg.wide { grid-column: 1 / -1; }
  .dlg > .dlg-h, .dlg > summary { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: #F3F6F7; border-bottom: 1px solid #E1E7EA; font-weight: 700; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: #3F525E; cursor: default; list-style: none; }
  .dlg > summary { cursor: pointer; }
  .dlg > summary::-webkit-details-marker { display: none; }
  details.dlg:not([open]) > summary { border-bottom: 0; }
  .dlg-b { padding: 8px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 10px; }
  .dlg-b > .span2 { grid-column: span 2; } .dlg-b > .full { grid-column: 1 / -1; }
  .dlg-b > .note, .dlg-b > .check, .dlg-b > p, .dlg-b > .tablewrap, .dlg-b > table, .dlg-b > .btnrow { grid-column: 1 / -1; margin: 0; }
  .kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: 12.5px; grid-column: 1 / -1; margin: 0; }
  .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
  .lockbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid #D3DBDF; border-radius: 4px; background: #FFFFFF; flex-wrap: wrap; }
  .lockbar.locked { background: #F3F8F7; border-color: #9FCBC4; }
  .lockbar .txt { flex: 1 1 260px; font-size: 12px; color: var(--ink2); }
  fieldset.locked { border: 0; padding: 0; margin: 0; min-width: 0; }

  /* spreadsheet grid */
  .xgrid-wrap { background: #FFFFFF; border: 1px solid #C9D3D8; border-radius: 3px; overflow: auto; max-height: calc(100vh - 290px); min-height: 120px; }
  .xgrid-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 4px 6px; border: 1px solid #C9D3D8; border-bottom: 0; border-radius: 3px 3px 0 0; background: #F6F8F9; }
  .xgrid-tools + .xgrid-wrap { border-radius: 0 0 3px 3px; }
  .xgrid-tools .tb-btn { height: 24px; padding: 0 7px; font-size: 12px; }
  .xgrid-tools .info { margin-left: auto; color: var(--muted); font-size: 11.5px; }
  table.xgrid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
  table.xgrid th { position: sticky; top: 0; z-index: 2; background: #EDF1F3; color: #44555F; font-weight: 600; font-size: 11.5px; padding: 3px 6px; border-right: 1px solid #D6DEE2; border-bottom: 1px solid #C9D3D8; text-align: center; white-space: nowrap; }
  table.xgrid th.rh, table.xgrid td.rh { position: sticky; left: 0; z-index: 1; background: #EDF1F3; color: #5B6B75; text-align: right; min-width: 44px; padding: 0 6px; border-right: 1px solid #C9D3D8; font-weight: 500; }
  table.xgrid th.rh { z-index: 3; }
  table.xgrid td { padding: 0; border-right: 1px solid #E3E9EC; border-bottom: 1px solid #E3E9EC; height: 23px; }
  table.xgrid td input[type=checkbox] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
  table.xgrid td input:not([type=checkbox]):not(.input) { width: 100%; min-width: 64px; height: 22px; border: 0; padding: 0 6px; text-align: right; font: inherit; background: transparent; color: var(--ink); outline: none; }
  table.xgrid td input:not([type=checkbox]):not(.input):focus { box-shadow: inset 0 0 0 2px var(--accent); background: #FFFFFF; }
  table.xgrid td.bad input:not([type=checkbox]) { background: var(--bad-soft); color: var(--bad); }
  table.xgrid td.miss input { background: #FFF9E8; }
  table.xgrid tr.excl td:not(.rh):not(.act) input { text-decoration: line-through; color: #8C99A1; background: #F4F4F4; }
  table.xgrid tr.excl td.rh { color: var(--bad); }
  table.xgrid td.act { padding: 0 4px; white-space: nowrap; text-align: left; background: #FAFBFC; }
  table.xgrid td.act button { height: 20px; padding: 0 6px; border: 1px solid #CCD5DA; border-radius: 2px; background: #FFFFFF; font: 11px var(--font); cursor: pointer; color: var(--ink2); }
  table.xgrid td.act .why { font-size: 11px; color: var(--bad); margin-left: 4px; }
  table.xgrid tr:hover td:not(.rh) { background-color: #F6FAFA; }

  /* analytical results workspace */
  .rws { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 10px; align-items: start; }
  .rws > * { min-width: 0; }
  .rws .pane { background: #FFFFFF; border: 1px solid #D3DBDF; border-radius: 4px; display: flex; flex-direction: column; min-width: 0; }
  .rws .pane-h { display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: #F3F6F7; border-bottom: 1px solid #E1E7EA; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #3F525E; }
  .rws .pane-h .ptabs { margin-left: auto; display: flex; gap: 2px; text-transform: none; letter-spacing: 0; }
  .rws .pane-h .ptabs button { height: 22px; padding: 0 8px; border: 1px solid transparent; border-radius: 2px; background: transparent; font: 600 11.5px var(--font); color: var(--ink2); cursor: pointer; }
  .rws .pane-h .ptabs button.on { background: #FFFFFF; border-color: #C9D3D8; color: var(--accent-ink); }
  .rws .pane-b { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .rws .pane-b > .card { border: 0; padding: 0; }
  .rws .full { grid-column: 1 / -1; }
  .rws .chart { max-width: 100%; max-height: 360px; }
  .resizable { resize: horizontal; overflow: auto; }

  /* study list (master-detail) */
  .slist { display: grid; grid-template-columns: 220px minmax(0, 1fr); height: 100%; min-height: 0; }
  .slist.full { grid-template-columns: minmax(0, 1fr); }
  .slist.full .slist-x { display: none; }
  .slist-x { background: #FFFFFF; border-right: 1px solid var(--line); overflow-y: auto; }
  .slist-x .grp { padding: 6px 0; border-bottom: 1px solid var(--line2); }
  .slist-x .grp-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6B7B86; padding: 3px 10px; }
  .slist-x button { display: flex; justify-content: space-between; width: 100%; padding: 3px 10px 3px 12px; border: 0; background: transparent; text-align: left; font: 12.5px var(--font); color: var(--ink2); cursor: pointer; }
  .slist-x button:hover { background: #F1F5F6; }
  .slist-x button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
  .slist-x button .n { color: var(--muted); font-size: 11px; }
  .slist-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
  .slist-filter { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #FFFFFF; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .slist-filter .input { width: auto; min-width: 120px; }
  .slist-filter .search { position: relative; flex: 1 1 220px; max-width: 360px; }
  .slist-filter .search .ico { position: absolute; left: 7px; top: 6px; color: var(--muted); }
  .slist-filter .search input { padding-left: 26px; }
  .slist-grid { overflow: auto; min-height: 0; background: #FFFFFF; }
  table.lgrid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
  table.lgrid th { position: sticky; top: 0; z-index: 1; background: #EDF1F3; text-align: left; font-size: 11px; font-weight: 600; color: #44555F; padding: 5px 8px; border-bottom: 1px solid #C9D3D8; border-right: 1px solid #DCE3E6; white-space: nowrap; cursor: pointer; user-select: none; }
  table.lgrid th .sort { color: var(--accent); margin-left: 3px; }
  table.lgrid td { padding: 4px 8px; border-bottom: 1px solid #EBF0F2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
  table.lgrid tbody tr { cursor: pointer; }
  table.lgrid tbody tr:hover td { background: #F3F8F8; }
  table.lgrid tbody tr.on td { background: var(--accent-soft); }
  .slist-detail { border-top: 1px solid var(--line); background: #FFFFFF; padding: 8px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: start; max-height: 34vh; overflow: auto; }
  .slist-detail .kv { grid-template-columns: repeat(4, max-content minmax(80px, 1fr)); grid-column: auto; }

  /* report preview (document viewer) */
  .rv { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; min-height: 0; }
  .rv-bar { display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: #FFFFFF; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .rv-bar .pg { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink2); padding: 0 6px; }
  .rv-bar .pg input { width: 42px; height: 24px; text-align: center; border: 1px solid #C4CED3; border-radius: 2px; font: inherit; }
  .rv-bar .zoom { font-size: 12px; min-width: 44px; text-align: center; color: var(--ink2); }
  .rv-bar .hint { margin-left: auto; }
  .rv-stage { background: #5F6B72; overflow: auto; position: relative; }
  .rv-host { position: absolute; inset: 0; }
  .rv-stage iframe { border: 0; width: 100%; height: 100%; display: block; background: #5F6B72; }
  .rv-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #FFFFFF; font-size: 13px; }

  /* results and evaluation = the report document (always in the page so printing always gives the report) */
  .ws-report.page { padding: 0; margin: 0; max-width: none; display: flex; flex-direction: column; gap: 10px; }
  .ws-report.offscreen { display: none !important; }
  .ws-report > .rg-left, .ws-report > .rg-right { display: contents; }
  .ws-report > .guide-card, .ws-report > details.guide-card { display: none; }
  .ws-report .chart { max-width: 100%; }
  .rg-head { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #5F707B; }
  @media (max-width: 1100px) { .ws-report.page { flex-direction: column; } .ws-report > .rg-right { flex-basis: auto; width: 100%; position: static; max-height: none; } }

  /* home dashboard tiles in the workstation */
  .wsgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }

  @media (max-width: 900px) {
    .shell { grid-template-columns: 0 minmax(0, 1fr); }
    .shell .shell-nav { display: none; }
    .shell.mnav .shell-nav { display: flex; position: fixed; z-index: 50; top: var(--sh-title); bottom: var(--sh-status); left: 0; width: 260px; box-shadow: 4px 0 18px #0003; }
    .sh-sub, .sh-lab { display: none; }
    .tb-btn span { display: none; }
    .ws-body { grid-template-columns: minmax(0, 1fr); }
    .ws-body .ws-x { display: none; }
    .ws-body.xopen .ws-x { display: flex; }
    .rws { grid-template-columns: minmax(0, 1fr); }
    .slist { grid-template-columns: minmax(0, 1fr); }
    .slist-x { display: none; }
    .ws-views button span.lbl { display: none; }
    .shell-status .st-item:nth-child(n+3):not(:last-child) { display: none; }
    .ws-title { flex-wrap: wrap; } .ws-title .sub { display: none; } .ws-head > .btnrow { margin-left: 0 !important; }
    .slist-filter .search { flex-basis: 100%; max-width: none; }
  }
}

/* Print: the shell disappears and the page flows as before. */
@media print {
  .shell { display: block !important; height: auto !important; }
  .shell-main { overflow: visible !important; height: auto !important; }
  .shell-title, .shell-nav, .shell-tabs, .shell-toolbar, .shell-status, .ws-head, .ws-x, .rv, .xgrid-tools { display: none !important; }
  /* study workspace: only the report document (.ws-report) prints, whatever view is open */
  .ws, .ws-body, .ws-content { display: block !important; padding: 0 !important; overflow: visible !important; height: auto !important; }
  .ws-content > *:not(.ws-report) { display: none !important; }
  .ws-report > .rg-left, .ws-report > .rg-right { display: contents !important; }
}
@media screen {
  .ws-pop { position: fixed; z-index: 60; top: 120px; right: 24px; width: min(560px, 92vw); box-shadow: 0 10px 34px #0004; }
  .record-card > summary { cursor: pointer; }
}

/* ---------------- 0.10 refinements (screen only) ---------------- */
@media screen {
  body.hse-resizing { cursor: col-resize; user-select: none; }
  .shell-nav { position: relative; }
  .nav-split, .x-split { position: absolute; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; z-index: 5; }
  .nav-split:hover, .x-split:hover, body.hse-resizing .nav-split, body.hse-resizing .x-split { background: #0F766E33; }
  .sh-density { height: 24px; padding: 0 8px; border: 1px solid #2E5B60; border-radius: 3px; background: transparent; color: #CFE6E2; font: 500 11.5px var(--font); cursor: pointer; }
  .sh-density:hover { background: #ffffff1a; }
  .tb-more { position: relative; margin-left: auto; flex: 0 0 auto; }
  .tb-menu { position: absolute; right: 0; top: 32px; z-index: 70; min-width: 190px; background: #FFFFFF; border: 1px solid #C9D3D8; border-radius: 3px; box-shadow: 0 8px 24px #0003; padding: 4px; display: flex; flex-direction: column; }
  .tb-mi { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px; border: 0; background: transparent; font: 12.5px var(--font); color: var(--ink); text-align: left; cursor: pointer; border-radius: 2px; }
  .tb-mi:hover:not(:disabled) { background: #EEF3F4; }
  .tb-mi:disabled { opacity: .45; }
  .shell-toolbar { overflow: visible; }
  .ws-concl { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px dashed #B9C4CB; border-radius: 3px; background: #FFFFFF; font: 600 11.5px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
  .ws-concl.ok { border-style: solid; border-color: #9FCBC4; background: var(--accent-soft); color: var(--accent-ink); }
  .ws-concl.bad { border-style: solid; border-color: #E7B4AE; background: var(--bad-soft); color: var(--bad); }
  .rtabs { display: flex; gap: 0; border-bottom: 1px solid #C9D3D8; margin: -2px 0 2px; position: sticky; top: -10px; z-index: 4; background: #EEF1F3; padding-top: 2px; }
  .rtabs button { height: 28px; padding: 0 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 3px 3px 0 0; background: transparent; font: 600 12px var(--font); color: var(--ink2); cursor: pointer; margin-bottom: -1px; }
  .rtabs button.on { background: #FFFFFF; border-color: #C9D3D8; color: var(--accent-ink); box-shadow: inset 0 2px 0 var(--accent); }

  /* tagged pages: each view shows only its sections (parameters = wsv-config, data entry = wsv-data) */
  .ws-content.tagged[data-view=list] > .ws-report, .ws-content.tagged[data-view=report] > .ws-report { display: none !important; }
  .ws-content.tagged[data-view=config] :where(.ws-report, :has(.wsv-config)):not(.wsv-config *) > :not(.wsv-config):not(:has(.wsv-config)):not(style) { display: none !important; }
  .ws-content.tagged[data-view=data] :where(.ws-report, :has(.wsv-data)):not(.wsv-data *) > :not(.wsv-data):not(:has(.wsv-data)):not(style) { display: none !important; }
  .ws-content.tagged[data-view=results]:not([data-rtab=full]) :is(.wsv-config, .wsv-data):not(.wsv-results) { display: none !important; }
  .ws-content[data-view=results][data-rtab=full] .ws-report :is(.no-print, .lockbar) { display: none !important; }
  .ws-content[data-view=results][data-rtab=full] .ws-report .print-only { display: block; }
  .ws-content.tagged:not([data-view=results]) .ws-report > .banner, .ws-content.tagged:not([data-view=results]) .item-block .banner:not(.wsv-config):not(.wsv-data) { display: none !important; }
  .ws-content.tagged .ws-report .pagehead.no-print > .titles { display: none; }

  /* results sub-tabs (all study pages) */
  .ws-content[data-view=results]:not([data-rtab=full]) .ws-report .guide-card { display: none !important; }
  .ws-content[data-view=results][data-rtab=stats] .ws-report :is(.rg-crit, .rg-all, section.card:has(svg.chart):not(:has(table)), .wsv-config, .wsv-data) { display: none !important; }
  .ws-content[data-view=results][data-rtab=stats] .ws-report svg.chart { display: none !important; }
  .ws-content[data-view=results][data-rtab=charts] .ws-report :is(.rg-crit, .rg-all, section.card:not(:has(svg.chart)), aside.card:not(:has(svg.chart)), .wsv-config, .wsv-data) { display: none !important; }
  .ws-content[data-view=results][data-rtab=charts] .ws-report section.card:has(svg.chart) .tablewrap { display: none; }
  .ws-content[data-view=results][data-rtab=crit] .ws-report :is(section.card:not(.rg-crit), aside.card, .rg-all, .wsv-config, .wsv-data) { display: none !important; }
  .ws-content[data-view=results][data-rtab=crit] .ws-report .item-block.cur:not(:has(.rg-crit)) { display: none !important; }
  .ws-content[data-view=results][data-rtab=all] .ws-report :is(.item-block, .rg-crit, .wsv-config, .wsv-data) { display: none !important; }
  .ws-content[data-view=results] .ws-report .section-label { display: none; }

  /* configuration: DataLayout-style horizontal label | editor rows, adaptive columns */
  .dlg-b { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 14px; }
  .dlg-b > label.field, .wsv-config label.field, .ws-content[data-view=config] .ws-report label.field {
    display: grid; grid-template-columns: minmax(110px, 44%) minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 1px; font-weight: 500; color: var(--ink2); }
  .dlg-b > label.field > :is(.input, select, textarea), .wsv-config label.field > :is(.input, select, textarea) { grid-column: 2; }
  .dlg-b > label.field > .hint, .wsv-config label.field > .hint { grid-column: 1 / -1; }
  .dlg-b > label.field:has(> textarea), .wsv-config label.field:has(> textarea) { grid-template-columns: minmax(0, 1fr); }
  .dlg-b > .span2 { grid-column: span 2; }
  .ws-content[data-view=config] .ws-report :is(.grid2, .grid3) { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 4px 14px; }
  .ws-content[data-view=config] .ws-report section.card.wsv-config { padding: 8px 10px; }
  .ws-content[data-view=config] .ws-report section.card.wsv-config > h2, .ws-content[data-view=config] .ws-report section.card.wsv-config .pagehead h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: #3F525E; }

  /* data entry fills the working area */
  .dv-wrap { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; }
  .dv-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .dv { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 10px; flex: 1 1 auto; min-height: 380px; }
  .dv > .dv-main { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
  .dv > .dv-side { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
  .dv .xgrid-box { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .dv .xgrid-wrap { flex: 1 1 auto; max-height: none; min-height: 160px; }
  .dv-mode { display: inline-flex; border: 1px solid #C4CED3; border-radius: 3px; overflow: hidden; }
  .dv-mode button { height: 24px; padding: 0 10px; border: 0; border-right: 1px solid #C4CED3; background: #F6F8F9; font: 600 11.5px var(--font); color: var(--ink2); cursor: pointer; }
  .dv-mode button:last-child { border-right: 0; }
  .dv-mode button.on { background: var(--accent); color: #FFFFFF; }
  .ws-content[data-view=data] { overflow: auto; }
  .xgrid-review { border: 1px solid #E3C77A; background: #FFFBEB; border-radius: 3px; padding: 6px 8px; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
  .xgrid-review td.bad { background: var(--bad-soft); color: var(--bad); }
  th { position: relative; }
  .col-grip { position: absolute; top: 0; right: -2px; width: 5px; height: 100%; cursor: col-resize; z-index: 3; }
  .col-grip:hover { background: #0F766E44; }
  table.xgrid th.ghead { background: #E2E9EC; border-bottom: 1px solid #D0D8DC; }
  table.xgrid thead tr:nth-child(2) th { top: 21px; }
  table.lgrid tbody tr:focus-within td, table.lgrid:focus { outline: none; }
  table.lgrid:focus tbody tr.on td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }

  /* comfortable density */
  .shell.density-comfortable { --sh-title: 44px; --sh-tabs: 36px; --sh-tool: 44px; --sh-status: 26px; }
  .density-comfortable { font-size: 14px; }
  .density-comfortable .btn, .density-comfortable .tb-btn { min-height: 32px; height: auto; font-size: 13.5px; }
  .density-comfortable .input, .density-comfortable select.input { min-height: 32px; font-size: 14px; padding: 5px 8px; }
  .density-comfortable table.t, .density-comfortable table.lgrid, .density-comfortable table.xgrid { font-size: 13.5px; }
  .density-comfortable table.t td, .density-comfortable table.t tbody th, .density-comfortable table.lgrid td { padding: 6px 9px; }
  .density-comfortable table.xgrid td { height: 28px; } .density-comfortable table.xgrid td input:not([type=checkbox]):not(.input) { height: 27px; }
  .density-comfortable .card { padding: 12px 14px; gap: 10px; }
  .density-comfortable .nav-item { min-height: 30px; }
  .density-comfortable .ws-views button { height: 30px; font-size: 13px; }
  .density-comfortable .rtabs button { height: 32px; font-size: 13px; }

  @media (max-width: 1280px) {
    .dv { grid-template-columns: minmax(0, 1fr); height: auto; }
    .dv .xgrid-wrap { max-height: 62vh; }
    .ws-head .ws-title .sub { display: none; }
  }
}
@media screen {
  /* one assay/sample: the study banner repeats the set banner (hidden on the printed report too) */
  .ws-report > .banner.print-one-hide, .ws-report > .rg-left > .banner.print-one-hide { display: none; }
  .ws-content[data-view=results][data-rtab=stats] .ws-report .row > .grow.stack:not(:has(table)) { display: none; }
}
