/* VitalsLab — original styling. Page chrome follows the system light/dark theme;
 * the monitor screen itself is always dark for waveform contrast. */
:root {
  --bg: #f4f5f7; --panel: #ffffff; --text: #1d2330; --muted: #5d6677; --line: #d9dde5;
  --accent: #2563c9; --accent-text: #ffffff; --warn-bg: #fff4d6; --warn-text: #5c4300;
  --err: #b42318; --ok: #157347;
  --screen: #0c1016; --screen-line: #1d2531; --screen-text: #dfe6ef; --screen-muted: #7d8a9c;
  --ecg: #3fd47a; --pleth: #3cc4f0; --resp: #f2c94c; --cuff: #ef7fb8; --temp: #f59e5b; --ext: #b9a6ff;
  --art: #ff5a5a; --co2: #e6e6e6; --glu: #c3e88d;
  --hi: #ff4d4f; --med: #ffb020; --lo: #4fb6ff;
  --src-simulated: #6b7a90; --src-derived: #8a6d3b; --src-device: #0b7a75; --src-imported: #6d3fc0; --src-user: #b0306b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b; --panel: #181e26; --text: #e4e9f0; --muted: #98a3b3; --line: #2a3340;
    --accent: #4d8ef0; --warn-bg: #3a2f10; --warn-text: #f7dd8c; --err: #ff7b72; --ok: #4ac27d;
    --src-simulated: #9aa7ba; --src-derived: #d4b06a; --src-device: #36c2bb; --src-imported: #a98bff; --src-user: #ff7ab8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 11px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button[aria-pressed="true"] { background: var(--warn-bg); color: var(--warn-text); }
select, input { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; max-width: 100%; }
h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
h2 { font-size: 18px; } h3 { font-size: 15px; margin: 14px 0 6px; }
code { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; max-width: 75ch; }
.msgs { font-size: 12.5px; }
.msgs .err, .err { color: var(--err); } .msgs .ok, .ok { color: var(--ok); } .msgs .warn { color: var(--warn-text); background: var(--warn-bg); padding: 0 4px; border-radius: 3px; }

.notice { position: sticky; top: 0; z-index: 20; background: var(--warn-bg); color: var(--warn-text); padding: 6px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.topbar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; padding: 10px 16px; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand .sub { margin: 0; color: var(--muted); font-size: 12px; }
.brand .sub a { color: inherit; }
.logo { width: 30px; height: 30px; border-radius: 8px; background:
  linear-gradient(90deg, transparent 0 30%, var(--ecg) 30% 36%, transparent 36% 100%) 0 50%/100% 2px no-repeat, var(--screen); position: relative; }
.logo::after { content: ""; position: absolute; left: 9px; top: 7px; width: 6px; height: 16px; border-left: 2px solid var(--ecg); border-right: 2px solid var(--ecg); transform: skewX(-12deg); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* long scenario names must not widen the page on a phone */
.toolbar label.inline { max-width: 100%; min-width: 0; }
.toolbar label.inline select { max-width: calc(100vw - 110px); }
.inline { display: inline-flex; gap: 5px; align-items: center; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 8ch; }
.row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.row.wrap { flex-wrap: wrap; }

/* alarm bar */
.alarmbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 16px; padding: 6px 10px;
  background: var(--screen); color: var(--screen-text); border-radius: 8px 8px 0 0; min-height: 42px; }
.alarm-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alarm-count { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #1b2430; border: 1px solid #334155; }
.alarm-count.high { color: var(--hi); border-color: var(--hi); } .alarm-count.medium { color: var(--med); border-color: var(--med); } .alarm-count.low { color: var(--lo); }
.alarm-actions { display: flex; gap: 8px; align-items: center; }
.alarm-actions button { background: #1b2430; color: var(--screen-text); border-color: #334155; }
.alarm-actions button[aria-pressed="true"] { background: #4a3a10; color: #ffe39a; }
.alarm { padding: 3px 9px; border-radius: 4px; font-weight: 600; font-size: 13px; border: 1px solid transparent; }
.alarm.high { background: var(--hi); color: #fff; }
.alarm.medium { background: var(--med); color: #231800; }
.alarm.low { background: transparent; color: var(--lo); border-color: var(--lo); }
.alarm.unack.high { animation: blink 0.5s steps(1) infinite; } /* 2 Hz, IEC 60601-1-8 band 1.4–2.8 Hz */
.alarm.unack.medium { animation: blink 1.6s steps(1) infinite; } /* 0.625 Hz, band 0.4–0.8 Hz */
.alarm.acked { opacity: .65; text-decoration: line-through dotted; }
.alarm .tag { font-weight: 400; font-size: 11px; opacity: .85; margin-left: 4px; }
@keyframes blink { 50% { filter: brightness(.55); } }
@media (prefers-reduced-motion: reduce) { .alarm.unack { animation: none !important; } }

/* monitor screen */
.monitor { margin: 0 16px; background: var(--screen); color: var(--screen-text); border-radius: 0 0 8px 8px; padding: 6px 8px 10px;
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 8px; }
.waves { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wave { position: relative; border-bottom: 1px solid var(--screen-line); }
.wave canvas { display: block; width: 100%; height: 92px; }
.wave[data-ch="ecg"] canvas { height: 140px; }
.wave[data-ch="cuff"] canvas { height: 170px; }
.wave:last-child { border-bottom: none; }
.wave-label { position: absolute; left: 4px; top: 2px; font-size: 11px; font-weight: 600; letter-spacing: .3px; display: flex; gap: 10px; pointer-events: none; }
.wave-scale { color: var(--screen-muted); }
.wave[data-ch="ecg"] .wave-label { color: var(--ecg); } .wave[data-ch="pleth"] .wave-label { color: var(--pleth); }
.wave[data-ch="resp"] .wave-label { color: var(--resp); } .wave[data-ch="cuff"] .wave-label { color: var(--cuff); }
.wave[data-ch="art"] .wave-label { color: var(--art); } .wave[data-ch="co2"] .wave-label { color: var(--co2); }
.wave-scale { font-weight: 400; }
.wave.clickable { cursor: pointer; }
.wave-btn { position: absolute; right: 4px; top: 3px; z-index: 2; font-size: 11px; padding: 1px 7px; border-radius: 5px;
  background: rgba(12,16,22,.7); color: var(--ecg); border-color: var(--screen-line); }
.wave-btn:hover { border-color: var(--ecg); }

/* derived 12-lead ECG dialog: printed-paper look in both themes */
dialog.e12 { width: min(1180px, calc(100vw - 16px)); max-width: none; max-height: calc(100vh - 16px); padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
dialog.e12::backdrop { background: rgba(0,0,0,.55); }
.e12-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.e12-head h2 { margin: 0; }
.e12-btns { display: flex; gap: 6px; }
.e12-info { margin: 6px 0; font-size: 13px; }
.e12-paper { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.e12-paper canvas { display: block; width: 100%; min-width: 760px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.tile { border: 1px solid var(--screen-line); border-radius: 10px; padding: 6px 9px; min-height: 88px; position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 60%); }
.tile.wide, .tile.external { grid-column: span 2; }
.tile[data-ch="ecg"] { color: var(--ecg); } .tile[data-ch="pleth"] { color: var(--pleth); } .tile[data-ch="cuff"] { color: var(--cuff); }
.tile[data-ch="art"] { color: var(--art); } .tile[data-ch="co2"] { color: var(--co2); }
.tile[data-ch="glu"] { color: var(--glu); } .tile[data-ch="resp"] { color: var(--resp); } .tile[data-ch="temp"] { color: var(--temp); } .tile.external { color: var(--ext); min-height: 0; }
.t-head { display: flex; gap: 8px; font-size: 12px; font-weight: 600; align-items: baseline; }
.t-head .unit { color: var(--screen-muted); font-weight: 400; }
.nibp-state { margin-left: auto; font-weight: 400; color: var(--screen-muted); font-size: 11px; }
.t-val { font-size: 40px; line-height: 1.05; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.t-val small { font-size: 22px; }
.tile.wide .t-val, #tArt .t-val { font-size: 34px; }
#tArt .t-val { white-space: nowrap; } #tArt .t-val small { font-size: 18px; }
.t-foot { display: flex; justify-content: space-between; color: var(--screen-muted); font-size: 11px; gap: 6px; }
.t-sub { color: var(--screen-text); font-size: 11.5px; margin-top: 2px; }
.t-sub b { font-variant-numeric: tabular-nums; }
.tile .row button { background: #1b2430; color: var(--screen-text); border-color: #334155; padding: 3px 9px; font-size: 12px; }
.tile.sev-high, .tile.sev-medium, .tile.sev-low { border-width: 2px; padding: 5px 8px; }
.tile.sev-high { border-color: var(--hi); background: linear-gradient(180deg, rgba(255,77,79,.22), rgba(255,77,79,.06)); }
.tile.sev-medium { border-color: var(--med); background: linear-gradient(180deg, rgba(255,176,32,.18), rgba(255,176,32,.04)); }
.tile.sev-low { border-color: var(--lo); border-style: dashed; }
.t-issue { font-size: 11px; font-weight: 600; margin-top: 2px; }
.t-issue:empty { display: none; }
.sev-high .t-issue { color: var(--hi); } .sev-medium .t-issue { color: var(--med); } .sev-low .t-issue { color: var(--lo); }
.tile .stale { color: var(--screen-muted); }
.sqi { height: 4px; background: #222b37; border-radius: 2px; margin-top: 4px; overflow: hidden; }
.sqi-fill { height: 100%; width: 0; background: var(--pleth); transition: width .3s; }
.ext-list { font-size: 12px; color: var(--screen-text); display: grid; gap: 2px; margin-top: 3px; }
.ext-list .ext-row { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.ext-list .age { color: var(--screen-muted); }
.legend { margin: 6px 16px 0; font-size: 12px; color: var(--muted); }

/* tabs and panels */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 14px 16px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; background: transparent; padding: 6px 12px; }
.tabs button[aria-selected="true"] { background: var(--panel); border-color: var(--line); font-weight: 600; margin-bottom: -1px; }
.panel { background: var(--panel); margin: 0 16px; padding: 10px 16px 16px; border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.control-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 18px; align-items: start; }
.cgroup h3 { margin: 4px 0 2px; font-size: 14px; }
.ctl-view { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 4px 0 8px; }
.ctl-view label { cursor: pointer; }
.ctl-note { color: var(--muted); font-size: 12px; }
.control-groups:not(.show-help) .ctl .help { display: none; }
/* Scenario summary under the controls */
.scenario-summary { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); max-width: 110ch; }
.scenario-summary h4 { font-size: 13.5px; margin: 12px 0 4px; }
.scn-head { margin: 4px 0; } .scn-group { color: var(--muted); font-size: 12.5px; }
.scn-note { margin: 4px 0 6px; }
.scn-edited { color: var(--warn-text); background: var(--warn-bg); padding: 4px 8px; border-radius: 4px; }
.scn-changes { width: auto; min-width: min(100%, 420px); }
.scn-changes td.d { background: var(--warn-bg); color: var(--warn-text); }
.scn-changes th { position: static; }
.scn-refs { margin: 4px 0; padding-left: 3.2em; font-size: 12.5px; }
.scn-refs li { margin: 0 0 6px; overflow-wrap: anywhere; }
.scn-refs .supports { color: var(--muted); }
.scenario-details { margin-top: 0; border-top: 0; }
.scenario-details p { max-width: 95ch; }
.scn-kind { display: inline-block; margin: 0 0 4px; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; border: 1px solid var(--line); color: var(--muted); }
.ctl label[title] { cursor: help; }
.ctl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.ctl[hidden], .cgroup[hidden] { display: none; }
.ctl label { font-weight: 500; }
.ctl .u { color: var(--muted); font-size: 12px; }
.ctl input[type=range] { grid-column: 1 / -1; width: 100%; }
.ctl input[type=number] { width: 84px; }
.ctl select { min-width: 84px; max-width: 150px; justify-self: end; }
.ctl .help { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.ctl.changed { background: var(--warn-bg); border-radius: 4px; padding-left: 4px; }
.ctl.changed label::after { content: " • not default"; color: var(--warn-text); font-size: 11px; }
.ctl-issue { grid-column: 1 / -1; font-size: 12px; font-weight: 600; }
.ctl-issue:empty { display: none; }
.ctl.sev-high, .ctl.sev-medium, .ctl.sev-low { border-left: 4px solid; padding-left: 6px; border-radius: 4px; }
.ctl.sev-high { border-left-color: var(--hi); background: color-mix(in srgb, var(--hi) 12%, transparent); }
.ctl.sev-high .ctl-issue { color: var(--err); }
.ctl.sev-medium { border-left-color: var(--med); background: color-mix(in srgb, var(--med) 16%, transparent); }
.ctl.sev-medium .ctl-issue { color: var(--warn-text); }
.ctl.sev-low { border-left-color: var(--lo); border-left-style: dashed; }
.ctl.sev-low .ctl-issue { color: var(--accent); }
.sev-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.sev-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.sev-legend .h::before { background: var(--hi); } .sev-legend .m::before { background: var(--med); }
.sev-legend .l::before { border: 1px dashed var(--lo); } .sev-legend .d::before { background: var(--warn-bg); border: 1px solid var(--warn-text); }
.ctl.invalid input { border-color: var(--err); }

table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { max-height: 280px; overflow: auto; }
.table-wrap.tall { max-height: 420px; }
td code { word-break: break-all; }
#limitTable input { width: 70px; }
.plot { width: 100%; height: 260px; display: block; background: var(--screen); border-radius: 6px; }
.plot.tall { height: 340px; }
.chain-intro { font-weight: 600; max-width: 90ch; }
.stages { display: grid; gap: 10px; }
.stage { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--panel); }
.stage-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.stage-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--screen); color: var(--screen-text); font-size: 12px; }
.plot.stage-plot { height: 130px; }
.stage .hint { margin: 4px 0 0; }
.lessons { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ls-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ls-item { width: 100%; text-align: left; display: block; }
.ls-item[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ls-body { max-width: 80ch; }
.ls-body h3 { margin-top: 0; }
.ls-steps li { margin: 6px 0; }
.ls-steps button { margin: 2px 4px 2px 0; padding: 2px 8px; font-size: 12.5px; }
.ls-quiz fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 8px 12px; }
.ls-quiz legend { font-weight: 600; padding: 0 4px; }
.ls-opt { display: block; padding: 3px 0; cursor: pointer; }
.ls-why { margin: 6px 0 0; font-size: 13px; }
.ls-why.ok { color: var(--ok); } .ls-why.bad { color: var(--err); }
.ls-result { font-weight: 600; }
@media (max-width: 720px) { .lessons { grid-template-columns: minmax(0, 1fr); } }
.chain-readout { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-size: 13px; }
.stats { font-size: 12.5px; margin-top: 6px; }
.badge { display: inline-block; padding: 0 6px; border-radius: 9px; font-size: 11px; font-weight: 600; color: #fff; background: var(--src-simulated); white-space: nowrap; }
.badge.simulated { background: var(--src-simulated); } .badge.derived { background: var(--src-derived); }
.badge.device { background: var(--src-device); } .badge.imported { background: var(--src-imported); } .badge.user { background: var(--src-user); }
.badge.replay { background: #a15c00; } .badge.model { background: transparent; color: var(--screen-muted); border: 1px solid currentColor; margin-left: 6px; } .badge.q { background: transparent; color: var(--err); border: 1px solid currentColor; }
.android-panel { border-top: 1px solid var(--line); margin-top: 14px; }
.ble-devices { list-style: none; padding: 0; margin: 4px 0; font-size: 12.5px; } .ble-devices li { margin: 4px 0; }
.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); color: var(--accent); }
.filebtn { color: var(--accent); cursor: pointer; text-decoration: underline; }
.filebtn input { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; align-content: start; }
.form-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.form-grid label input, .form-grid label select { color: var(--text); }
.form-grid .row { grid-column: 1 / -1; }
.pair { display: flex; gap: 4px; } .pair input { flex: 1; min-width: 0; }
.derived { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.derived .card { border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.derived .card b { font-size: 22px; display: block; }
.usecases { border: 1px solid var(--line); border-radius: 6px; margin: 10px 0; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.usecases legend { font-weight: 600; padding: 0 4px; }
#pCalc { margin-bottom: 10px; }
#pCalc[hidden], #siRow[hidden] { display: none; }
.t-sub b.si-high { color: var(--med); }
.pt-banner { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 14px; border: 1px solid var(--screen-line); border-radius: 10px;
  padding: 5px 9px; font-size: 12px; color: var(--screen-text); }
.pt-banner .pb-k { color: var(--screen-muted); }
.pt-banner b { font-variant-numeric: tabular-nums; }
.pt-banner .pb-note { color: var(--screen-muted); font-size: 11px; }
.pt-banner b.si-high { color: var(--med); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.devcard { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 12.5px; }
.devcard .state { font-weight: 600; }
.routes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.routes .route { text-align: left; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; background: var(--panel); cursor: pointer; }
.routes .route[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.routes .route .st { font-weight: 600; display: block; margin-top: 2px; }
.routes .route small { display: block; color: var(--muted); }
p.warn { color: var(--warn-text); background: var(--warn-bg); padding: 4px 8px; border-radius: 6px; }
#devPaste { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; font-size: 12px; margin-top: 6px; }
.st.yes { color: var(--ok); } .st.no { color: var(--err); } .st.wait { color: var(--warn-text); }
.imp-help { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 8px 0; font-size: 13px; }
.imp-help > summary { cursor: pointer; font-weight: 600; }
.imp-help li { margin: 3px 0; }
.imp-params { font-size: 12px; }
.imp-params td:nth-child(2), .imp-params td:nth-child(3) { overflow-wrap: anywhere; }
.imp-samples { list-style: none; padding: 0; }
.imp-samples li { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin: 6px 0; }
.report { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 12.5px; }
.report summary { cursor: pointer; font-weight: 600; }
.prose { max-width: 100%; } .prose p, .prose li { max-width: 85ch; }
.eq { font-family: "Cambria Math", "STIX Two Math", "DejaVu Serif", serif; background: var(--bg); padding: 6px 10px; border-radius: 6px; overflow-x: auto; }
.refs li { margin-bottom: 4px; }
.result-pass { color: var(--ok); font-weight: 600; } .result-fail { color: var(--err); font-weight: 600; } .result-skip { color: var(--muted); font-weight: 600; }
.foot { margin: 20px 16px 30px; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .monitor { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 720px) {
  .monitor, .alarmbar, .panel, .tabs, .legend { margin-left: 8px; margin-right: 8px; }
  /* minmax(0, 1fr): a wide table scrolls inside .table-wrap instead of widening the page */
  .split, .control-groups, .form-grid, .derived { grid-template-columns: minmax(0, 1fr); }
  .row.wrap > .inline { flex-wrap: wrap; min-width: 0; }
  .t-val { font-size: 32px; }
  #tArt { grid-column: span 2; }
  .wave canvas { height: 74px; } .wave[data-ch="ecg"] canvas { height: 110px; } .wave[data-ch="cuff"] canvas { height: 160px; }
  .topbar { padding: 8px; }
}

/* community scenario sharing */
.share-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 6px 0; }
.share-row .hint { margin: 0; }
dialog.share { width: min(640px, calc(100vw - 16px)); max-height: calc(100vh - 16px); padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
dialog.share::backdrop { background: rgba(0,0,0,.55); }
dialog.share h2 { margin: 0 0 6px; } dialog.share h3 { margin: 10px 0 4px; font-size: 14px; }
dialog.share .warn { color: var(--warn-text); background: var(--warn-bg); padding: 6px 8px; border-radius: 6px; margin: 8px 0; }
.share-field { display: grid; gap: 2px; margin: 8px 0; }
.share-field span { font-weight: 600; }
.share-field small { color: var(--muted); }
.share-field input, .share-field textarea { width: 100%; box-sizing: border-box; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); font: inherit; color: inherit; }
.share-check { display: block; margin: 8px 0; }
.share-preview { max-height: 180px; overflow: auto; margin: 0; padding: 6px 8px; font-size: 12px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); white-space: pre-wrap; word-break: break-word; }
.share-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 10px; }
a.button { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 5px 11px; text-decoration: none; color: inherit; }
a.button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
a.button[aria-disabled="true"] { opacity: .45; pointer-events: none; }
