:root {
  color-scheme: dark;
  --bg: #050c12;
  --surface: #0b1923;
  --line: #53758c75;
  --text: #eaf2ff;
  --dim: #9aafc7;
  --cyan: #47e8ff;
  --ok: #68ffdb;
  --warn: #ffb64d;
  --error: #ff657e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(
    ellipse at 53% 45%,
    #112b3a 0,
    #050d15 55%,
    #03080e 100%
  );
  color: var(--text);
  font:
    16px/1.5 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  min-height: 100svh;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 1px solid #6e91ad;
  background: linear-gradient(145deg, #22384baf, #0a1521d9);
  border-radius: 8px;
  min-height: 44px;
  padding: 8px 14px;
  box-shadow: inset 0 1px 0 #c3e7ff44;
}
button:hover {
  border-color: var(--cyan);
  background-color: #1b465a;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
header {
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 26px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #08101bbd, #17314180, #060c15cc);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 24px;
  letter-spacing: 2px;
}
.brand img {
  width: 54px;
  height: 40px;
  object-fit: contain;
  mix-blend-mode: screen;
}
.subbrand {
  border-left: 1px solid #698a9f;
  padding-left: 20px;
  color: var(--dim);
}
.header-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: var(--dim);
}
.header-end button {
  font-size: 16px;
  color: var(--text);
}
.legend {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}
.legend i.warn {
  background: var(--warn);
}
.legend i.muted {
  background: #62748c;
}
main {
  padding: 18px 16px 20px;
  max-width: 2400px;
  margin: auto;
}
.overview {
  display: flex;
  align-items: center;
  gap: 38px;
  margin: 0 12px 20px;
  min-height: 58px;
}
h1 {
  font-size: clamp(26px, 2.6vw, 44px);
  letter-spacing: 1px;
  margin: 0;
  white-space: nowrap;
}
h2 {
  font-size: clamp(22px, 1.8vw, 30px);
  margin: 0;
  font-weight: 600;
}
.overview p {
  font-size: 15px;
  color: var(--dim);
  margin: 0;
  max-width: 320px;
}
.health {
  color: var(--ok);
  font-size: clamp(19px, 1.7vw, 28px);
  font-weight: 550;
  white-space: nowrap;
}
.health.unknown {
  color: var(--dim);
}
.health.error {
  color: var(--warn);
}
.workspace {
  display: grid;
  grid-template-columns: minmax(235px, 19%) minmax(0, 1fr) minmax(260px, 19%);
  gap: 14px;
  min-height: 620px;
  height: calc(100svh - 270px);
  max-height: 1050px;
}
.panel {
  border: 1px solid #82a8c17d;
  border-radius: 9px;
  background: linear-gradient(125deg, #0a1822e8, #07121adb);
  box-shadow:
    inset 0 1px 0 #a4d4ed42,
    0 14px 40px #0004;
  backdrop-filter: blur(18px);
  position: relative;
}
.panel:before,
.panel:after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: #c3e5ef;
  left: 10px;
  top: -1px;
  box-shadow: 0 0 10px #adf3ff55;
}
.panel:after {
  left: auto;
  right: 10px;
  top: auto;
  bottom: -1px;
}
.metrics {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
}
.metrics h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.metric {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  flex: 1;
}
.metric label {
  font-size: 19px;
}
.metric strong {
  font:
    500 clamp(30px, 2.9vw, 48px) / 1.15 ui-sans-serif,
    system-ui,
    sans-serif;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.metric span {
  font-size: 20px;
  margin-left: 5px;
}
.metric small {
  display: block;
  color: var(--dim);
  font-size: 13px;
}
meter {
  display: block;
  width: 100%;
  height: 8px;
  margin: 8px 0;
  background: #223848;
  border: 0;
  border-radius: 2px;
}
meter::-webkit-meter-bar {
  background: #223848;
  border: 0;
  border-radius: 2px;
}
meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg, #1bb8e1, #5ce7ff);
  border-radius: 2px;
}
meter::-moz-meter-bar {
  background: #47e8ff;
}
.sparkline {
  height: 30px;
  width: 100%;
  overflow: visible;
}
.sparkline path {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
}
.minor {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--dim);
  font-size: 14px;
}
dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.minor dd {
  color: var(--text);
}
.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.stage canvas {
  display: block;
  touch-action: none;
  cursor: grab;
}
.stage canvas:active {
  cursor: grabbing;
}
#scene {
  position: absolute;
  inset: 0;
}
#labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.machine-label {
  position: absolute;
  pointer-events: auto;
  white-space: nowrap;
  border-radius: 4px;
  background: #04101cdb;
  font-size: 14px;
  padding: 5px 10px;
  min-height: 36px;
  border-color: #356b89;
  box-shadow: 0 2px 10px #000a;
  transform: translate(-50%, -100%);
}
.machine-label.selected {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px #28dfff44;
}
.scene-footer {
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  pointer-events: none;
}
.scene-footer p {
  margin: 3px 0;
}
.scene-footer button {
  pointer-events: auto;
  background: #0b1823d9;
  border-color: #243d4e;
  font-size: 12px;
  padding: 3px 8px;
  min-height: 30px;
  margin: 4px 2px;
}
.scene-footer button[aria-pressed="true"] {
  color: var(--cyan);
  border-color: #41dfff;
}
.detail {
  padding: 20px 22px;
}
.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.detail small,
.eyebrow {
  color: var(--dim);
  font-size: 13px;
}
.eyebrow {
  margin: 0 0 22px;
}
.detail .health {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.services {
  display: grid;
  grid-template-columns: 1fr auto;
  margin: 0 0 12px;
}
.services dt,
.services dd {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.services dd {
  color: var(--ok);
}
.services dd.unknown {
  color: var(--dim);
}
.services dd.error {
  color: var(--warn);
}
.details {
  display: grid;
  grid-template-columns: minmax(65px, auto) 1fr;
  gap: 12px 7px;
  font-size: 14px;
}
.details dt {
  color: var(--dim);
}
.details dd {
  text-align: right;
  overflow-wrap: anywhere;
}
.detail-note {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--dim);
}
#restart-status {
  font-size: 13px;
  color: var(--warn);
}
.channels {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  min-height: 88px;
  margin-top: 18px;
}
.channel-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
}
.channel-heading span {
  font-size: 14px;
  color: var(--dim);
}
.channels > button {
  border-radius: 50%;
  font-size: 32px;
  line-height: 1;
  width: 44px;
  padding: 0;
  flex-shrink: 0;
}
#channel-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  flex: 1;
  min-width: 0;
}
.channel-item {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding-right: 15px;
}
.channel-item strong {
  display: block;
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.channel-item small {
  display: block;
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-item[data-status="error"] strong {
  color: var(--warn);
}
.channel-item[data-status="ok"] strong {
  color: var(--ok);
}
.channel-meta {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  white-space: nowrap;
}
.channel-meta button {
  font-size: 14px;
  padding: 3px 8px;
}
.empty {
  color: var(--dim);
  font-size: 14px;
  grid-column: 1/-1;
}
dialog {
  width: min(420px, 90vw);
  background: #0a1927;
  border: 1px solid #63819b;
  border-radius: 16px;
  color: var(--text);
  box-shadow: 0 30px 100px #000b;
  padding: 32px;
}
dialog::backdrop {
  background: #020710a8;
  backdrop-filter: blur(8px);
}
dialog img {
  width: 60px;
  display: block;
  margin-bottom: 20px;
}
dialog p {
  color: var(--dim);
  font-size: 14px;
}
dialog label {
  display: block;
  margin: 16px 0;
  color: var(--dim);
  font-size: 14px;
}
input {
  display: block;
  width: 100%;
  background: #030d17;
  border: 1px solid #476275;
  color: var(--text);
  font: inherit;
  padding: 12px;
  border-radius: 7px;
  margin-top: 7px;
}
dialog button {
  width: 100%;
  margin-top: 8px;
}
#login-error {
  color: var(--warn);
}
[hidden] {
  display: none !important;
}
#webgl-error {
  padding: 40px;
  color: var(--warn);
}
@media (min-width: 1900px) {
  main {
    padding: 26px;
  }
  .workspace {
    gap: 24px;
  }
  .metrics,
  .detail {
    padding: 28px 30px;
  }
  .metric {
    padding: 20px 0;
  }
  .details {
    font-size: 17px;
  }
  .services dt,
  .services dd {
    padding: 14px 0;
  }
  .channels {
    margin-top: 24px;
  }
  .overview {
    margin-bottom: 26px;
  }
}
@media (max-width: 1200px) {
  .overview {
    gap: 20px;
    flex-wrap: wrap;
  }
  .overview p {
    display: none;
  }
  .header-end {
    gap: 12px;
  }
  .legend {
    display: none;
  }
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr) 240px;
  }
  .metrics,
  .detail {
    padding: 16px;
  }
  .channels {
    gap: 14px;
    padding: 14px;
  }
  .channel-heading {
    display: block;
  }
  .channel-meta small {
    display: none;
  }
  .subbrand {
    display: none;
  }
}
@media (max-width: 999px) {
  header {
    padding: 0 16px;
  }
  .brand {
    font-size: 20px;
  }
  .header-end #updated {
    display: none;
  }
  main {
    padding: 16px;
  }
  .overview {
    margin: 0 0 20px;
    gap: 12px;
  }
  .overview h1 {
    width: 100%;
  }
  .overview .health {
    font-size: 18px;
  }
  .workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: auto;
    min-height: 0;
  }
  .stage {
    grid-column: 1/-1;
    grid-row: 1;
    height: 480px;
  }
  .metrics {
    grid-column: 1;
  }
  .detail {
    grid-column: 2;
  }
  .channels {
    flex-wrap: wrap;
  }
  .channel-heading {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }
  #channel-items {
    grid-template-columns: 1fr;
  }
  .channel-item {
    border: 0;
  }
  .channel-item:nth-child(n + 2) {
    display: none;
  }
  .channel-meta {
    margin-left: auto;
  }
  .metric strong {
    font-size: 36px;
  }
  .scene-footer button {
    min-height: 44px;
  }
  .machine-label {
    min-height: 44px;
  }
  .workspace {
    gap: 12px;
  }
}
@media (max-width: 540px) {
  header {
    height: 64px;
    gap: 8px;
  }
  .brand {
    font-size: 17px;
    letter-spacing: 0;
    gap: 7px;
  }
  .brand img {
    width: 38px;
    height: 32px;
  }
  .header-end button {
    font-size: 13px;
    padding: 8px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .stage {
    height: 390px;
    grid-row: 1;
  }
  .metrics {
    grid-column: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
  }
  .metrics h2,
  .minor {
    grid-column: 1/-1;
  }
  .detail {
    grid-column: 1;
  }
  .metric label {
    font-size: 15px;
  }
  .metric strong {
    font-size: 30px;
  }
  .metric span {
    font-size: 15px;
  }
  .scene-footer {
    font-size: 11px;
  }
  .scene-footer button {
    font-size: 11px;
  }
  .overview .health {
    font-size: 15px;
  }
  .details {
    font-size: 15px;
  }
  .channel-meta {
    margin-left: 0;
  }
  .channels {
    gap: 10px;
  }
  .channels > button {
    width: 44px;
  }
  .channel-item strong {
    font-size: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.workspace {
  grid-template-rows: minmax(0, 1fr);
}
.metrics,
.detail,
.stage,
.metric {
  min-height: 0;
}
@media (min-width: 1000px) and (max-height: 950px) {
  header {
    height: 62px;
  }
  main {
    padding: 14px 16px;
  }
  .overview {
    margin-bottom: 14px;
    min-height: 54px;
  }
  .workspace {
    height: calc(100svh - 248px);
    min-height: 490px;
  }
  .metrics,
  .detail {
    padding: 16px 20px;
  }
  .metrics h2 {
    padding-bottom: 8px;
  }
  .metric {
    padding: 8px 0;
  }
  .metric strong {
    font-size: 36px;
  }
  .metric label {
    font-size: 16px;
  }
  .metric span {
    font-size: 17px;
  }
  .minor {
    margin-top: 10px;
    gap: 4px;
  }
  .detail .health {
    padding-bottom: 12px;
  }
  .eyebrow {
    margin-bottom: 12px;
  }
  .services dt,
  .services dd {
    padding: 7px 0;
    font-size: 16px;
  }
  .details {
    font-size: 13px;
    gap: 9px 5px;
  }
  .detail-note {
    margin-top: 12px;
    padding-top: 10px;
  }
  .channels {
    min-height: 76px;
    margin-top: 14px;
    padding: 10px 20px;
  }
  .sparkline {
    height: 23px;
  }
}

.machine-label::after {
  content: "";
  position: absolute;
  pointer-events: none;
  top: 100%;
  left: 50%;
  width: 1px;
  height: var(--leader, 20px);
  background: linear-gradient(#83c7e9cc, #83c7e933);
}

@media (max-width: 999px) {
  .workspace {
    grid-template-rows: auto auto;
  }
  .metrics,
  .detail {
    grid-row: 2;
  }
  .stage {
    grid-row: 1;
  }
}
@media (max-width: 540px) {
  .workspace {
    grid-template-rows: 390px auto auto;
  }
  .metrics {
    grid-row: 2;
  }
  .detail {
    grid-row: 3;
  }
}

.health {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ok);
  color: #042628;
  font-size: 25px;
  box-shadow: 0 0 20px #68ffdb24;
}
.health.error .status-orb {
  background: var(--warn);
  color: #342108;
}
.health.unknown .status-orb {
  background: #273e50;
  color: #9aafc7;
  box-shadow: none;
}
@media (max-width: 999px) {
  .health {
    gap: 7px;
  }
  .status-orb {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }
}
