/* «Показатели пациента»: tiles in the colours staff know from the monitor */
:root { --v-hr: #1f9d3a; --v-spo2: #0a8fb5; --v-bp: #d6322f; --v-resp: #b8860b; --v-temp: #8a4fd1; --v-gas: #7a7a82; --v-nibp: #e07a3a; --v-rr: #8a6a10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --v-hr: #3fd45e; --v-spo2: #36c6ee; --v-bp: #ff6a62; --v-resp: #f2c94c; --v-temp: #b98cff; --v-gas: #c8c8d0; --v-nibp: #ffb38a; --v-rr: #d9b860; } }
:root[data-theme="dark"] { --v-hr: #3fd45e; --v-spo2: #36c6ee; --v-bp: #ff6a62; --v-resp: #f2c94c; --v-temp: #b98cff; --v-gas: #c8c8d0; --v-nibp: #ffb38a; --v-rr: #d9b860; }

.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 12px; margin: 14px 0 6px; }
.vital { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; display: grid;
  grid-template-columns: 1fr auto; grid-template-areas: "label unit" "value value"; align-items: baseline; color: var(--v-gas); }
.vital .v-label { grid-area: label; font-weight: 600; font-size: 14px; }
.vital .v-unit { grid-area: unit; font-size: 12px; color: var(--muted); }
.vital .v-value { grid-area: value; font: 700 clamp(30px, 7vw, 44px)/1.1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: -.02em; white-space: nowrap; }
.vital { min-width: 0; overflow: hidden; }
.vital .v-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vital.v-ibp, .vital.v-nibp { grid-column: span 2; }
.vital .v-value small { font-size: .5em; font-weight: 600; }
.vital.stale { opacity: .45; }
.v-hr, .v-pr { color: var(--v-hr); } .v-spo2 { color: var(--v-spo2); } .v-ibp, .v-nibp { color: var(--v-bp); }
.v-rr, .v-etco2 { color: var(--v-resp); } .v-temp { color: var(--v-temp); } .v-fio2 { color: var(--v-gas); }

.trend-box { position: relative; width: 100%; height: clamp(360px, 62vh, 620px); touch-action: pan-y; }
canvas.trend { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }

table.other { width: 100%; border-collapse: collapse; } table.other td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.other td.num { font-family: ui-monospace, monospace; white-space: nowrap; }
ul.alarms li { padding: 4px 0 4px 10px; border-left: 4px solid var(--line); margin-bottom: 4px; }
ul.alarms li.high { border-color: var(--off); } ul.alarms li.medium { border-color: #f2a900; } ul.alarms li.low { border-color: var(--v-spo2); }
.hl7-device { padding: 8px 0; border-bottom: 1px solid var(--line); } .hl7-device:last-child { border-bottom: 0; }
.hl7-device form.row input { flex: 1; min-width: 160px; }
pre.hl7-raw { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--bg, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 240px; overflow: auto; }

/* the broadcast page: values, trends and devices right under the video */
.watch-body.with-vitals { grid-template-rows: auto 1fr; }
.watch-body.with-vitals .side { grid-column: 2; grid-row: 1 / span 2; }
.vitals-watch { padding: 12px 14px; min-width: 0; }
.vitals-watch h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0; }
.vitals-watch h2 a { font-size: 13px; font-weight: 500; }
.vitals-watch h3 { font-size: 15px; margin: 12px 0 6px; }
.vitals-watch .vitals-grid { grid-template-columns: repeat(auto-fill, minmax(min(136px, 100%), 1fr)); gap: 8px; margin: 10px 0 0; }
.vitals-watch .vital { padding: 6px 10px 8px; border-radius: 10px; }
.vitals-watch .vital .v-value { font-size: clamp(26px, 3vw, 36px); }
.vitals-trend-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 8px; }
.vitals-trend-head h3 { margin: 0; } .vitals-trend-head .row { margin: 0; }
.vitals-watch .trend-box { height: clamp(300px, 46vh, 460px); }
.vitals-watch .columns { margin-top: 4px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
ul.vitals-devices li { padding: 4px 0; }
@media (max-width: 560px) { .vitals-watch table.other td:nth-child(3) { display: none; } }  /* the devices are listed above */
@media (min-width: 901px) {  /* the video keeps its own shape; the side column runs beside the video and the values */
  .watch-body.with-vitals .player { aspect-ratio: 16 / 9; height: auto; min-height: 0; align-self: start; }
}
@media (max-width: 900px) { .watch-body.with-vitals .side { grid-column: auto; grid-row: auto; } }

/* live curves (Vidicap Connect): a dark block like the monitor's screen, in either theme */
.wv-bar { display: flex; align-items: center; gap: 8px; } .wv-bar h2 { margin: 0 auto 0 0; }
.wv-mon { background: #0b1018; color: #e5e7eb; border-radius: 12px; padding: 8px 10px; margin: 10px 0 6px; }
.wv-mon .muted { color: #9aa0aa; }
.wv-lanes { display: grid; gap: 4px; }
.wv-lanes[hidden], .wv-empty[hidden], .wv-wait[hidden] { display: none; }
.wv-lane { display: grid; grid-template-columns: 1fr 112px; grid-template-areas: "label num" "curve num"; column-gap: 10px; }
.wv-lane .wv-label { grid-area: label; }
.wv-lane canvas { grid-area: curve; width: 100%; height: 64px; display: block; min-width: 0; }
.wv-label { font-size: 11px; opacity: .75; display: flex; gap: 8px; white-space: nowrap; overflow: hidden; }
.wv-scale { opacity: .7; }
.wv-num { grid-area: num; text-align: right; align-self: center; line-height: 1.05; }
.wv-num b { display: block; font: 700 32px/1.05 ui-monospace, "SF Mono", Menlo, monospace; white-space: nowrap; }
.wv-num small { display: block; font-size: 11px; opacity: .75; }
.wv-num.bp b { font-size: 24px; }
.wv-num { min-width: 0; overflow: hidden; }
.wv-empty { border: 1px dashed #3a3f49; border-radius: 10px; padding: 14px; font-size: 14px; }
.wv-empty b { display: block; margin-bottom: 4px; }
.wv-snip { background: #0b1018; color: #e5e7eb; border-radius: 8px; padding: 6px 8px; margin: 6px 0 2px; }
.wv-snip canvas { width: 100%; height: 56px; display: block; }
.wv-open { white-space: nowrap; }
@media (max-width: 560px) {
  .wv-lane { grid-template-columns: 1fr 72px; }
  .wv-lane canvas { height: 54px; }
  .wv-num b { font-size: 24px; }
  .wv-num.bp b { font-size: 15px; }
}
