* { box-sizing: border-box; }
body { margin: 0; padding: 20px; background: #fff; }
.dash { background: #fff; color: #111; font-family: 'Inter', -apple-system, sans-serif; max-width: 1100px; margin: 0 auto; }

.dash-header { border: 2px solid #111; border-radius: 10px; padding: 16px 20px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.dash-header h3 { margin: 0; font-size: 20px; font-weight: 600; }
.docs-btn { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; color: #111; background: #fff; border: 1.5px solid #111; border-radius: 999px; padding: 6px 16px; cursor: pointer; transition: background .15s, color .15s; }
.docs-btn:hover { background: #111; color: #fff; }
.docs-btn:focus-visible { outline: 3px solid #4A90D9; outline-offset: 3px; }


.dash-row { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-box { flex: 1; min-width: 240px; border: 2px solid #111; border-radius: 10px; padding: 16px; text-align: center; min-height: 165px; display: flex; flex-direction: column; }
.dash-box .title { text-align: left; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.dash-box.metric-box { height: 260px; min-width: 300px; }

.bcast-box { position: relative; }
.bcast-box .switch { position: absolute; top: 50%; left: 50%; transform: translate(-50%, calc(-50% - 8px)); }

/* From Uiverse.io by r7chardgh */
.switch {
  font-size: 17px;
  position: relative;
  display: inline-block;
  width: 5em;
  height: 2.5em;
  user-select: none;
}
.switch .cb {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle {
  position: absolute;
  cursor: pointer;
  width: 100%;
  height: 100%;
  background-color: #373737;
  border-radius: 0.1em;
  transition: 0.4s;
  text-transform: uppercase;
  font-weight: 700;
  overflow: hidden;
  box-shadow: -0.3em 0 0 0 #373737, -0.3em 0.3em 0 0 #373737,
    0.3em 0 0 0 #373737, 0.3em 0.3em 0 0 #373737, 0 0.3em 0 0 #373737;
}
.toggle > .left {
  position: absolute;
  display: flex;
  width: 50%;
  height: 88%;
  background-color: #f3f3f3;
  color: #373737;
  left: 0;
  bottom: 0;
  align-items: center;
  justify-content: center;
  transform-origin: right;
  transform: rotateX(10deg);
  transform-style: preserve-3d;
  transition: all 150ms;
}
.left::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(206, 206, 206);
  transform-origin: center left;
  transform: rotateY(90deg);
}
.left::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(112, 112, 112);
  transform-origin: center bottom;
  transform: rotateX(90deg);
}
.toggle > .right {
  position: absolute;
  display: flex;
  width: 50%;
  height: 88%;
  background-color: #f3f3f3;
  color: rgb(206, 206, 206);
  right: 1px;
  bottom: 0;
  align-items: center;
  justify-content: center;
  transform-origin: left;
  transform: rotateX(10deg) rotateY(-45deg);
  transform-style: preserve-3d;
  transition: all 150ms;
}
.right::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(206, 206, 206);
  transform-origin: center right;
  transform: rotateY(-90deg);
}
.right::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  background-color: rgb(112, 112, 112);
  transform-origin: center bottom;
  transform: rotateX(90deg);
}
.switch input:checked + .toggle > .left {
  transform: rotateX(10deg) rotateY(45deg);
  color: rgb(206, 206, 206);
}
.switch input:checked + .toggle > .right {
  transform: rotateX(10deg) rotateY(0deg);
  color: #487bdb;
}

/* Additions on top of the Uiverse source: the switch itself has no
   disabled/focus treatment, but the broadcast control needs both (a node
   we believe unreachable disables it, and it's keyboard-operable). */
.switch:has(.cb:disabled) { cursor: default; opacity: .55; }
.switch:has(.cb:disabled) .toggle { cursor: default; }
.switch .cb:focus-visible + .toggle { outline: 3px solid #4A90D9; outline-offset: 3px; }

/* Bulb shape adapted from github.com/WebDevPie/Light-Bulb-On-Off-Toggle -
   a rotated circle + a rotated rectangle "neck" (the ::before, positioned
   above the circle pre-rotation, ends up below it post-rotation), with the
   two shoulder spans filling the round-to-neck curve via a box-shadow
   border-radius trick. Source used white for "on"; recolored to the same
   amber used everywhere else in this dashboard. */
.bulb-btn { position: relative; display: flex; justify-content: center; width: 60px; height: 90px; margin: 0 auto 10px; padding: 0; border: none; background: none; cursor: pointer; }
.bulb-btn:disabled { cursor: default; opacity: .6; }
.bulb-btn:active:not(:disabled) { transform: scale(0.97); }
.bulb-btn:focus-visible { outline: 3px solid #4A90D9; outline-offset: 3px; }

.bulb {
  position: relative;
  width: 80px;
  height: 80px;
  background: #666;
  border-radius: 50%;
  transform: rotate(180deg);
  zoom: .65;
  margin-top: 10px;
  transition: background .3s ease-out, box-shadow .3s ease-out;
}
.bulb.on {
  background: #FFC94A;
  box-shadow: 0 0 20px #FFC94A, 0 0 40px #FFC94A, 0 0 60px rgba(255, 201, 74, .6), 0 0 85px rgba(255, 201, 74, .4);
  animation: bulb-warmup .5s ease-out;
}
.bulb-btn:hover:not(:disabled) .bulb:not(.on) { background: #777; }
.bulb-btn:hover:not(:disabled) .bulb:not(.on)::before { background: #777; }

.bulb::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 22.5px;
  width: 35px;
  height: 80px;
  background: #666;
  border-top: 30px solid #000;
  border-radius: 10px;
  transition: background .3s ease-out;
}
.bulb.on::before { background: #FFC94A; }

.bulb.on::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 110px; height: 110px;
  background: #FFC94A;
  border-radius: 50%;
  filter: blur(36px);
  opacity: .5;
  pointer-events: none;
}

.bulb span:nth-child(1),
.bulb span:nth-child(2) {
  position: absolute;
  display: block;
  width: 30px;
  height: 30px;
  background: transparent;
}
.bulb span:nth-child(1) {
  top: -16px; left: -4px;
  transform: rotate(342deg);
  border-bottom-right-radius: 40px;
  box-shadow: 20px 20px 0 10px #666;
  transition: box-shadow .3s ease-out;
}
.bulb span:nth-child(2) {
  top: -16px; right: -4px;
  transform: rotate(17deg);
  border-bottom-left-radius: 40px;
  box-shadow: -20px 20px 0 10px #666;
  transition: box-shadow .3s ease-out;
}
.bulb.on span:nth-child(1) { box-shadow: 20px 20px 0 10px #FFC94A; }
.bulb.on span:nth-child(2) { box-shadow: -20px 20px 0 10px #FFC94A; }

@keyframes bulb-warmup {
  0%   { opacity: .35; }
  20%  { opacity: 1; }
  35%  { opacity: .55; }
  55%  { opacity: 1; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .bulb.on { animation: none; }
}
.node-status { margin-top: auto; font-size: 13px; font-family: 'Inter', monospace; }
.node-status.online { color: #1a7a3c; }
.node-status.offline { color: #888; }

.metric-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; flex-wrap: wrap; gap: 6px; }
.range-pill { display: flex; gap: 2px; border: 1.5px solid #111; border-radius: 14px; padding: 2px; flex-shrink: 0; }
.range-pill button { border: none; background: none; font-family: 'Inter', monospace; font-size: 11px; padding: 3px 9px; border-radius: 12px; cursor: pointer; color: #111; opacity: .5; transition: background .15s, opacity .15s; }
.range-pill button.active { opacity: 1; font-weight: 700; background: #111; color: #fff; }
.range-pill button:hover:not(.active) { opacity: .8; background: #f0f0f0; }
.range-pill button:focus-visible { outline: 2px solid #4A90D9; outline-offset: 1px; }

.metric-values { display: flex; gap: 16px; text-align: left; margin-bottom: 8px; }
.metric-values .v-item .k { font-size: 11px; color: #777; }
.metric-values .v-item .v { font-size: 18px; font-weight: 700; font-family: 'Inter', monospace; font-variant-numeric: tabular-nums; }
.metric-values .v-item.node2 .v { color: #555; }
.metric-values .v-item .v .unit { font-size: 11px; font-weight: 400; color: #555; font-family: 'Inter', sans-serif; }
.chart-wrap { position: relative; width: 100%; height: 150px; margin-top: auto; }
.metric-chart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; padding: 0 16px; font-size: 12px; color: #999; }
.chart-wrap.empty .metric-chart { visibility: hidden; }
.chart-wrap.empty .chart-empty { display: flex; }

.log-list { text-align: left; font-size: 12px; font-family: 'Inter', monospace; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.log-list .row { display: flex; gap: 8px; }
.log-list .t { color: #888; flex-shrink: 0; width: 84px; font-variant-numeric: tabular-nums; }
.log-list .m { color: #111; }
