:root {
  color-scheme: light;
  --ink: #101b36;
  --muted: #485c7c;
  --blue: #3a62e9;
  --green: #007958;
  --line: #ccddf4;
  --panel: linear-gradient(145deg, #f8fbff, #eff6ff);
}
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(120deg, #f3f8ff, #e8f2ff); color: var(--ink); font: 14px/1.45 system-ui, "Microsoft YaHei", sans-serif; }
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.icons { position: absolute; width: 0; height: 0; }
svg:has(> use) { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 164px; padding: 68px 11px 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; overflow-y: auto; background: radial-gradient(ellipse at -25% 86%, #9ddcf3a6, transparent 38%), linear-gradient(155deg, #d5e6fa, #e4f0fc); border-right: 1px solid #d3e4f9; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px; font-weight: 660; white-space: nowrap; }
.sidebar nav a:hover { background: #f5faff; }
.sidebar nav a[aria-current] { color: white; background: linear-gradient(125deg, #4265ee, #4d79e8); box-shadow: inset 0 2px 8px #ffffff42; }
.back-link { display: grid; justify-items: center; gap: 5px; padding: 16px 4px; background: #ccdef7; border-radius: 12px; color: #163b72; }
.back-link small { color: var(--muted); }
.workspace { margin-left: 164px; padding: 12px 20px 0; display: grid; gap: 14px; }
.workspace [id] { scroll-margin-top: 12px; }
.topbar, .title, .section-head, .device-state, .actions { display: flex; align-items: center; gap: 12px; }
.topbar, .section-head { justify-content: space-between; }
.title > svg { width: 38px; height: 38px; color: var(--blue); }
h1 { font-size: clamp(23px, 2.3vw, 33px); letter-spacing: -.045em; line-height: 1.15; }
.title p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #e7eef9; border-radius: 40px; padding: 8px 14px; color: var(--muted); white-space: nowrap; }
.status span { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status.live { background: #d9f8e9; color: var(--green); border-color: #b5ecd7; }
.status.error { color: #a12d3e; background: #ffedf0; border-color: #f5c4cc; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 4px 9px #26568f15; }
.device { display: grid; grid-template-columns: minmax(105px, 215px) minmax(180px, 1fr) auto; align-items: center; gap: 12px; padding: 0 25px 0 16px; min-height: 126px; overflow: hidden; background: radial-gradient(ellipse at 65% 145%, #8aeaf2c9, transparent 66%), linear-gradient(112deg, #c6f7ee, #e4f5fd 52%, #dce7ff); }
.instrument { width: 100%; height: 126px; object-fit: contain; }
.device-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: #f2fffb; color: var(--green); box-shadow: 0 3px 10px #16866d16; }
.device-state > div { min-width: 0; overflow-wrap: anywhere; }
.device h2 { font-size: clamp(20px, 2.4vw, 32px); color: #006b51; }
#detail { color: #315675; margin-top: 3px; }
#detail:empty { display: none; }
.actions { flex-wrap: wrap; justify-content: flex-end; }
button { min-height: 38px; padding: 7px 14px; border-radius: 11px; border: 1px solid #b8ccec; background: linear-gradient(#fbfdff, #e4edfb); box-shadow: 0 2px 5px #26568f16; color: #173e91; font: 700 13px/1.4 system-ui, sans-serif; white-space: nowrap; }
.actions button { min-width: 116px; min-height: 44px; font-size: 14px; }
button:not(:disabled):hover { filter: brightness(.96); }
button:disabled { cursor: default; opacity: .59; box-shadow: none; }
button.primary { background: linear-gradient(120deg, #24a765, #007952); border-color: #13895b; color: white; }
.result { position: relative; overflow: hidden; padding: 13px 16px 12px; background: radial-gradient(ellipse 65% 55% at 8% 95%, #a7ead8ad 65%, transparent 66%), radial-gradient(ellipse 68% 60% at 91% 105%, #9ce9e4a1 73%, transparent 74%), linear-gradient(150deg, #f8fbff, #eefaff); }
h2 { font-size: 17px; }
h2 svg, summary svg { color: var(--blue); vertical-align: middle; margin-right: 7px; }
.result h2 { font-size: 22px; }
.badge { padding: 4px 9px; border-radius: 22px; border: 1px solid #b7d3f8; background: #e0efff; color: #164786; font-size: 12px; font-weight: 650; }
.reading { display: flex; align-items: center; justify-content: center; gap: clamp(9px, 3vw, 34px); min-height: 90px; color: var(--green); }
.reading strong { font-size: clamp(48px, 6.2vw, 82px); font-weight: 790; font-variant-numeric: tabular-nums; letter-spacing: -.055em; line-height: 1; }
.reading .empty-value { font-size: clamp(24px, 4.4vw, 48px); }
.reading:has(.empty-value) .unit { display: none; }
.unit { border-radius: 24px; padding: 4px 12px; background: #c2f0e5; font-size: clamp(17px, 2vw, 25px); font-weight: 730; }
.cubes { width: clamp(65px, 10vw, 124px); height: auto; filter: drop-shadow(0 6px 4px #21816c39); }
.updated { min-height: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.result-meta { display: grid; grid-template-columns: 1.2fr 1fr; margin-top: 8px; border: 1px solid #fff; border-radius: 11px; background: #f5faffbd; }
.result-meta div { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px; }
.result-meta div + div { border-left: 1px solid var(--line); }
.result-meta dt { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.result-meta svg { color: #007d89; }
.result-meta dd { color: var(--green); font-weight: 740; }
.dashboard { display: grid; grid-template-columns: 1.12fr 1.12fr .83fr; gap: 13px; }
.chart-card { padding: 11px 13px 8px; }
.chart-card h2 { display: flex; align-items: center; gap: 6px; font-size: 16px; flex-wrap: wrap; }
.chart-card h2 svg { margin-right: 1px; }
.chart-card small, .chart-caption { color: var(--muted); font-size: 12px; font-weight: 500; }
.plot { position: relative; min-height: 114px; margin-top: 5px; }
.plot svg { display: block; width: 100%; max-height: 138px; height: auto; overflow: visible; }
.plot .grid { stroke: #d9e6f7; stroke-width: 1; }
.plot .axis { fill: var(--muted); font: 11px system-ui, sans-serif; }
.plot .empty { position: absolute; inset: 10% 8%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; background: #f2f8ffb8; border: 1px dashed #bdcfea; border-radius: 9px; }
.chart-caption { text-align: center; }
.diagnostics dl { margin-top: 9px; display: grid; gap: 5px; }
.diagnostics dl div { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 7px; background: #e6effb; font-size: 12px; }
.diagnostics dt { display: flex; align-items: center; gap: 5px; font-weight: 670; }
.diagnostics dt svg { width: 16px; height: 16px; color: #087988; }
.diagnostics dd { padding: 2px 6px; border-radius: 6px; color: var(--muted); font-weight: 700; text-align: right; }
.diagnostics dd[data-tone="good"] { background: #d9f4e6; color: var(--green); }
.diagnostics dd[data-tone="error"] { background: #ffebef; color: #a12d3e; }
.scans { padding: 0 14px 10px; }
summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 0; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(45deg); margin-right: 5px; }
details[open] > summary::after { transform: rotate(225deg); }
summary > span { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
summary strong { font-size: 17px; }
summary small { color: var(--muted); margin-left: 8px; }
.scan-state { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-bottom: 7px; color: var(--muted); font-size: 12px; }
.scan-state button { margin-left: auto; }
progress { accent-color: #168d65; width: 84px; height: 8px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table { width: 100%; min-width: 700px; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 10px; white-space: nowrap; }
th { background: #dce9fb; }
td { border-top: 1px solid #dae7f7; font-size: 13px; }
tr:nth-child(even) td { background: #eaf3fccc; }
td:first-child { font-weight: 670; }
td:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--channel); }
.wave740 { --channel: #1575e4; }
.wave850 { --channel: #008c89; }
.wave940 { --channel: #8b53e1; }
td:nth-child(5), .scan-good { color: var(--green); font-weight: 700; }
.scan-error { color: #a12d3e; font-weight: 700; }
.subtitle, .footnote, .reference-body { color: var(--muted); }
.footnote { margin-top: 7px; font-size: 12px; }
.reference { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
.reference .panel { padding: 0 12px; }
.reference-body { padding: 0 0 12px; font-size: 13px; }
.reference-body p + p { margin-top: 6px; }
.formula { color: #145b96; overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; }
footer { display: flex; justify-content: space-between; gap: 8px; padding: 0 0 14px; color: var(--muted); font-size: 12px; }
footer a:hover, .back-link:hover { text-decoration: underline; }
@media (max-width: 1050px) {
  .device { grid-template-columns: 112px minmax(145px, 1fr) auto; padding-right: 12px; }
  .device-icon { display: none; }
  .actions button { min-width: 0; }
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagnostics { grid-column: 1 / -1; }
  .diagnostics dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 7px 10px; flex-direction: row; align-items: center; border-right: none; gap: 8px; }
  .sidebar nav { display: flex; min-width: 0; overflow-x: auto; }
  .sidebar nav a { padding: 7px; gap: 4px; font-size: 12px; }
  .sidebar svg { width: 16px; height: 16px; }
  .back-link { padding: 5px; gap: 0; font-size: 10px; }
  .back-link small { display: none; }
  .workspace { margin-left: 0; padding: 10px 12px 0; gap: 10px; }
  .device { grid-template-columns: 90px 1fr; gap: 4px 8px; padding: 3px 10px 9px; }
  .instrument { height: 70px; }
  .actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 490px) {
  .dashboard, .reference { grid-template-columns: 1fr; }
  .diagnostics dl { grid-template-columns: 1fr; }
  .result { padding-inline: 9px; }
  .status { padding: 4px 7px; font-size: 11px; }
  .badge { font-size: 10px; }
  .result-meta div { gap: 3px; }
  .result-meta dt, .result-meta dd { font-size: 12px; }
  .result-meta svg { width: 16px; }
  .plot svg { max-height: 155px; }
}
