﻿:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: #0a1016;
  --panel-soft: #101923;
  --line: #1e2a34;
  --text: #ecf6ff;
  --muted: #7f96a8;
  --green: #37ff71;
  --cyan: #29dfff;
  --yellow: #ffd34e;
  --red: #ff4f5f;
  --white: #f3f7f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(circle at 22% 18%, #172533 0, #05070a 42rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 1rem;
  min-height: 100svh;
  padding: 1rem;
}

.monitor-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
}

.monitor-topbar,
.control-dock,
dialog {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.28);
}

.monitor-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}

.eyebrow,
.monitor-topbar h1,
.dock-header h2,
.dock-header p {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.monitor-topbar h1 {
  font-size: clamp(1.3rem, 2.4vw, 2.2rem);
  line-height: 1.05;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-logo {
  border-radius: 0.5rem;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.icon-button,
.preset-row button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-soft);
  border-radius: 0.45rem;
  min-height: 2.4rem;
}

.primary-button {
  background: var(--green);
  color: #041107;
  border-color: transparent;
  padding: 0 0.95rem;
  font-weight: 750;
}

.ghost-button {
  padding: 0 0.85rem;
}

.icon-button {
  width: 2.4rem;
  font-weight: 800;
}

.monitor {
  min-height: 0;
  background: #020405;
  border: 0.45rem solid #111920;
  border-radius: 0.8rem;
  box-shadow: inset 0 0 0 1px #2a3942, 0 2rem 6rem rgba(0, 0, 0, 0.42);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}


.monitor-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.monitor-fs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: transparent;
  border: 1px solid #2a3942;
  border-radius: 0.25rem;
  color: var(--muted);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.monitor-fs-btn:hover {
  opacity: 1;
  border-color: var(--muted);
}

.monitor-fs-btn svg {
  width: 0.85rem;
  height: 0.85rem;
}

/* Fullscreen — fill screen, remove decorative border */
.monitor:fullscreen {
  border-radius: 0;
  border-color: transparent;
  box-shadow: none;
}

.monitor:-webkit-full-screen {
  border-radius: 0;
  border-color: transparent;
}

.monitor-header {
  min-height: 3.2rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #1b272c;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #070b0e;
}

.alarm-banner {
  padding: 0.28rem 1rem;
  background: #050c10;
  border-bottom: 1px solid #111c22;
  display: flex;
  align-items: center;
  min-height: 1.75rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.alarm-banner.active {
  background: var(--red);
  color: #fff;
  border-color: transparent;
  animation: pulseAlarm 0.9s infinite alternate;
}

.bed-label,
.patient-label,
.clock {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.bed-label {
  color: var(--green);
  font-weight: 800;
  margin-right: 1rem;
}

.patient-label,
.clock {
  color: var(--muted);
  font-size: 0.9rem;
}

.monitor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 14vw);
  grid-template-rows: 1.2fr 1fr 1fr 0.9fr;
}

.wave-panel,
.pressure-panel,
.vital-column,
.vital-stack,
.alarm-panel {
  border-bottom: 1px solid #111c22;
  border-right: 1px solid #111c22;
}

.wave-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background-image: linear-gradient(rgba(36, 48, 53, 0.22) 1px, transparent 1px), linear-gradient(90deg, rgba(36, 48, 53, 0.22) 1px, transparent 1px);
  background-size: 3rem 3rem;
}

.wave-label {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  z-index: 2;
  font-size: 0.78rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
}

.wave-speed {
  position: absolute;
  bottom: 0.45rem;
  right: 0.65rem;
  z-index: 2;
  font-size: 0.62rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  opacity: 0.6;
}

.wave-label.ecg,
.green { color: var(--green); }
.cyan { color: var(--cyan); }
.yellow { color: var(--yellow); }
.red { color: var(--red); }
.white { color: var(--white); }

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.vital-column,
.vital-stack,
.alarm-panel {
  display: grid;
  place-items: center;
  background: #030608;
}

.vital {
  width: 100%;
  padding: 0.5rem 0.75rem;
  text-align: right;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.vital span,
.pressure-panel span {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: left;
}

.vital-limits {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  font-size: 0.6rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.65;
  margin-top: -0.15rem;
}

.vital strong {
  display: block;
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.95;
  font-weight: 850;
}

.vital.compact strong {
  font-size: clamp(2rem, 4vw, 4rem);
}

.vital small,
.pressure-panel small {
  color: var(--muted);
}

.pressure-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  padding: 1rem;
  align-items: center;
  background: #030608;
}

.pressure-panel > div {
  position: relative;
  min-height: 5rem;
}

.pressure-panel .wave-label {
  position: static;
}

.pressure-panel strong {
  display: block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(2.1rem, 4.2vw, 4.5rem);
  line-height: 1;
  margin-top: 0.4rem;
}

.map-display {
  display: block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  color: var(--red);
  margin-top: 0.3rem;
  letter-spacing: 0.03em;
}

.map-display strong {
  display: inline;
  font-size: inherit;
  line-height: inherit;
  margin-top: 0;
}

.nibp-time {
  display: block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.2rem;
  opacity: 0.7;
}

.nibp-mode {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-left: 0.4rem;
  opacity: 0.7;
}

.nibp-limits,
.temp-limits {
  display: flex;
  gap: 0.4rem;
  font-size: 0.6rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.65;
  margin: 0.1rem 0 0;
}

.rhythm-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  opacity: 0.75;
  margin-left: 0.3rem;
}

.pi-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.7;
  white-space: nowrap;
}

.control-dock {
  border-radius: 0.5rem;
  padding: 1rem;
  overflow: auto;
}

.dock-header {
  margin-bottom: 1rem;
}

.dock-header h2 {
  font-size: 1.1rem;
}

.dock-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.field,
.toggle-row label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 2.35rem;
  border-radius: 0.4rem;
  border: 1px solid var(--line);
  background: #050a0f;
  color: var(--text);
  padding: 0 0.65rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.toggle-row {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.toggle-row label {
  display: flex;
  align-items: center;
}


.feedback-callout {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #1e3a2a;
  border-left: 3px solid var(--green);
  border-radius: 0.4rem;
  background: rgba(55, 255, 113, 0.04);
}

.feedback-heading {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.feedback-callout p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.feedback-callout strong {
  color: var(--text);
}

.about-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.about-header h2 {
  margin: 0;
}

.about-logo {
  border-radius: 0.4rem;
  flex-shrink: 0;
}

.about-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

dialog h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--green);
}

dialog ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ad-slot {
  margin-top: 1rem;
  min-height: 6rem;
  border: 1px dashed #344552;
  border-radius: 0.5rem;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.ad-slot span {
  color: var(--text);
  font-weight: 800;
}

.ad-slot p {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}

dialog {
  max-width: min(32rem, calc(100vw - 2rem));
  border-radius: 0.6rem;
  color: var(--text);
  padding: 1.3rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.close-button {
  float: right;
  width: 2rem;
  height: 2rem;
  border-radius: 0.35rem;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

/* ── Topbar subtitle ─────────────────────────────────────────── */
.topbar-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Preset cards ────────────────────────────────────────────── */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  min-height: 0;
  cursor: pointer;
}

.preset-card strong {
  font-size: 0.85rem;
  font-weight: 750;
  line-height: 1.2;
}

.preset-card span {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.preset-card:hover {
  border-color: #2e3f4f;
  background: #121e27;
}

/* ── SEO footer ──────────────────────────────────────────────── */
.seo-footer {
  background: #080e13;
  border-top: 1px solid var(--line);
  padding: 3rem 1rem 4rem;
}

.seo-inner {
  max-width: 70rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem 3rem;
}

.seo-section {
  min-width: 0;
}

.seo-section h2 {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.seo-section p,
.seo-section li,
.seo-section dd {
  font-size: 0.85rem;
  color: #6a8599;
  line-height: 1.65;
  margin: 0 0 0.5rem;
}

.seo-section strong {
  color: #8fa9bb;
}

.seo-section a {
  color: #8fa9bb;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.seo-section a:hover {
  color: var(--text);
}

.seo-section ul,
.scenario-list {
  padding-left: 1.1rem;
  margin: 0;
}

.seo-section ul li,
.scenario-list li {
  margin-bottom: 0.65rem;
}

.scenario-list {
  list-style: none;
  padding-left: 0;
}

.scenario-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #0e1820;
}

.scenario-list li:last-child {
  border-bottom: none;
}

.values-list {
  margin: 0;
}

.values-list dt {
  font-size: 0.85rem;
  font-weight: 750;
  color: #8fa9bb;
  margin-top: 0.75rem;
}

.values-list dt:first-child {
  margin-top: 0;
}

.values-list dd {
  margin: 0.15rem 0 0 0;
}

.seo-faq details {
  border-bottom: 1px solid #0e1820;
  padding: 0.6rem 0;
}

.seo-faq details:last-child {
  border-bottom: none;
}

.seo-faq summary {
  font-size: 0.85rem;
  font-weight: 700;
  color: #8fa9bb;
  cursor: pointer;
  list-style: none;
  padding-right: 1rem;
  position: relative;
}

.seo-faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  color: var(--muted);
  font-weight: 400;
}

.seo-faq details[open] summary::after {
  content: "−";
}

.seo-faq details p {
  margin-top: 0.5rem;
  padding-left: 0;
}

@media (max-width: 860px) {
  .seo-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.sv-tooltip {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9999;
  max-width: 22rem;
  padding: 0.35rem 0.6rem;
  background: #111e28;
  color: #b8d0e0;
  font-size: 0.72rem;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.45;
  border: 1px solid #2a3f52;
  border-radius: 0.3rem;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

[data-tooltip] {
  cursor: help;
}

.built-by {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.built-by a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-credit {
  max-width: 70rem;
  margin: 2rem auto 0;
  padding: 1rem 1rem 0;
  border-top: 1px solid #0e1820;
  font-size: 0.78rem;
  color: #3d5566;
  text-align: center;
}

.footer-credit a {
  color: #4e6b7d;
  text-decoration: none;
}

.footer-credit a:hover {
  color: var(--muted);
}

@keyframes pulseAlarm {
  from { filter: brightness(0.78); }
  to { filter: brightness(1.25); }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-dock {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.5rem;
  }

  .monitor-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions button:not(.icon-button) {
    flex: 1;
  }

  .monitor-grid {
    grid-template-columns: minmax(0, 1fr) 6.2rem;
  }

  .vital strong {
    font-size: 3rem;
  }

  .pressure-panel {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
