:root {
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d2a4a 0, #020617 55%, #000 100%);
  color: #e5e7eb;
  min-height: 100vh;
}
header {
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(2, 6, 23, 0.85);
  border-bottom: 1px solid rgba(148,163,184,0.2);
  position: sticky;
  top: 0;
  z-index: 20;
}
header h1 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #a5b4fc;
}
header .subtitle {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 4px;
}
.header-left {
  display: flex;
  flex-direction: column;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
select, button {
  border-radius: 9999px;
  border: 1px solid rgba(129,140,248,0.6);
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  padding: 6px 14px;
  font-size: 0.85rem;
  outline: none;
}
select {
  min-width: 260px;
  border-color: rgba(148,163,184,0.6);
}
button {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-color: transparent;
  cursor: pointer;
  font-weight: 500;
}
button:hover {
  filter: brightness(1.05);
}
.pill-info {
  border-radius: 9999px;
  padding: 6px 12px;
  border: 1px solid rgba(148,163,184,0.35);
  font-size: 0.75rem;
  color: #cbd5f5;
  background: radial-gradient(circle at top left, rgba(56,189,248,0.12), transparent 60%);
  white-space: nowrap;
}
main {
  padding: 18px 26px 32px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
}
@media (max-width: 1040px) {
  main {
    grid-template-columns: 1fr;
  }
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 76px;
  align-self: flex-start;
}
.card {
  background: radial-gradient(circle at top left, rgba(148,163,248,0.18), rgba(15,23,42,0.96));
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,0.35);
  padding: 12px 14px 10px;
  box-shadow: 0 28px 60px rgba(15,23,42,0.85);
}
.card h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #e5e7eb;
}
.card small {
  color: #9ca3af;
  font-size: 0.75rem;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-top: 6px;
}
.stat-label {
  color: #9ca3af;
}
.stat-value-total {
  color: #e5e7eb;
}
.stat-value-ok {
  color: #22c55e;
}
.stat-value-bad {
  color: #fb923c;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.82rem;
}
.toggle-row label {
  color: #e5e7eb;
}
.toggle-row input {
  accent-color: #6366f1;
  transform: scale(0.95);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 9999px;
  padding: 2px 8px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.4);
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 6px;
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: #22c55e;
}
.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plot-card {
  background: radial-gradient(circle at top left, rgba(56,189,248,0.12), rgba(15,23,42,0.96));
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,0.35);
  padding: 10px 12px 8px;
  box-shadow: 0 28px 60px rgba(15,23,42,0.9);
}
.plot-title {
  font-size: 0.9rem;
  margin: 0 4px 2px;
  color: #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plot-title span:last-child {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 400;
}
.plot-subtitle {
  font-size: 0.75rem;
  margin: 0 4px 8px;
  color: #6b7280;
}
.plot-container {
  width: 100%;
  height: 260px;
}
#ecg-zoom {
  height: 210px;
}
.plot-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 1200px) {
  .plot-row {
    grid-template-columns: 1fr;
  }
}
.error-banner {
  position: fixed;
  bottom: 12px;
  right: 16px;
  background: #7f1d1d;
  color: #fecaca;
  padding: 8px 12px;
  border-radius: 9999px;
  font-size: 0.78rem;
  border: 1px solid #fecaca33;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
  z-index: 50;
}
.card-separator {
  margin: 8px 0 4px;
  border: 0;
  border-top: 1px solid rgba(148,163,184,0.35);
}
