:root {
  --bg: #020406;
  --screen: #040607;
  --bezel: #ececf0;
  --bezel-shadow: #b3b5be;
  --green: #7cff48;
  --white: #f4f6fa;
  --red: #ff3b34;
  --yellow: #ffd633;
  --blue: #54a8ff;
  --line: #11161d;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #12171f 0%, #05070a 45%, #020406 100%);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
}
button { font: inherit; cursor: pointer; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px 16px;
}
.monitor-shell { width: min(1100px, 100%); }
.bezel-frame {
  background: linear-gradient(180deg, #f0f1f4 0%, #d8d9de 100%);
  border-radius: 34px;
  padding: 20px 22px 18px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35) inset, 0 18px 44px rgba(0,0,0,.42);
}
.monitor-screen {
  position: relative;
  background: var(--screen);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.05), 0 0 0 2px rgba(127,134,149,.36);
}

.screen-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 5px 12px;
  background: linear-gradient(180deg, #1c78df 0%, #0b5cb8 100%);
  font-size: 13px;
  font-weight: 700;
}
.topbar-left { color: #eef6ff; }
.topbar-center { color: #fff; text-align: center; flex: 1; }
.topbar-right { color: #dbffd0; }

.screen-body { background: #000; }
.wave-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 142px;
  min-height: 118px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.wave-row.channel-off { opacity: .22; }
.wave-labels {
  padding: 7px 4px 0 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.scale-column { justify-content: space-between; padding-bottom: 10px; }
.scale-stack,
.mini-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10px;
  line-height: 1;
  opacity: .92;
}
.scale-stack { min-height: 72px; padding-top: 2px; }
.mini-scale { min-height: 58px; min-width: 22px; }
.lead-name,
.lead-gain {
  font-weight: 700;
  letter-spacing: .03em;
}
.with-axis {
  position: relative;
  padding-left: 12px;
}
.with-axis::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: currentColor;
  opacity: .95;
}
.with-axis::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 8px;
  background: repeating-linear-gradient(to bottom,
    transparent 0 14px,
    currentColor 14px 15px,
    transparent 15px 29px);
  opacity: .82;
}
.etco2-mini-scale { min-width: 24px; }

.wave-canvas-wrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.wave-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 118px;
}
.faint-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 100% 24px, 36px 100%;
  pointer-events: none;
}

.metric-panel {
  padding: 8px 10px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.18) 30%, rgba(0,0,0,.42) 100%);
  border-radius: 14px;
  transition: background-color .15s linear, filter .15s linear;
}
.metric-right.tight { gap: 1px; }
.metric-right.double { justify-content: space-evenly; }
.with-nib { gap: 4px; justify-content: flex-start; padding-top: 10px; }
.metric-touch {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  border-radius: 12px;
  transition: background-color .15s linear, filter .15s linear;
}
.metric-touch-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.metric-caption {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.metric-caption.lower { margin-top: 4px; }
.metric-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}
.metric-value.metric-stack { font-size: 24px; }
.metric-sub {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.1;
}
.metric-sub.large { font-size: 26px; }
.metric-clickable { cursor: pointer; }
.metric-clickable:hover { filter: brightness(1.06); }

.top-nib-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,.10);
}
.top-nib-label {
  font-size: 10px;
  letter-spacing: .08em;
  opacity: .95;
  color: #f6f8fb;
}
.top-nib-value {
  font-size: 18px;
  font-weight: 800;
  color: #f6f8fb;
}

.green { color: var(--green); }
.white { color: var(--white); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }
.blue { color: var(--blue); }

.screen-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 8px 120px 12px 14px;
  background: #020406;
  border-top: 1px solid #0f1318;
  min-height: 48px;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.temp-tile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #161a20;
  border: 1px solid #49515e;
  color: #fff;
  padding: 6px 10px;
  border-radius: 10px;
  min-width: 118px;
}
.temp-tile.off { opacity: .45; }
.temp-label {
  font-size: 11px;
  font-weight: 800;
  color: #7aa9ff;
}
.temp-reading {
  font-size: 16px;
  font-weight: 700;
}
.footer-cvp {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: #dce2eb;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background-color .15s linear, filter .15s linear;
}

.bottom-screen-icons {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
}
.bottom-screen-icons.right-shifted {
  left: auto;
  right: 18px;
  bottom: 10px;
}
.screen-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(14,16,20,.88);
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
  color: #f5f7fb;
}
.screen-icon:hover { background: rgba(30,34,40,.96); }
.screen-icon.scenario-icon { position: relative; }
.icon-head {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f2f6fb;
  position: absolute;
  top: 8px;
}
.icon-body {
  width: 17px;
  height: 11px;
  border-radius: 10px 10px 6px 6px;
  background: #f2f6fb;
  position: absolute;
  bottom: 8px;
}
.info-icon {
  font-size: 18px;
  font-weight: 800;
}

.freeze-pill {
  position: absolute;
  top: 48px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8,11,14,.9);
  border: 1px solid rgba(255,255,255,.16);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #f6f8fc;
  z-index: 4;
}
.standby-overlay {
  position: absolute;
  inset: 34px 0 0 0;
  background: rgba(0,0,0,.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 5;
  text-align: center;
  padding: 20px;
}
.standby-label {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: .12em;
  color: #f1f4f8;
}
.standby-sub {
  max-width: 420px;
  color: #c8d0dc;
  font-size: 15px;
  line-height: 1.4;
}
.hidden { display: none !important; }

.bezel-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 14px;
}
.ctrl-btn,
.ctrl-icon-btn {
  background: linear-gradient(180deg, #f3f4f8 0%, #c4c8d2 100%);
  border: 1px solid #8e95a5;
  color: #20242b;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .03em;
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 2px 8px rgba(0,0,0,.16);
}
.ctrl-btn.active,
.ctrl-icon-btn.active {
  background: #ffd633;
  border-color: #a96b17;
}
.ctrl-btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.ctrl-icon-btn {
  width: 40px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.yellow-key {
  background: #ffd633;
  border-color: #a88b11;
}
.power-key {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-left: 6px;
}
.power-symbol {
  width: 18px;
  height: 18px;
  border: 3px solid #1e2631;
  border-top-color: transparent;
  border-radius: 50%;
  position: relative;
  display: block;
}
.power-symbol::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 3px;
  height: 12px;
  background: #1e2631;
  border-radius: 4px;
}
.icon-speaker-off {
  position: relative;
  display: block;
  width: 22px;
  height: 18px;
}
.icon-speaker-off::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 4px;
  width: 11px;
  height: 10px;
  background: #3b2500;
  clip-path: polygon(0 20%, 42% 20%, 78% 0, 78% 100%, 42% 80%, 0 80%);
}
.icon-speaker-off::after {
  content: "";
  position: absolute;
  right: 2px;
  top: -1px;
  width: 3px;
  height: 20px;
  background: #3b2500;
  transform: rotate(38deg);
  border-radius: 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,4,8,.76);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}
.modal-card {
  width: min(760px, 100%);
  background: linear-gradient(180deg, #121820 0%, #0b1017 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 28px 60px rgba(0,0,0,.4);
}
.mini-card { width: min(520px, 100%); }
.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.modal-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #7fb9ff;
}
.modal-card h2 {
  margin: 6px 0 0;
  font-size: 22px;
}
.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  background: #171d26;
  color: #fff;
  font-size: 22px;
}
.scenario-grid,
.temp-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.temp-modal-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scenario-card {
  background: linear-gradient(180deg, #18222f 0%, #101720 100%);
  border: 1px solid rgba(255,255,255,.08);
  color: #fff;
  border-radius: 16px;
  padding: 14px;
  text-align: left;
}
.scenario-card.active { outline: 2px solid #5aa9ff; }
.scenario-card-title { font-size: 16px; font-weight: 800; }
.scenario-card-meta { margin: 8px 0; }
.pill,
.case-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  background: #213043;
  color: #dbe6f6;
}
.scenario-card-summary,
.case-summary,
.details-note {
  color: #d4dbe8;
  line-height: 1.45;
}
.details-chip-row { display: flex; gap: 8px; margin-bottom: 10px; }
.details-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #89bfff;
  margin-bottom: 8px;
}
.treatment-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

.alarm-readout {
  font-size: 18px;
  font-weight: 800;
  color: #e7edf7;
  margin: 6px 0 14px;
}
.alarm-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.alarm-box {
  background: #161d26;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px;
}
.alarm-box-label {
  font-size: 12px;
  font-weight: 800;
  color: #8ebcff;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.alarm-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.alarm-value {
  font-size: 24px;
  font-weight: 900;
  min-width: 72px;
  text-align: center;
}
.limit-step {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: #0f141b;
  color: #fff;
  font-size: 24px;
}
.alarm-preset-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.menu-card { max-width: 820px; }
.menu-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
}
.menu-section {
  background: #161d26;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 16px;
}
.menu-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.menu-action { width: 100%; }
.feature-toggle-list { display: grid; gap: 10px; margin-top: 12px; }
.feature-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: #0f141b;
  color: #eef3fb;
  font-weight: 700;
}
.feature-toggle strong { color: #7cff48; }
.feature-toggle:not(.active) strong { color: #9aa8b7; }
.feature-toggle:not(.active) { opacity: .8; }

.alarm-flash {
  animation: alarmFlashSolid .95s steps(2, end) infinite;
  background-image: none !important;
  background-color: rgba(255,214,51,.28) !important;
  box-shadow: none !important;
}
@keyframes alarmFlashSolid {
  0%, 49% { background-color: transparent; }
  50%, 100% { background-color: rgba(255,214,51,.28); }
}
#hrPanel.alarm-flash,
#bpPanel.alarm-flash,
#spo2Panel.alarm-flash,
#rrTouch.alarm-flash,
#etco2Touch.alarm-flash,
#cvpValue.alarm-flash {
  background-image: none !important;
  background-color: rgba(255,214,51,.28) !important;
}

@media (max-width: 900px) {
  .menu-grid,
  .menu-button-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .wave-row { grid-template-columns: 58px minmax(0, 1fr) 124px; }
  .metric-value { font-size: 24px; }
  .metric-sub.large { font-size: 22px; }
}
@media (max-width: 640px) {
  .app-shell { padding: 12px; }
  .bezel-frame { padding: 12px 12px 14px; border-radius: 24px; }
  .screen-topbar { font-size: 11px; min-height: 30px; }
  .wave-row { grid-template-columns: 48px minmax(0, 1fr) 108px; min-height: 98px; }
  .wave-canvas-wrap canvas { height: 98px; }
  .metric-value { font-size: 21px; }
  .metric-sub.large { font-size: 19px; }
  .metric-caption { font-size: 10px; }
  .scale-stack, .mini-scale { font-size: 8px; }
  .screen-footer { padding: 8px 88px 12px 10px; }
  .scenario-grid, .temp-modal-grid, .alarm-controls-grid { grid-template-columns: 1fr; }
  .bezel-controls { gap: 8px; }
  .ctrl-btn { padding: 0 10px; font-size: 11px; min-height: 34px; }
  .bottom-screen-icons.right-shifted { right: 12px; bottom: 8px; }
}
