:root {
  --bg: #0b0f19;
  --card-bg: rgba(17, 24, 39, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --cyan: #06b6d4;
  --rose: #f43f5e;
  --emerald: #10b981;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --text: #f3f4f6;
  --subtext: #9ca3af;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg); color: var(--text); padding: 1.25rem; display: flex; justify-content: center; min-height: 100vh; }
.container { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 1.25rem; }
header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.title { font-size: 1.25rem; }
.subtitle, .muted { font-size: 0.8rem; color: var(--subtext); }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.device-select { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; --c: var(--emerald); color: var(--c); }
.status .dot { width: 8px; height: 8px; background: var(--c); border-radius: 50%; box-shadow: 0 0 8px var(--c); }
.status.online .dot { animation: pulse 1.6s ease-in-out infinite; }
.status.stale { --c: var(--amber); }
.status.offline { --c: var(--rose); }
@keyframes pulse { 50% { opacity: 0.35; } }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.grid.dim .card-value { opacity: 0.35; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; backdrop-filter: blur(8px); position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; top: 0; left: 0; width: 4px; height: 100%; }
.card.hr::before { background: var(--rose); }
.card.spo2::before { background: var(--cyan); }
.card.temp::before { background: var(--emerald); }
.card.act::before { background: var(--violet); }
.card-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--subtext); letter-spacing: 0.05em; }
.card-value { font-size: 2.2rem; font-weight: 700; margin: 0.35rem 0; font-variant-numeric: tabular-nums; transition: opacity 0.3s; }
.card-unit { font-size: 0.85rem; color: var(--subtext); margin-left: 0.2rem; }
.badge { font-size: 0.6rem; border: 1px solid var(--subtext); border-radius: 4px; padding: 0 0.25rem; margin-left: 0.25rem; vertical-align: middle; }

.chart-box { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; display: flex; flex-direction: column; gap: 0.75rem; }
.chart-head, .chart-foot { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.8rem; color: var(--subtext); }
.act-tag { color: var(--violet); }
.act-tag.alert { color: var(--rose); }
.act-tag.idle { color: var(--subtext); }
canvas { display: block; width: 100%; height: 180px; background: #030712; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.04); }
