:root {
  --bg: #0f1420;
  --bg-soft: #161d2e;
  --card: #1b2438;
  --card-2: #212c44;
  --line: #2b3855;
  --text: #eaf0fb;
  --muted: #93a1c0;
  --sleep: #7c6cf0;
  --sleep-2: #a99bff;
  --activity: #21c7a8;
  --activity-2: #57e0c4;
  --heart: #ff6b8a;
  --heart-2: #ff9fb2;
  --amber: #f6b545;
  --good: #34d399;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2740 0, transparent 60%), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---- header ---- */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--sleep), var(--heart));
  display: grid; place-items: center; font-size: 22px; box-shadow: var(--shadow);
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); background: var(--card); padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.status.live .dot { background: var(--good); }
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 600; }
.seg button.active { background: var(--card-2); color: var(--text); }
.btn-connect { background: linear-gradient(135deg, var(--sleep), #6a5af0); color: #fff; border: 0; padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; box-shadow: var(--shadow); }
.btn-connect:hover { filter: brightness(1.07); }

/* ---- grid ---- */
.grid { display: grid; gap: 16px; }
.hero { grid-template-columns: repeat(3, 1fr); margin-bottom: 20px; }
.section-title { font-size: 14px; color: var(--muted); font-weight: 700; letter-spacing: .4px; margin: 28px 4px 12px; text-transform: uppercase; }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 880px) { .hero, .cols-2, .cols-3 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 2px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card .big { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.card .unit { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.card .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.delta.up { color: var(--good); background: rgba(52,211,153,.12); }
.delta.down { color: var(--heart-2); background: rgba(255,107,138,.12); }
.delta.flat { color: var(--muted); background: rgba(147,161,192,.12); }

/* hero card layout with ring */
.hero .card { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .val b { font-size: 24px; font-weight: 800; }
.ring .val small { font-size: 10px; color: var(--muted); display: block; }
.hero .meta { min-width: 0; }
.hero .meta .label { font-size: 13px; color: var(--muted); }
.hero .meta .metric { font-size: 26px; font-weight: 800; margin-top: 2px; }
.hero .meta .rows { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.hero .meta .rows span { color: var(--text); font-weight: 700; }

.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 190px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.stat-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .k { color: var(--muted); }
.stat-row .v { font-weight: 700; }

.note { font-size: 12px; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.note b { color: var(--text); }
footer.disc { margin-top: 34px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.7; }
a.inline { color: var(--sleep-2); }
