:root {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #172033;
  background: #eef3f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(20, 184, 166, 0.16), transparent 28%),
    linear-gradient(135deg, #f8fafc, #eef3f8 52%, #e8eef6);
}

button,
a {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: #f8fafc;
  background: #111827;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
  background: linear-gradient(135deg, #14b8a6, #2563eb);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.device-card p,
.device-card small {
  color: #a8b3c7;
}

.device-card {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.device-card p {
  margin: 0 0 12px;
  font-size: 12px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
}

.dot.live {
  background: #2dd4bf;
  box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.12);
}

.dot.warn {
  background: #f59e0b;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 7px;
}

nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.content {
  padding: 30px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: #132036;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.18;
}

.topbar p,
.panel-head p {
  margin-top: 8px;
  color: #64748b;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d7e0ec;
  border-radius: 7px;
  color: #24324a;
  background: #fff;
  cursor: pointer;
}

button:hover {
  border-color: #94a3b8;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel {
  border: 1px solid rgba(209, 219, 233, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(47, 63, 91, 0.08);
}

.stat {
  min-height: 126px;
  padding: 16px 14px;
}

.stat span {
  color: #68758a;
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: #17233a;
  font-size: 29px;
  line-height: 1;
}

.stat small {
  color: #64748b;
  font-size: 13px;
}

.stat p {
  margin-top: 11px;
  color: #7d899d;
  font-size: 13px;
}

.heart { border-top: 4px solid #e4566e; }
.oxygen { border-top: 4px solid #3b82f6; }
.humid { border-top: 4px solid #14b8a6; }
.temp { border-top: 4px solid #f59e0b; }
.battery { border-top: 4px solid #22c55e; }
.signal { border-top: 4px solid #8b5cf6; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.8fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  color: #17233a;
  font-size: 18px;
}

#updatedAt {
  color: #64748b;
  font-size: 13px;
}

canvas {
  width: 100%;
  height: 330px;
  display: block;
  border-radius: 8px;
  background: #fff;
}

.ai-panel,
.events-panel {
  display: flex;
  flex-direction: column;
}

.ai-text {
  min-height: 126px;
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  line-height: 1.7;
  background: linear-gradient(145deg, #172033, #24304a);
}

.judge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.judge-grid div {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.judge-grid span,
.judge-grid strong {
  display: block;
}

.judge-grid span {
  color: #64748b;
  font-size: 12px;
}

.judge-grid strong {
  margin-top: 6px;
}

.event-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.event-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #7f1d1d;
  background: #fff7f7;
}

.event-list li.empty {
  color: #64748b;
  border-color: #d7e0ec;
  background: #f8fafc;
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .sidebar {
    padding: 18px;
  }

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content {
    padding: 20px;
  }

  .topbar {
    flex-direction: column;
  }

  .stats-grid,
  .judge-grid {
    grid-template-columns: 1fr;
  }
}
