.control-box {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--deep);
}
.control-box h3 { margin: 0 0 .8rem; }
.duration-grid {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto auto;
  gap: .6rem;
  align-items: end;
}
.duration-grid label, .plot-toolbar label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  color: var(--muted);
  font-size: .82rem;
}
.preset-row, .plot-toolbar, .series-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
}
.preset-row { margin-top: .75rem; }
.preset-row button { padding: .45rem .7rem; }
.commissioning-controls, .plot-range-toolbar { margin-top: .75rem; }
.plot-range-toolbar input { min-width: 105px; max-width: 140px; }
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .7rem;
}
.sensor-grid > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--deep);
}
.sensor-grid span, .sensor-grid small { color: var(--muted); }
.sensor-grid strong { font-size: 1.3rem; overflow-wrap: anywhere; }
.plot-toolbar { align-items: end; }
.plot-toolbar select { min-width: 125px; }
.series-controls { margin: 1rem 0; gap: .45rem 1rem; }
.series-controls label { font-size: .82rem; white-space: nowrap; }
.series-controls input { width: auto; }
.plot-stack { display: grid; gap: .8rem; }
.plot-stack figure {
  margin: 0;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--deep);
}
.plot-stack figcaption { color: var(--accent); font-weight: 750; margin-bottom: .4rem; }
.plot-stack canvas { display: block; width: 100%; height: 230px; touch-action: none; }
.plot-stack figure:last-child canvas { height: 170px; }
#device-diagnostics {
  margin-top: .6rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .8rem;
}
@media (max-width: 1100px) { .sensor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .duration-grid { grid-template-columns: 1fr 1fr; }
  .sensor-grid { grid-template-columns: 1fr 1fr; }
  .plot-stack canvas { height: 200px; }
}
#realtime-plot {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line, #1f4b57);
  border-radius: 12px;
  background: #061820;
}
