:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-edge: #1e2630;
  --panel-head: #0f1419;
  --text: #cad4de;
  --text-dim: #6b7885;
  --accent: #36d399;
  --amber: #ffcf4b;
  --red: #e94b4b;
  --grid: #1a2029;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
  font-size: 14px;
  min-height: 100vh;
}

.top-bar, .foot-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--panel-edge);
  background: var(--panel-head);
  letter-spacing: 0.06em;
}

.foot-bar {
  border-top: 1px solid var(--panel-edge);
  border-bottom: none;
  font-size: 12px;
  color: var(--text-dim);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.status-chips {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
}

.chip b { color: var(--text); font-weight: 600; }

.led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333;
  display: inline-block;
}
.led.green { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.led.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.led.red   { background: var(--red);   box-shadow: 0 0 6px var(--red); }

.grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto auto;
  gap: 14px;
  padding: 14px;
}

.pressure { grid-row: 1 / span 2; }
.trend    { grid-column: 2; grid-row: 1; }
.alarms, .plc {
  grid-column: 2;
  grid-row: 2;
}
.grid > .alarms {
  grid-column: 2;
  grid-row: 2;
}
.grid > .plc {
  grid-column: 2;
  grid-row: 3;
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: 340px 1fr 1fr;
  }
  .pressure { grid-row: 1 / span 2; }
  .trend    { grid-column: 2 / span 2; grid-row: 1; }
  .alarms   { grid-column: 2; grid-row: 2; }
  .plc      { grid-column: 3; grid-row: 2; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 14px;
  position: relative;
}

.panel-title {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 14px;
}

.gauge-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}

#gauge {
  width: 220px;
  height: 340px;
}

.bar-bg   { fill: #1a2029; stroke: var(--panel-edge); stroke-width: 1; }
.bar-tol  { fill: rgba(54, 211, 153, 0.25); stroke: rgba(54, 211, 153, 0.6); stroke-width: 1; }
.needle   { stroke: var(--accent); stroke-width: 3; }
.needle.alert { stroke: var(--red); }
.ticks line, .side-ticks line { stroke: var(--text-dim); stroke-width: 1; }
.ticks text { fill: var(--text-dim); font-size: 10px; font-family: inherit; }

.readout {
  text-align: center;
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.readout .unit {
  font-size: 16px;
  color: var(--text-dim);
  margin-left: 8px;
  letter-spacing: 0.2em;
}
.readout .ok { color: var(--accent); }
.readout .alert { color: var(--red); }
#psi-value.alert { color: var(--red); }

.tol-line {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  margin-top: 6px;
}

#trend {
  width: 100%;
  height: 160px;
  display: block;
}
#trend .axis { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 3; }
#trend-line { stroke: var(--accent); stroke-width: 1.5; }

.trend-foot {
  display: flex;
  justify-content: space-around;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0.15em;
}
.trend-foot b { color: var(--text); font-weight: 600; }

.alarm-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}
.alarm-count .num {
  font-size: 42px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.alarm-count .sub {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

.mono-list {
  list-style: none;
  margin: 0; padding: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.mono-list li {
  padding: 4px 0;
  border-top: 1px solid var(--panel-edge);
}
.mono-list li.empty { color: var(--text-dim); font-style: italic; }

.plc-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.plc-status .sep { color: var(--text-dim); }
.plc-status b { color: var(--text); font-weight: 600; }

.heartbeat {
  color: var(--accent);
  font-size: 16px;
  transition: opacity 0.2s;
}
.heartbeat.pulse {
  animation: pulse 0.6s ease-out;
}
@keyframes pulse {
  0% { opacity: 1; text-shadow: 0 0 6px var(--accent); }
  100% { opacity: 0.5; text-shadow: none; }
}
