:root {
  --bg: #081610;
  --surface: #0e211a;
  --surface-raised: #142a21;
  --line: #2c493b;
  --grid: #243b31;
  --text: #eff4e8;
  --muted: #a4b9aa;
  --quiet: #809889;
  --green: #49dba5;
  --green-soft: #49dba514;
  --gold: #eacb79;
  --gold-soft: #eacb791a;
  --red: #f2777b;
  --previous: #a1b7ab;
  --backdrop: #000000b3;
  --transparent: transparent;
  --radius: 8px;
  --gap: 18px;
}
* {
  box-sizing: border-box;
  letter-spacing: 0;
}
html {
  scrollbar-width: thin;
  scrollbar-color: #4e9a78 var(--bg);
}
html::-webkit-scrollbar,
dialog::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track,
dialog::-webkit-scrollbar-track {
  background: var(--bg);
}
html::-webkit-scrollbar-thumb,
dialog::-webkit-scrollbar-thumb {
  background-color: #3f7d64;
  border: 2px solid var(--bg);
  border-radius: 8px;
}
html::-webkit-scrollbar-thumb:hover,
dialog::-webkit-scrollbar-thumb:hover {
  background-color: var(--green);
}
html::-webkit-scrollbar-corner {
  background: var(--bg);
}
dialog {
  scrollbar-width: thin;
  scrollbar-color: #4e9a78 var(--bg);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 "Microsoft YaHei",
    "PingFang SC",
    Arial,
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button {
  min-height: 44px;
}
button:hover {
  border-color: var(--gold);
}
[hidden] {
  display: none !important;
}
.screen {
  min-height: 100dvh;
  padding: 22px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  position: relative;
  isolation: isolate;
}
.screen:before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--green-soft) 1px, var(--transparent) 1px),
    linear-gradient(90deg, var(--green-soft) 1px, var(--transparent) 1px);
  background-size: 80px 80px;
  opacity: 0.18;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 50px;
  flex: none;
  border: 2px solid var(--gold);
  border-radius: 8px 8px 18px 18px;
  color: var(--gold);
  font: 32px/1 Arial;
  animation: breathe 4s ease-in-out infinite;
}
.brand h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
  color: var(--gold);
  user-select: none;
}
.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sample-label {
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}
.clock {
  font:
    19px/1.4 Consolas,
    monospace;
  font-variant-numeric: tabular-nums;
}
.icon-button {
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  display: grid;
  place-items: center;
}
.pause-icon {
  width: 14px;
  height: 18px;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
}
.is-paused .pause-icon {
  width: 0;
  height: 0;
  border: 0;
  border-top: 9px solid var(--transparent);
  border-bottom: 9px solid var(--transparent);
  border-left: 14px solid currentColor;
}
.full-icon {
  width: 18px;
  height: 18px;
  background:
    linear-gradient(currentColor, currentColor) left top/6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left top/2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) right top/6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right top/2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom/6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom/2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom/6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom/2px 6px no-repeat;
}
.dashboard {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 26px;
  flex: 1;
  min-height: 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  padding-right: 24px;
  gap: 17px;
  min-width: 0;
}
.sidebar section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 17px;
}
.sidebar section:last-child {
  border: 0;
  padding-bottom: 0;
}
.person {
  display: flex;
  align-items: center;
  gap: 15px;
}
.avatar {
  width: 62px;
  height: 62px;
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg);
  font-size: 26px;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.person-name {
  font-size: 25px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.person-meta {
  color: var(--muted);
  font-size: 12px;
}
.device-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  min-width: 0;
}
.device-tags span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font:
    11px/1.5 Consolas,
    monospace;
}
h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--muted);
}
.current-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.current-value {
  font:
    600 76px/1.05 Arial,
    sans-serif;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.unit {
  font-size: 13px;
  color: var(--muted);
}
.trend {
  font-size: 28px;
  margin-left: auto;
  color: var(--green);
}
.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}
.status {
  color: var(--green);
  font-size: 12px;
}
.tir-layout {
  display: flex;
  gap: 16px;
  align-items: center;
}
.ring {
  width: 96px;
  height: 96px;
  flex: none;
  position: relative;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: 8;
}
.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  font: 600 27px/1.15 Arial;
}
.ring-value small {
  font: 10px/1.8 Arial;
  color: var(--muted);
}
.distribution {
  flex: 1;
  min-width: 0;
}
.distribution-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  margin: 5px 0;
}
.distribution-row b {
  font-weight: 500;
  color: var(--text);
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  margin-right: 6px;
  border-radius: 50%;
}
.dot.high {
  background: var(--gold);
}
.dot.low {
  background: var(--red);
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-top: 17px;
}
.stat small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.stat strong {
  font: 500 22px/1.6 Arial;
}
.stat .unit {
  font-size: 10px;
  margin-left: 4px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 12px;
}
.summary-row strong {
  color: var(--gold);
  font: 500 20px Arial;
}
.summary-row small {
  font-size: 10px;
  color: var(--muted);
}
.heart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.heart-head h2 {
  margin: 0;
}
.heart-head strong {
  font: 500 25px Arial;
  color: var(--gold);
}
#heartChart {
  display: block;
  width: 100%;
  height: 56px;
  margin-top: 8px;
}
.device-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}
.online {
  color: var(--green);
}
.timeline {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.timeline-head h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.range {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px;
  gap: 2px;
}
.range button {
  border: 0;
  border-radius: 3px;
  background: var(--transparent);
  padding: 0 15px;
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
}
.range button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
}
.period {
  font:
    12px/1.5 Consolas,
    monospace;
  color: var(--muted);
}
.plot-section {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.glucose-section {
  flex: 1.8;
  min-height: 300px;
}
.calorie-section {
  flex: 1;
  min-height: 210px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.plot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 28px;
}
.plot-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.legend {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}
.legend i {
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--green);
  vertical-align: middle;
  margin-right: 6px;
}
.legend .previous {
  height: 0;
  border-top: 2px dashed var(--previous);
  background: var(--transparent);
}
.legend .exercise,
.legend .food {
  height: 7px;
  width: 7px;
  background: var(--green);
}
.legend .food {
  background: var(--gold);
}
.compare {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  cursor: pointer;
}
.compare input {
  accent-color: var(--green);
  width: 15px;
  height: 15px;
}
.compare.is-off > span {
  opacity: 0.4;
}
.plot {
  flex: 1;
  position: relative;
  min-height: 0;
}
.plot svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  outline: none;
}
.tooltip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  box-shadow: 0 5px 16px var(--backdrop);
  white-space: nowrap;
}
.tooltip b {
  color: var(--gold);
  display: block;
  font: 600 19px/1.7 Arial;
}
.activity-bar {
  cursor: pointer;
  outline: none;
}
.activity-bar.is-exercise {
  --bar-glow: var(--gold);
}
.activity-bar.is-food {
  --bar-glow: var(--green);
}
.activity-bar .bar-body {
  transform-box: fill-box;
  transform-origin: center bottom;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}
/* 悬停用同色光晕和上浮，不用白边。 */
.activity-bar:hover .bar-body,
.activity-bar:focus-visible .bar-body {
  filter:
    drop-shadow(0 0 4px var(--bar-glow))
    drop-shadow(0 0 10px color-mix(in srgb, var(--bar-glow) 75%, transparent))
    drop-shadow(0 9px 8px #00000073);
  transform: translateY(-5px);
}
.activity-bar:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
  font-size: 13px;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--quiet);
  font-size: 11px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.footer span {
  overflow-wrap: anywhere;
}
#notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: var(--surface-raised);
  border: 1px solid var(--gold);
  padding: 12px 20px;
  border-radius: 4px;
  max-width: calc(100% - 32px);
}
.circuit {
  height: 12px;
  position: relative;
  opacity: 0.45;
  margin-top: 8px;
  border-bottom: 1px solid var(--line);
  width: 100%;
}
.circuit:after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 22px;
  height: 2px;
  background: var(--green);
  animation: circuit 9s linear infinite;
}
.initial-trace {
  animation: trace 1.1s ease-out both;
  transform-origin: left;
  transform-box: fill-box;
}
.bar-enter {
  animation: rise 0.8s ease-out both;
  transform-origin: bottom;
  transform-box: fill-box;
}
.ring-enter {
  animation: ring-in 1s ease-out both;
  transform-origin: center;
  transform-box: fill-box;
}
.is-paused *,
.is-paused *:before,
.is-paused *:after,
.is-hidden *,
.is-hidden *:before,
.is-hidden *:after {
  animation-play-state: paused !important;
}
@keyframes breathe {
  50% {
    opacity: 0.55;
  }
}
@keyframes circuit {
  from {
    transform: translateX(0);
    opacity: 0;
  }
  20%,
  80% {
    opacity: 1;
  }
  to {
    transform: translateX(240px);
    opacity: 0;
  }
}
@keyframes trace {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes rise {
  from {
    transform: scaleY(0);
    opacity: 0.3;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}
@keyframes ring-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: min(520px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
dialog::backdrop {
  background: var(--backdrop);
}
body:has(dialog[open]) {
  overflow: hidden;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.dialog-head h2 {
  font-size: 19px;
  color: var(--text);
  margin: 0;
}
.close {
  font-size: 24px;
}
.detail-record {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.detail-record h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--gold);
  overflow-wrap: anywhere;
}
.detail-record p {
  margin: 5px 0;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail-total {
  color: var(--gold);
  font: 600 28px Arial;
  margin: 12px 0 20px;
}
.detail-total small {
  font-size: 13px;
  color: var(--muted);
}
/* 未打开时 dialog 必须离开文档流，否则会露在页面最下方。 */
dialog:not([open]) {
  display: none !important;
}
/* 详情、预览、选时共用外壳：霓虹边、入场和遮罩一致。 */
.app-dialog[open] {
  --neon-x: 28%;
  --neon-y: 0px;
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100% - 32px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  border-radius: var(--panel-radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow:
    0 0 22px var(--green-soft),
    inset 0 0 16px var(--green-soft);
  animation: detail-enter 280ms var(--ease-slide) both;
}
.app-dialog[open]::backdrop {
  background: var(--backdrop);
  animation: detail-backdrop-enter 220ms ease-out both;
}
.app-dialog > .panel-neon {
  opacity: 1;
}
.app-dialog .dialog-head {
  flex: none;
  padding: 18px 18px 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.app-dialog .dialog-head .close {
  margin-left: auto;
}
.app-dialog.is-detail[open] {
  width: min(680px, calc(100% - 32px));
}
.app-dialog.is-detail .detail-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(640px, calc(100dvh - 150px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 18px 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--green) #10281f;
}
.app-dialog.is-detail .detail-body::-webkit-scrollbar {
  width: 8px;
}
.app-dialog.is-detail .detail-body::-webkit-scrollbar-track {
  margin: 8px 0;
  background: #10281f;
  border-radius: 8px;
}
.app-dialog.is-detail .detail-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--green), #2f8f86 58%, var(--blue));
  border: 2px solid #10281f;
  border-radius: 8px;
}
.app-dialog.is-detail .detail-body::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}
.app-dialog.is-detail .detail-total {
  margin: 12px 0 8px;
}
.detail-record strong {
  color: var(--text);
  font-weight: 650;
}
.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.detail-photo {
  min-height: 0;
  padding: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.detail-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.app-dialog.is-preview[open] {
  align-items: center;
  justify-content: center;
  width: min(1080px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 56px 20px 20px;
  background: #06140f;
}
.app-dialog.is-preview .dialog-head {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  padding: 0;
  border: 0;
  background: transparent;
}
.app-dialog.is-preview img {
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  object-fit: contain;
}
.app-dialog.is-time[open] {
  width: min(420px, calc(100% - 32px));
}
.app-dialog.is-time .time-form {
  margin: 0;
  padding: 16px 24px 22px;
}
.reload-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: #071b15d6;
}
:root {
  --bg: #071b15;
  --surface: #0b211a;
  --surface-raised: #102b22;
  --line: #345047;
  --grid: #2a4036;
  --green: #45dfac;
  --green-soft: #45dfac18;
  --gold: #f1d48b;
  --red: #ef737f;
  --blue: #73b6ed;
  --panel-radius: 28px;
  --ease-slide: cubic-bezier(0.23, 1, 0.32, 1);
}
.screen {
  padding: 28px 44px 14px;
  gap: 20px;
  /* clip 只裁装饰层；内容增高时由文档滚动，不在页面内再套一层滚动条 */
  overflow: clip;
  background: linear-gradient(125deg, var(--green-soft), var(--transparent) 38%);
}
.screen:before {
  inset: -80px;
  animation: grid-drift 32s linear infinite;
  opacity: 0.14;
}
.screen:after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--green);
  opacity: 0.16;
  animation: scan-screen 16s linear infinite;
  pointer-events: none;
}
.brand-mark {
  border: 0;
  width: 52px;
  height: 58px;
  background: var(--green-soft);
  border-radius: 12px;
  color: var(--gold);
}
.brand-mark svg {
  width: 42px;
  height: 48px;
}
.brand h1 {
  font-size: 30px;
}
.brand small {
  font-size: 11px;
}
.clock {
  font-size: 26px;
}
.icon-button {
  background: var(--transparent);
  border-radius: 50%;
  color: var(--gold);
}
.dashboard {
  grid-template-columns: minmax(300px, 22%) minmax(0, 1fr);
  gap: 24px;
  grid-template-rows: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
}
.sidebar {
  border: 0;
  padding: 0;
  gap: 14px;
  justify-content: flex-start;
}
.sidebar > section {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  padding: 22px 24px;
  background: var(--surface);
  overflow: hidden;
  flex: none;
}
.sidebar > section:after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 1px;
  background: var(--green);
  opacity: 0;
  animation: edge-pulse 7s ease-in-out infinite;
  pointer-events: none;
}
.sidebar > section:nth-child(2):after {
  animation-delay: -2s;
}
.sidebar > section:nth-child(3):after {
  animation-delay: -4s;
}
.sidebar > section:last-child {
  border: 1px solid var(--line);
  padding: 18px 24px;
}
.sidebar .circuit {
  display: none;
}
.person {
  min-height: 154px;
}
.avatar {
  width: 72px;
  height: 72px;
  font-size: 32px;
  background: linear-gradient(145deg, var(--gold), var(--gold-soft));
  border: 1px solid var(--gold);
}
.person-name {
  font-size: 34px;
  line-height: 1.2;
  margin-bottom: 10px;
}
.person-meta {
  font-size: 12px;
}
.person-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.person > div {
  min-width: 0;
}
.person-tags > span {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill, 200px);
  color: var(--muted);
  background: var(--green-soft);
  font-size: 12px;
}
.device-tags {
  margin-top: 8px;
}
.device-tags span {
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--blue) 46%, var(--line));
  border-radius: 200px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  font-size: 11px;
}
.current-block h2 {
  font-size: 16px;
  color: var(--text);
}
.signal-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 5px var(--gold-soft);
  animation: breathe 3s ease-in-out infinite;
}
.current-value {
  font-size: 104px;
  line-height: 1.05;
  animation: value-glow 5s ease-in-out infinite;
}
.current-line .unit {
  font-size: 18px;
  color: var(--text);
  white-space: nowrap;
}
.trend {
  font-size: 40px;
}
.status-row {
  gap: 10px;
  font-size: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.status {
  background: var(--green);
  color: var(--bg) !important;
  border-radius: 200px;
  font-size: 15px;
  font-weight: 600;
  padding: 5px 16px;
}
.status.is-high {
  background: var(--red);
}
.status.is-low {
  background: var(--blue);
}
.tir-layout {
  gap: 20px;
}
.ring {
  width: 112px;
  height: 112px;
}
.ring-value {
  font-size: 36px;
  color: var(--green);
}
.ring-value small {
  font-size: 11px;
}
.distribution h2 {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}
.distribution-row {
  display: inline-flex;
  gap: 3px;
  margin: 8px 6px 0 0;
  font-size: 10px;
}
.distribution-row b {
  color: var(--muted);
}
.dot {
  width: 7px;
  height: 7px;
  margin-right: 3px;
  border-radius: 2px;
}
.dot.high {
  background: var(--red);
}
.dot.low {
  background: var(--blue);
}
.distribution-bar {
  height: 13px;
  display: flex;
  border-radius: 200px;
  overflow: hidden;
  margin-top: 12px;
  background: var(--line);
}
.distribution-bar span {
  flex: none;
  width: calc(var(--share, 0) * 1%);
}
.distribution-low {
  background: var(--blue);
}
.distribution-ok {
  background: var(--green);
}
.distribution-high {
  background: var(--red);
}
.activity-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.summary-stat {
  min-width: 0;
  padding: 4px 0;
}
.summary-stat + div {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.summary-stat small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.summary-stat strong {
  font: 600 28px/1.6 Arial;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.summary-stat .unit {
  font-size: 10px;
  margin-left: 4px;
}
.summary-stat svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 5px;
  color: var(--gold);
}
.heart-block {
  margin-top: 0;
}
.heart-block > .person-meta {
  flex: none;
  margin-top: 6px;
  line-height: 1.4;
}
.heart-head h2 {
  font-size: 14px;
  color: var(--text);
}
.heart-head strong {
  font-size: 26px;
}
#heartChart {
  height: 64px;
  margin-top: 8px;
}
.timeline {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--surface);
  gap: 12px;
  min-height: 0;
}
.timeline-head {
  justify-content: flex-start;
  gap: 16px;
  align-items: center;
}
.timeline-head h2 {
  font-size: 23px;
  white-space: nowrap;
}
.timeline-head .period {
  font-size: 12px;
}
.range {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--range-count, 2), 1fr);
  padding: 4px;
  gap: 0;
  border-radius: 200px;
  margin-left: auto;
  isolation: isolate;
  min-width: 312px;
  background: var(--bg);
}
.range-indicator {
  position: absolute;
  z-index: -1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--range-count, 2));
  border-radius: 200px;
  background: var(--gold);
  transform: translateX(calc(var(--range-index, 0) * 100%));
  transition: transform 260ms var(--ease-slide);
  pointer-events: none;
}
.range button {
  padding: 0 12px;
  min-height: 44px;
  border-radius: 200px;
  background: var(--transparent);
  font-size: 13px;
  white-space: nowrap;
}
.range button[aria-pressed="true"] {
  background: var(--transparent);
  color: var(--bg);
}
.range button:active {
  transform: scale(0.97);
}
.glucose-section {
  flex: 1;
  min-height: 260px;
}
.calorie-section {
  flex: 0 0 164px;
  min-height: 164px;
  padding-top: 6px;
  border: 0;
}
#calorieChart {
  overflow: visible;
}
.plot-head {
  min-height: 28px;
}
.plot-head h3 {
  font-size: 12px;
}
.compare {
  min-height: 32px;
}
.compare input {
  min-height: 0;
  padding: 0;
}
.legend {
  font-size: 11px;
  gap: 16px;
}
.legend .exercise {
  background: var(--gold);
}
.legend .food {
  background: var(--green);
}
.legend .high {
  background: var(--red);
  height: 7px;
  border-radius: 3px;
}
.legend .low {
  background: var(--blue);
  height: 7px;
  border-radius: 3px;
}
.legend .target {
  background: var(--green);
  height: 7px;
  border-radius: 3px;
}
.tooltip {
  padding: 16px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 240px;
}
.tooltip b {
  color: var(--green);
  font-size: 24px;
}
.tooltip small {
  font-size: 12px;
}
.footer {
  border: 0;
  padding-top: 0;
  font-size: 12px;
  align-items: center;
}
.footer-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.run-dot {
  color: var(--gold);
}
.chart-node {
  fill: var(--surface);
  stroke: var(--green);
  stroke-width: 2;
}
.latest-halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: node-pulse 3s ease-out infinite;
}
.bar-value {
  fill: var(--gold);
  font-size: 11px;
}
@keyframes grid-drift {
  to {
    transform: translate(80px, 80px);
  }
}
@keyframes scan-screen {
  from {
    transform: translateY(0);
    opacity: 0;
  }
  10%,
  80% {
    opacity: 0.12;
  }
  to {
    transform: translateY(100vh);
    opacity: 0;
  }
}
@keyframes edge-pulse {
  0%,
  70%,
  100% {
    opacity: 0;
    transform: scaleX(0.2);
  }
  80% {
    opacity: 0.45;
    transform: scaleX(1);
  }
}
@keyframes value-glow {
  50% {
    opacity: 0.86;
  }
}
@keyframes node-pulse {
  from {
    transform: scale(1);
    opacity: 0.65;
  }
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}
@media (min-width: 1600px) {
  .screen {
    /* 低于可读下限时撑开页面，由文档滚动；更高时铺满视口 */
    height: 100dvh;
    min-height: 1040px;
  }
  .sidebar > section {
    padding: 24px;
  }
  .person {
    min-height: 164px;
  }
  .current-value {
    font-size: 112px;
  }
  .ring {
    width: 116px;
    height: 116px;
  }
  .calorie-section {
    flex-basis: 190px;
    min-height: 190px;
  }
  .timeline {
    padding: 26px;
  }
  .heart-block #heartChart {
    height: 70px;
  }
}
@media (min-width: 1001px) and (max-width: 1599px) {
  .screen {
    height: 100dvh;
    min-height: 780px;
    padding: 20px 28px 12px;
    gap: 14px;
  }
  .topbar {
    min-height: 54px;
  }
  .brand h1 {
    font-size: 26px;
  }
  .clock {
    font-size: 22px;
  }
  .dashboard {
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
  }
  .sidebar {
    gap: 10px;
  }
  .sidebar > section {
    padding: 16px 18px;
    border-radius: 22px;
  }
  .sidebar > section:last-child {
    padding: 14px 18px;
  }
  .person {
    min-height: 112px;
  }
  .avatar {
    width: 58px;
    height: 58px;
    font-size: 26px;
  }
  .person-name {
    font-size: 29px;
    margin-bottom: 6px;
  }
  .device-tags span {
    font-size: 10px;
  }
  .person-tags > span {
    font-size: 10px;
    padding: 2px 7px;
  }
  .current-value {
    font-size: 78px;
  }
  .current-line {
    gap: 8px;
  }
  .current-line .unit {
    font-size: 15px;
  }
  .trend {
    font-size: 32px;
  }
  .ring {
    width: 88px;
    height: 88px;
  }
  .ring-value {
    font-size: 30px;
  }
  .tir-layout {
    gap: 12px;
  }
  .distribution h2 {
    font-size: 14px;
  }
  .distribution-row {
    font-size: 9px;
    margin-right: 3px;
  }
  .distribution .person-meta {
    font-size: 10px;
  }
  .summary-stat strong {
    font-size: 23px;
  }
  #heartChart {
    height: 44px;
  }
  .timeline {
    padding: 18px;
    border-radius: 22px;
  }
  .timeline-head {
    gap: 10px;
  }
  .timeline-head h2 {
    font-size: 20px;
  }
  .timeline-head .period {
    order: 3;
    width: 100%;
    font-size: 11px;
  }
  .range {
    min-width: 280px;
  }
  .range button {
    font-size: 12px;
    padding: 0 10px;
  }
  .calorie-section {
    flex-basis: 144px;
    min-height: 144px;
  }
  .footer-legend {
    gap: 12px;
  }
  .footer {
    font-size: 10px;
  }
}
@media (max-width: 1000px) {
  .screen {
    height: auto;
    min-height: 100dvh;
    padding: 20px;
    gap: 18px;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .sidebar > section {
    padding: 20px;
    border-radius: 22px;
    min-width: 0;
  }
  .sidebar .person {
    min-height: 0;
  }
  .sidebar .heart-block {
    grid-column: 1/-1;
    margin: 0;
  }
  .current-value {
    font-size: 76px;
  }
  .ring {
    width: 98px;
    height: 98px;
  }
  .timeline {
    padding: 20px;
    border-radius: 22px;
  }
  .timeline-head .period {
    order: 3;
    width: 100%;
  }
  .range {
    min-width: 300px;
  }
  .glucose-section {
    height: 390px;
    flex: none;
  }
  .calorie-section {
    height: 180px;
    min-height: 180px;
    flex: none;
  }
  .brand h1 {
    font-size: 26px;
  }
  .clock {
    font-size: 20px;
  }
  .footer {
    flex-wrap: wrap;
    gap: 10px;
  }
  #heartChart {
    height: 72px;
  }
}
@media (max-width: 700px) {
  .screen {
    padding: 16px;
    gap: 16px;
  }
  .topbar {
    gap: 10px;
  }
  .brand h1 {
    font-size: 22px;
  }
  .brand-mark {
    width: 40px;
    height: 46px;
  }
  .brand-mark svg {
    width: 32px;
    height: 38px;
  }
  .actions {
    width: 100%;
    justify-content: flex-end;
  }
  .clock {
    margin-right: auto;
    font-size: 20px;
  }
  .dashboard {
    gap: 16px;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .sidebar > section {
    padding: 20px;
    border-radius: 22px;
  }
  .sidebar > section:last-child {
    padding: 18px 20px;
  }
  .person-name {
    font-size: 30px;
  }
  .avatar {
    width: 68px;
    height: 68px;
  }
  .person-tags > span {
    font-size: 11px;
  }
  .current-value {
    font-size: 90px;
  }
  .current-line {
    flex-wrap: nowrap;
  }
  .current-line .unit {
    font-size: 16px;
  }
  .ring {
    width: 100px;
    height: 100px;
  }
  .distribution h2 {
    font-size: 15px;
  }
  .distribution-row {
    font-size: 10px;
  }
  .timeline {
    padding: 16px;
    gap: 12px;
  }
  .timeline-head {
    gap: 10px;
  }
  .timeline-head h2 {
    font-size: 20px;
  }
  .range {
    width: 100%;
    min-width: 0;
    order: 2;
    margin: 0;
  }
  .range button {
    min-height: 44px;
    font-size: 12px;
    padding: 0 6px;
  }
  .timeline-head .period {
    font-size: 10px;
    overflow-wrap: anywhere;
  }
  .glucose-section {
    height: 310px;
    min-height: 310px;
  }
  .calorie-section {
    height: 186px;
    min-height: 186px;
  }
  .legend {
    font-size: 10px;
    gap: 10px;
  }
  .footer {
    font-size: 10px;
  }
  .footer-legend {
    gap: 8px;
  }
  .tooltip {
    padding: 10px 12px;
    border-radius: 12px;
  }
  .tooltip b {
    font-size: 20px;
  }
  #heartChart {
    height: 64px;
  }
}
@media (min-width: 1001px) and (max-width: 1599px) {
  .sidebar > section {
    padding: 10px 18px;
  }
  .sidebar > section:last-child {
    padding: 10px 18px;
  }
  .current-value {
    font-size: 72px;
  }
  .current-line {
    align-items: center;
  }
  .status-row {
    margin-top: 8px;
  }
  .heart-block #heartChart {
    height: 40px;
  }
}
.is-paused:before,
.is-paused:after,
.is-hidden:before,
.is-hidden:after {
  animation-play-state: paused !important;
}
.avatar {
  background: var(--gold);
}
.current-block.has-wide-value .current-value {
  font-size: 88px;
}
@media (min-width: 1001px) and (max-width: 1599px) {
  .current-block.has-wide-value .current-value {
    font-size: 64px;
  }
}
@media (max-width: 1000px) {
  .current-block.has-wide-value .current-value {
    font-size: 64px;
  }
}
.timeline-title {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  flex: 1 1 460px;
  min-width: 0;
}
.timeline-title .period {
  order: 0;
  width: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 6px;
  text-align: right;
}
.timeline-title .period span {
  white-space: nowrap;
}
.timeline-title .period span + span:before {
  content: "— ";
  color: var(--quiet);
}
.tooltip .tip-period {
  display: block;
  color: var(--muted);
  font:
    12px/1.5 Consolas,
    monospace;
}
.tooltip dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 7px 20px;
  margin: 10px 0 0;
}
.tooltip dt {
  color: var(--muted);
}
.tooltip dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tooltip dd small {
  color: var(--quiet);
  font-size: 10px;
}
.tooltip .tip-mean {
  color: var(--green);
  font-weight: 600;
  font-size: 18px;
}
.panel-neon {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  background: radial-gradient(
    160px circle at var(--neon-x, 50%) var(--neon-y, 50%),
    var(--green),
    var(--blue) 35%,
    var(--gold) 60%,
    var(--transparent) 100%
  );
  mask:
    linear-gradient(var(--text) 0 0) content-box,
    linear-gradient(var(--text) 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 180ms ease-out;
  pointer-events: none;
  z-index: 4;
}
.sidebar > section[data-neon-active],
.timeline[data-neon-active]
 {
  box-shadow:
    0 0 22px var(--green-soft),
    inset 0 0 16px var(--green-soft);
}
[data-neon-active] > .panel-neon,
.timeline.is-neon-roam > .panel-neon {
  opacity: 1;
}
/* 空闲时两条对向霓虹沿右侧时间线边框游走。 */
.timeline.is-neon-roam > .panel-neon {
  background:
    radial-gradient(
      150px circle at var(--neon-x, 0%) var(--neon-y, 0%),
      var(--green) 0%,
      var(--blue) 34%,
      var(--transparent) 72%
    ),
    radial-gradient(
      150px circle at var(--neon-x2, 100%) var(--neon-y2, 100%),
      var(--gold) 0%,
      var(--green) 36%,
      var(--transparent) 72%
    );
}
@media (max-width: 700px) {
  .timeline-title {
    gap: 10px;
    flex-basis: 100%;
  }
  .timeline-title h2 {
    font-size: 16px;
  }
  .timeline-title .period {
    font-size: 10px;
    max-width: 130px;
  }
}
.footer {
  flex: none;
}
@media (max-width: 1000px) {
  .dashboard {
    flex: none;
  }
}
.time-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}
.time-form p {
  margin: 0;
  color: var(--muted);
}
.time-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.time-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-primary,
.btn-secondary {
  min-width: 108px;
  padding: 0 16px;
  border-radius: 4px;
}
.btn-primary {
  border: 1px solid var(--gold);
  background: var(--gold);
  color: #1a1408;
  font-weight: 600;
}
.btn-secondary {
  border: 1px solid var(--line);
  background: var(--transparent);
  color: var(--text);
}
@keyframes detail-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes detail-backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
  }
  .footer-legend {
    flex-basis: 100%;
  }
  .dialog-head h2 {
    font-size: 17px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after,
  .app-dialog::backdrop {
    animation: none !important;
    transition: none !important;
  }
}
/* 编译完成前藏住模板插值，避免先闪出 {{ }} */
[v-cloak] {
  display: none !important;
}
#boot {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--gold);
}
#boot:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--green-soft) 1px, var(--transparent) 1px),
    linear-gradient(90deg, var(--green-soft) 1px, var(--transparent) 1px);
  background-size: 80px 80px;
  opacity: 0.18;
}
#boot.is-done {
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
.boot-panel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
}
.boot-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 70px;
  border: 2px solid var(--gold);
  border-radius: 10px 10px 24px 24px;
  color: var(--gold);
}
.boot-mark svg {
  width: 36px;
  height: 42px;
}
.boot-ring {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: boot-spin 0.8s linear infinite;
}
.boot-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}
/* 宽屏：多余高度交给心率图和血糖曲线。曲线可压缩，来源行保持完整。 */
@media (min-width: 1001px) {
  .sidebar > .heart-block {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 152px;
  }
  .sidebar > .heart-block #heartChart {
    flex: 1 1 0;
    width: 100%;
    height: auto;
    min-height: 28px;
    margin-top: 8px;
  }
  .glucose-section {
    min-height: 220px;
  }
}
@media (min-width: 1001px) and (max-width: 1599px) {
  .sidebar > .heart-block {
    min-height: 116px;
  }
}
@media (min-width: 1600px) {
  .glucose-section {
    min-height: 240px;
  }
}
.count-roll {
  display: inline-flex;
  height: 1em;
  line-height: 1;
  vertical-align: text-bottom;
  font-variant-numeric: tabular-nums;
}
.count-roll-col {
  height: 1em;
  overflow: hidden;
}
.count-roll-strip {
  display: flex;
  flex-direction: column;
  transition: transform 1.05s cubic-bezier(0.16, 1, 0.3, 1);
}
.count-roll-strip > span {
  height: 1em;
  line-height: 1;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .count-roll-strip {
    transition: none;
  }
}
    
