/* =============================================================
   plant.css — Plant Live View (/plant/) HMI chrome.
   Subdomain-ready: keep plant-specific look here, not in styles.css.
   ============================================================= */

:root {
  --plant-good: #34d399;
  --plant-uncertain: #fbbf24;
  --plant-bad: #f87171;
  --plant-stale: #94a3b8;
  --plant-panel: rgba(15, 23, 42, 0.72);
  --plant-stroke: rgba(51, 65, 85, 0.85);
  --plant-rail: 16.5rem;
  --plant-alarms: 17rem;
  --pid-stroke: #64748b;
  --pid-fill: rgba(2, 6, 23, 0.85);
}

.plant-page {
  min-height: 100dvh;
}

.plant-shell {
  padding-top: 3rem; /* site bar */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .plant-page {
    height: 100dvh;
    overflow: hidden;
  }
  .plant-shell {
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
  }
}

.plant-hmi {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--plant-stroke);
}

.plant-hmi__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.5rem 0.85rem 0.55rem;
  border-bottom: 1px solid var(--plant-stroke);
  background: rgba(2, 6, 23, 0.55);
  flex-shrink: 0;
}

.plant-hmi__title {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: nowrap;
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
}

.plant-hmi__title h1 {
  margin: 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgb(226 232 240);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

.plant-hmi__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}

.plant-area-nav {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  padding: 0;
  border: 1px solid var(--plant-stroke);
  background: rgba(2, 6, 23, 0.45);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.plant-area-nav__btn {
  appearance: none;
  border: 0;
  border-right: 1px solid rgba(51, 65, 85, 0.65);
  border-radius: 0;
  background: transparent;
  color: rgb(148 163 184);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex: 1 1 0;
  min-width: max-content;
}

.plant-area-nav__btn:last-child {
  border-right: 0;
}

.plant-area-nav__btn:hover {
  color: var(--color-brand-300);
  background: rgba(34, 211, 238, 0.06);
}

.plant-area-nav__btn:focus-visible {
  outline: 2px solid var(--color-brand-400);
  outline-offset: -2px;
  z-index: 1;
}

.plant-area-nav__btn.is-active {
  color: rgb(226 232 240);
  background: rgba(34, 211, 238, 0.14);
}

.plant-area-nav__icon {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.plant-area-nav__btn.is-active .plant-area-nav__icon {
  opacity: 1;
}

.plant-area-nav__label {
  line-height: 1;
}

@media (max-width: 720px) {
  .plant-hmi__header {
    grid-template-columns: 1fr;
  }
  .plant-hmi__meta {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
  }
  .plant-area-nav {
    grid-row: 3;
  }
}

.plant-sim-badge {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand-400);
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  line-height: 1.2;
  flex-shrink: 0;
}

.plant-site-bar .plant-sim-badge {
  opacity: 0.92;
}

.plant-hmi__meta .plant-scan {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgb(148 163 184);
}

.plant-header-alarms {
  appearance: none;
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
  color: rgb(252 165 165);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.2;
}
.plant-header-alarms:hover {
  border-color: rgba(248, 113, 113, 0.75);
  color: rgb(254 202 202);
}
.plant-header-alarms:focus-visible {
  outline: 2px solid var(--color-brand-400);
  outline-offset: 1px;
}

.plant-scan__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--plant-good);
  box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.9);
}

.plant-scan__dot.is-fault {
  background: var(--plant-bad);
}

.plant-scan__dot.is-warn {
  background: var(--plant-uncertain);
}

@media (prefers-reduced-motion: no-preference) {
  .plant-scan__dot:not(.is-fault):not(.is-warn) {
    animation: plant-scan-pulse 1.8s ease-in-out infinite;
  }
}

@keyframes plant-scan-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.plant-q-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  align-items: center;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}

.plant-q-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.plant-q-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
}

.plant-q-dot--good { background: rgb(148 163 184); }
.plant-q-dot--uncertain { background: var(--plant-uncertain); }
.plant-q-dot--bad { background: var(--plant-bad); }
.plant-q-dot--stale { background: var(--plant-stale); }

.plant-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr;
  min-height: 0;
}

@media (min-width: 1024px) {
  .plant-body {
    grid-template-columns: var(--plant-rail) minmax(0, 1fr) var(--plant-alarms);
    grid-template-rows: minmax(0, 1fr);
  }
}

.plant-pane {
  background: var(--plant-panel);
  border-bottom: 1px solid var(--plant-stroke);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .plant-pane { border-bottom: 0; }
  .plant-pane--tree { border-right: 1px solid var(--plant-stroke); }
  .plant-pane--alarms { border-left: 1px solid var(--plant-stroke); }
}

.plant-pane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--plant-stroke);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(148 163 184);
}

.plant-pane__head--tree {
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.plant-pane__head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.plant-pane__head--tree .plant-q-legend {
  padding-top: 0.15rem;
  border-top: 1px solid rgba(51, 65, 85, 0.55);
}

.plant-pane__body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 0.4rem 0.35rem 0.75rem;
}

.plant-pane__body::-webkit-scrollbar { width: 6px; height: 6px; }
.plant-pane__body::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 3px;
}

/* ---- Tag tree ---- */
.plant-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}

.plant-tree details {
  margin: 0;
}

.plant-tree summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 0.85rem 1fr auto;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  color: rgb(203 213 225);
}

.plant-tree summary::-webkit-details-marker { display: none; }
.plant-tree summary:hover {
  background: rgba(34, 211, 238, 0.06);
}

.plant-tree__chev {
  font-size: 0.55rem;
  color: rgb(100 116 139);
  transition: transform 0.15s ease;
  text-align: center;
}

.plant-tree details:not([open]) > summary .plant-tree__chev {
  transform: rotate(-90deg);
}

.plant-tree__count {
  font-size: 0.55rem;
  color: rgb(100 116 139);
}

.plant-tree details > ul {
  list-style: none;
  margin: 0 0 0.25rem 0.4rem;
  padding: 0.1rem 0 0.25rem 0.55rem;
  border-left: 1px dashed rgba(148, 163, 184, 0.15);
}

.plant-tag {
  width: 100%;
  display: grid;
  grid-template-columns: 0.4rem 1fr auto auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: rgb(203 213 225);
  font: inherit;
  font-size: 0.68rem;
  text-align: left;
  cursor: pointer;
}

.plant-tag:hover {
  background: rgba(34, 211, 238, 0.06);
  color: rgb(241 245 249);
}

.plant-tag.is-selected {
  background: rgba(34, 211, 238, 0.08);
  box-shadow: inset 2px 0 0 0 var(--color-brand-400);
  color: rgb(241 245 249);
}

.plant-tag__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plant-tag__val {
  color: rgb(148 163 184);
  font-size: 0.62rem;
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plant-q {
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.08rem 0.28rem;
  border-radius: 3px;
  border: 1px solid transparent;
  line-height: 1.2;
}

/* Hybrid ISA-101: normal is neutral, colour is kept for abnormal states
   (and green only for RUNNING/EXECUTE state badges). */
.plant-q--good {
  color: rgb(203 213 225);
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}
.plant-q--uncertain {
  color: var(--plant-uncertain);
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}
.plant-q--bad {
  color: var(--plant-bad);
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}
.plant-q--stale {
  color: var(--plant-stale);
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.08);
}

.plant-q-dot-inline {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--plant-stale);
}
.plant-tag[data-q="Good"] .plant-q-dot-inline { background: rgb(148 163 184); }
.plant-tag[data-q="Uncertain"] .plant-q-dot-inline { background: var(--plant-uncertain); }
.plant-tag[data-q="Bad"] .plant-q-dot-inline { background: var(--plant-bad); }
.plant-tag[data-q="Stale"] .plant-q-dot-inline { background: var(--plant-stale); }

.plant-tag--offline {
  opacity: 0.55;
  cursor: default;
}
.plant-tag--offline:hover {
  background: transparent;
  color: rgb(203 213 225);
}

.plant-tree__site > details > summary {
  color: rgb(226 232 240);
  font-weight: 600;
}
.plant-tree__site--live > details > summary .plant-tree__label::after {
  content: "LIVE";
  margin-left: 0.45rem;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--plant-good);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  vertical-align: middle;
}
.plant-tree__site--offline > details > summary .plant-tree__label::after {
  content: "OFFLINE";
  margin-left: 0.45rem;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--plant-stale);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  vertical-align: middle;
}
.plant-tree__site--offline.plant-tree__site--spark > details > summary .plant-tree__label::after {
  content: "FLAP";
  color: var(--plant-uncertain);
  border-color: rgba(251, 191, 36, 0.45);
}
.plant-tree__site--spark .plant-tree__area--stub > details > summary .plant-tree__label::after {
  content: "FLAP";
  color: var(--plant-uncertain);
  border-color: rgba(251, 191, 36, 0.45);
}
.plant-tree__site--offline.plant-tree__site--spark > details > summary {
  color: rgb(226 232 240);
  font-weight: 600;
}
.plant-tree__site--offline > details > summary {
  color: rgb(100 116 139);
  font-weight: 500;
}
.plant-tree__edge > details > summary {
  color: rgb(226 232 240);
  font-weight: 600;
}
.plant-tree__area > details > summary {
  color: rgb(203 213 225);
}
.plant-tree__area--live > details > summary .plant-tree__label::after {
  content: "LIVE";
  margin-left: 0.45rem;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--plant-good);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  vertical-align: middle;
}
.plant-tree__area--stub > details > summary .plant-tree__label::after {
  content: "OFFLINE";
  margin-left: 0.45rem;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--plant-stale);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  vertical-align: middle;
}
.plant-tree__area--stub > details > summary {
  color: rgb(100 116 139);
}
.plant-tree__line--live > details > summary .plant-tree__label::after {
  content: "LIVE";
  margin-left: 0.45rem;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  color: var(--plant-good);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  vertical-align: middle;
}
/* Nested folders: tighten deeper levels */
.plant-tree details details > ul {
  margin-left: 0.25rem;
  padding-left: 0.45rem;
}

/* ---- Mimic / P&ID ---- */
.plant-mimic {
  display: flex;
  flex-direction: column;
  min-height: 16rem;
}

@media (min-width: 1024px) {
  .plant-mimic { min-height: 0; }
}

.plant-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--plant-stroke);
}

.plant-batch-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--plant-stroke);
  background: rgba(2, 6, 23, 0.45);
}
.plant-batch-trail__id {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgb(165 243 252);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
}
.plant-batch-trail__id:hover {
  color: var(--color-brand-300, #67e8f9);
}
.plant-batch-trail__label {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}
.plant-batch-trail__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.plant-batch-trail__steps li {
  display: inline-flex;
  align-items: center;
}
.plant-batch-trail__steps li + li::before {
  content: "→";
  margin: 0 0.28rem;
  color: rgb(71 85 105);
  font-size: 0.65rem;
}
.plant-batch-trail__steps button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgb(100 116 139);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.1rem 0.15rem;
}
.plant-batch-trail__steps li.is-done button {
  color: rgb(110 231 183);
}
.plant-batch-trail__steps li.is-here button {
  color: rgb(165 243 252);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.plant-batch-trail__steps button.is-active {
  color: var(--color-brand-300, #67e8f9);
}
.plant-batch-trail__steps button:hover {
  color: rgb(226 232 240);
}

.plant-pid-alarm {
  margin: 0.35rem 0.75rem 0;
  padding: 0.35rem 0.55rem;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.25);
  color: rgb(254 202 202);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}
.plant-pid-alarm[data-severity="warning"] {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(120, 53, 15, 0.28);
  color: rgb(253 230 138);
}

.plant-toolbar__group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.plant-toolbar__label {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  margin-right: 0.1rem;
}

.plant-btn {
  appearance: none;
  border: 1px solid rgb(51 65 85);
  background: rgba(2, 6, 23, 0.55);
  color: rgb(203 213 225);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.65rem;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plant-btn:hover {
  border-color: rgba(34, 211, 238, 0.45);
  color: var(--color-brand-300);
}

.plant-btn:focus-visible {
  outline: 2px solid var(--color-brand-400);
  outline-offset: 2px;
}

/* Scenario tones: fault / warn / healthy — idle hint + stronger when active */
.plant-btn--jam {
  border-color: rgba(248, 113, 113, 0.38);
  color: #fecaca;
}
.plant-btn--jam:hover {
  border-color: rgba(248, 113, 113, 0.65);
  color: #fee2e2;
}
.plant-btn--jam.is-active {
  border-color: rgba(248, 113, 113, 0.85);
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
}

.plant-btn--starved {
  border-color: rgba(251, 191, 36, 0.4);
  color: #fde68a;
}
.plant-btn--starved:hover {
  border-color: rgba(251, 191, 36, 0.7);
  color: #fef3c7;
}
.plant-btn--starved.is-active {
  border-color: rgba(251, 191, 36, 0.9);
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
}

.plant-btn--recover {
  border-color: rgba(52, 211, 153, 0.4);
  color: rgb(167 243 208);
}
.plant-btn--recover:hover {
  border-color: rgba(52, 211, 153, 0.7);
  color: rgb(209 250 229);
}
.plant-btn--recover.is-active {
  border-color: rgba(52, 211, 153, 0.85);
  color: rgb(167 243 208);
  background: rgba(52, 211, 153, 0.12);
}
/* Idle recover stays quiet; drop ghost when a local fault makes recover the next action. */
.plant-btn--recover.plant-btn--ghost {
  border-color: rgba(71, 85, 105, 0.85);
  color: rgb(148 163 184);
  background: transparent;
}
.plant-btn--recover.plant-btn--ghost:hover {
  border-color: rgba(52, 211, 153, 0.45);
  color: rgb(167 243 208);
}
.plant-btn--recover:not(.plant-btn--ghost) {
  border-color: rgba(52, 211, 153, 0.75);
  color: rgb(167 243 208);
  background: rgba(52, 211, 153, 0.1);
}

.plant-btn--ghost {
  color: rgb(148 163 184);
}

.plant-btn--accent {
  border-color: rgba(52, 211, 153, 0.4);
  color: rgb(167 243 208);
}

/* Unit control: ISA-88 / PackML state chip + commands. Neutral buttons: they
   are operator commands, not scenario tones. */
.plant-toolbar__group--control {
  padding-right: 0.55rem;
  margin-right: 0.15rem;
  border-right: 1px solid rgb(51 65 85);
}
.plant-unit-state {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.5rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
  color: rgb(226 232 240);
  min-width: 7.2em;
  text-align: center;
}
.plant-unit-state[data-tone="run"] {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.1);
  color: var(--plant-good);
}
.plant-unit-state[data-tone="warn"] {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
}
.plant-unit-state[data-tone="bad"] {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}
.plant-btn--cmd {
  padding-inline: 0.5rem;
}
.plant-toolbar [data-action="reset-line"] {
  margin-left: auto;
}
.plant-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.plant-btn:disabled:hover {
  border-color: rgb(51 65 85);
  color: rgb(203 213 225);
}

.plant-toolbar__sep {
  width: 1px;
  align-self: stretch;
  min-height: 1.4rem;
  background: rgb(51 65 85);
  margin: 0 0.15rem;
}

.plant-mimic__canvas {
  flex: 1;
  padding: 1rem 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.plant-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  padding: 0.15rem 0.1rem 0.55rem;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}

.plant-status__item strong {
  margin-left: 0.3rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgb(226 232 240);
  font-variant-numeric: tabular-nums;
}

.plant-status__item strong[data-tone="bad"] { color: var(--plant-bad); }
.plant-status__item strong[data-tone="warn"] { color: var(--plant-uncertain); }
.plant-status__item strong[data-tone="good"] { color: rgb(241 245 249); }
.plant-status__item strong[data-tone="run"] { color: var(--plant-good); }

.plant-status__sep { color: rgb(51 65 85); }

.plant-pid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(2, 6, 23, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pid-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}

.pid-sheet {
  fill: rgba(2, 6, 23, 0.55);
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1.25;
}
.pid-sheet__rule {
  stroke: rgba(148, 163, 184, 0.28);
  stroke-width: 1;
}
.pid-sheet__head {
  fill: rgb(203 213 225);
  font-size: 11px;
  letter-spacing: 0.14em;
}
.pid-sheet__sub {
  fill: rgb(148 163 184);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.pid-titleblock__box {
  fill: rgba(2, 6, 23, 0.75);
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1;
}
.pid-titleblock__k {
  fill: rgb(100 116 139);
  font-size: 8px;
  letter-spacing: 0.08em;
}
.pid-titleblock__v {
  fill: rgb(226 232 240);
  font-size: 9px;
  letter-spacing: 0.03em;
}
.pid-titleblock__sim {
  fill: var(--color-brand-400);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.pid-flow-label {
  fill: rgb(148 163 184);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.pid-pipe {
  stroke: #94a3b8;
  stroke-width: 2;
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
.pid-pipe--main {
  stroke-width: 2.75;
}
.pid-pipe--divert {
  stroke-dasharray: 5 4;
  stroke-width: 1.75;
  stroke: #94a3b8;
}
.pid-flange {
  stroke: #94a3b8;
  stroke-width: 2;
}
.pid-arrow {
  fill: #94a3b8;
  stroke: none;
}

/* Mixing tank + on/off valves */
.pid-tank {
  cursor: pointer;
}
.pid-tank__shell {
  fill: rgba(2, 6, 23, 0.92);
  stroke: #94a3b8;
  stroke-width: 1.75;
}
.pid-tank__jacket {
  fill: none;
  stroke: rgba(148, 163, 184, 0.45);
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
}
.pid-tank__level {
  fill: rgba(180, 120, 60, 0.45);
  stroke: none;
  transition: y 0.4s ease, height 0.4s ease;
}
.pid-tank__agitator {
  stroke: #94a3b8;
  stroke-width: 1.5;
}
.pid-tank__hub {
  fill: rgba(15, 23, 42, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.pid-tank.is-selected .pid-tank__shell,
.pid-tank.is-hover .pid-tank__shell {
  stroke: var(--color-brand-300);
}

.pid-mix-valve {
  cursor: pointer;
}
.pid-mix-valve__body {
  fill: rgba(2, 6, 23, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.5;
}
.pid-mix-valve.is-fault .pid-mix-valve__body {
  fill: rgba(248, 113, 113, 0.2);
  stroke: #f87171;
}
.pid-mix-valve.is-warn .pid-mix-valve__body {
  fill: rgba(251, 191, 36, 0.18);
  stroke: #fbbf24;
}

.pid-tank.is-fault .pid-tank__shell {
  stroke: #f87171;
}
.pid-tank.is-warn .pid-tank__shell {
  stroke: #fbbf24;
}
.pid-tank.is-fault .pid-tank__level {
  fill: rgba(248, 113, 113, 0.35);
}

.pid-tunnel {
  cursor: pointer;
}
.pid-tunnel__shell {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.75;
}
.pid-tunnel__zone {
  fill: none;
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1;
}
.pid-tunnel__zone-label {
  fill: rgb(148 163 184);
  font-size: 8px;
  letter-spacing: 0.06em;
}
.pid-tunnel__zone-sub {
  fill: rgb(100 116 139);
  font-size: 7px;
  letter-spacing: 0.04em;
}
.pid-tunnel__screw {
  stroke: #94a3b8;
  stroke-width: 2.25;
}
.pid-tunnel__screw-flight {
  stroke: rgba(148, 163, 184, 0.55);
  stroke-width: 1.25;
}
.pid-tunnel.is-selected .pid-tunnel__shell,
.pid-tunnel.is-hover .pid-tunnel__shell {
  stroke: var(--color-brand-300);
}
.pid-tunnel.is-fault .pid-tunnel__shell {
  stroke: #f87171;
}
.pid-tunnel.is-warn .pid-tunnel__shell {
  stroke: #fbbf24;
}
.pid-tunnel__zone.is-warm {
  fill: rgba(248, 113, 113, 0.12);
}
.pid-tunnel__screw.is-stopped {
  stroke: #fbbf24;
  stroke-dasharray: none;
}
.pid-tunnel__screw.is-stopped + .pid-tunnel__screw-flight,
.pid-tunnel:has(.pid-tunnel__screw.is-stopped) .pid-tunnel__screw-flight {
  stroke: rgba(251, 191, 36, 0.55);
}

@media (prefers-reduced-motion: no-preference) {
  .pid-svg.is-running .pid-tunnel__screw:not(.is-stopped) {
    animation: pid-screw 1.6s linear infinite;
  }
}

@keyframes pid-screw {
  from { stroke-dashoffset: 0; stroke-dasharray: 10 8; }
  to { stroke-dashoffset: -36; stroke-dasharray: 10 8; }
}

/* Refining five-roll + moulding machine */
.pid-refiner,
.pid-moulder {
  cursor: pointer;
}
.pid-refiner__shell,
.pid-moulder__shell {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.75;
}
.pid-refiner__roll {
  fill: rgba(15, 23, 42, 0.95);
  stroke: rgba(148, 163, 184, 0.55);
  stroke-width: 1.25;
}
.pid-moulder__cavity {
  fill: rgba(15, 23, 42, 0.85);
  stroke: rgba(148, 163, 184, 0.5);
  stroke-width: 1.1;
}
.pid-refiner.is-selected .pid-refiner__shell,
.pid-refiner.is-hover .pid-refiner__shell,
.pid-moulder.is-selected .pid-moulder__shell,
.pid-moulder.is-hover .pid-moulder__shell {
  stroke: var(--color-brand-300);
}
.pid-refiner.is-fault .pid-refiner__shell,
.pid-moulder.is-fault .pid-moulder__shell,
.pid-tank.is-alarm .pid-tank__shell,
.pid-refiner.is-alarm .pid-refiner__shell,
.pid-moulder.is-alarm .pid-moulder__shell,
.pid-tunnel.is-alarm .pid-tunnel__shell,
.pid-equip.is-alarm .pid-equip__body {
  stroke: #f87171;
}
.pid-refiner.is-warn .pid-refiner__shell,
.pid-moulder.is-warn .pid-moulder__shell {
  stroke: #fbbf24;
}

.pid-cooling {
  cursor: pointer;
}
.pid-cooling.is-warn .pid-pipe {
  stroke: #fbbf24;
}
.pid-cooling.is-warn .pid-flow-label,
.pid-cooling.is-fault .pid-flow-label {
  fill: #fbbf24;
}
.pid-cooling.is-selected .pid-flow-label {
  fill: var(--color-brand-300);
}
.pid-cooling.is-alarm .pid-pipe {
  stroke: #f87171;
}
/* A warning-severity alarm (is-alarm + is-warn) stays amber on every
   equipment type — the red is-alarm rules above must not win. */
.pid-tank.is-alarm.is-warn .pid-tank__shell,
.pid-refiner.is-alarm.is-warn .pid-refiner__shell,
.pid-moulder.is-alarm.is-warn .pid-moulder__shell,
.pid-tunnel.is-alarm.is-warn .pid-tunnel__shell,
.pid-equip.is-alarm.is-warn .pid-equip__body,
.pid-cooling.is-alarm.is-warn .pid-pipe {
  stroke: #fbbf24;
}

.pid-bars-out {
  cursor: pointer;
}
.pid-bars-out__belt {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.5;
}
.pid-bars-out__roller {
  fill: rgba(15, 23, 42, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.25;
}
.pid-bars-out__hatch {
  stroke: rgba(148, 163, 184, 0.55);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.pid-bars-out.is-selected .pid-bars-out__belt {
  stroke: var(--color-brand-300);
}

@media (prefers-reduced-motion: no-preference) {
  .pid-tank.is-alarm .pid-tank__shell,
  .pid-refiner.is-alarm .pid-refiner__shell,
  .pid-moulder.is-alarm .pid-moulder__shell,
  .pid-tunnel.is-alarm .pid-tunnel__shell,
  .pid-equip.is-alarm .pid-equip__body,
  .pid-mix-valve.is-alarm .pid-mix-valve__body {
    animation: pid-alarm-pulse 1.1s ease-in-out infinite;
  }
}

@keyframes pid-alarm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.pid-mix-valve.is-open .pid-mix-valve__body {
  fill: rgba(34, 211, 238, 0.12);
  stroke: #67e8f9;
}

.pid-pipe-flow {
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 6 10;
  fill: none;
  pointer-events: none;
}

.pid-batch {
  cursor: pointer;
}
.pid-batch__k {
  fill: rgb(100 116 139);
  font-size: 8px;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.08em;
}
.pid-batch__v {
  fill: rgb(165 243 252);
  font-size: 11px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 600;
}
.pid-batch.is-selected .pid-batch__v {
  fill: var(--color-brand-300, #67e8f9);
}

.pid-pump__body {
  fill: rgba(2, 6, 23, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.pid-pump__tri {
  fill: #94a3b8;
  stroke: none;
}

@media (prefers-reduced-motion: no-preference) {
  .pid-svg.is-running .pid-pipe-flow {
    animation: pid-flow 1.2s linear infinite;
  }
}

@keyframes pid-flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -16; }
}

/* Monochrome base; only fault/warn tint equipment — not the whole pipe network */
.pid-svg.is-fault .pid-equip--fault .pid-equip__body,
.pid-svg.is-fault .pid-equip--fault .pid-equip__roller {
  stroke: #f87171;
}
.pid-svg.is-warn .pid-equip--warn .pid-equip__body,
.pid-svg.is-warn .pid-equip--warn .pid-equip__roller {
  stroke: #fbbf24;
}

.pid-equip { cursor: pointer; }
.pid-equip__body {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.6;
}
.pid-equip__detail,
.pid-equip__belt,
.pid-equip__hatch {
  fill: none;
  stroke: rgba(148, 163, 184, 0.55);
  stroke-width: 1.1;
}
.pid-equip__hatch { stroke-dasharray: 3 3; }
.pid-equip__roller {
  fill: rgba(2, 6, 23, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.pid-equip__platen {
  fill: rgba(148, 163, 184, 0.08);
  stroke: #94a3b8;
  stroke-width: 1.1;
}
.pid-equip__stack {
  fill: rgba(148, 163, 184, 0.12);
  stroke: #94a3b8;
  stroke-width: 1;
}
.pid-equip__pid {
  fill: #e2e8f0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.pid-equip__name {
  fill: #94a3b8;
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.pid-equip--idle { opacity: 0.72; }
.pid-equip--fault .pid-equip__body { stroke: #f87171; stroke-width: 2; }
.pid-equip--warn .pid-equip__body { stroke: #fbbf24; stroke-width: 1.85; }

.pid-equip.is-selected .pid-equip__body,
.pid-bin.is-selected .pid-bin__body,
.pid-valve.is-selected .pid-valve__body {
  stroke: var(--color-brand-400);
  stroke-width: 2.1;
}

.pid-balloon { cursor: pointer; }
.pid-balloon__ring {
  fill: rgba(2, 6, 23, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.pid-balloon__split {
  stroke: #94a3b8;
  stroke-width: 1.1;
}
.pid-balloon__top,
.pid-balloon__bot {
  fill: #e2e8f0;
  font-size: 8px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.pid-balloon__val {
  fill: #94a3b8;
  font-size: 7.5px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.pid-leader {
  stroke: #64748b;
  stroke-width: 1.1;
  fill: none;
}

.pid-balloon.is-selected .pid-balloon__ring {
  stroke: var(--color-brand-400);
  stroke-width: 2;
}
/* Quality only colors the balloon ring */
.pid-q--good .pid-balloon__ring { stroke: #94a3b8; }
.pid-q--uncertain .pid-balloon__ring { stroke: #fbbf24; }
.pid-q--bad .pid-balloon__ring { stroke: #f87171; }
.pid-q--stale .pid-balloon__ring { stroke: #94a3b8; }
.pid-q--good .pid-balloon__val { fill: #e2e8f0; }
.pid-q--uncertain .pid-balloon__val { fill: #fcd34d; }
.pid-q--bad .pid-balloon__val { fill: #fca5a5; }
.pid-q--stale .pid-balloon__val { fill: #94a3b8; }
.pid-balloon__sp { fill: #94a3b8; font-size: 7px; letter-spacing: 0.04em; pointer-events: none; }
.pid-phase {
  fill: rgb(203 213 225);
  font-size: 9px;
  letter-spacing: 0.18em;
  paint-order: stroke;
  stroke: #020617;
  stroke-width: 3px;
  pointer-events: none;
}

.pid-equip.is-hover .pid-equip__body,
.pid-valve.is-hover .pid-valve__body,
.pid-bin.is-hover .pid-bin__body {
  stroke: var(--color-brand-300);
  stroke-width: 2;
}
.pid-balloon.is-hover .pid-balloon__ring {
  stroke: var(--color-brand-300);
  stroke-width: 1.85;
}
.plant-tag.is-hover {
  background: rgba(34, 211, 238, 0.1);
  color: rgb(241 245 249);
}

.pid-valve { cursor: pointer; }
.pid-valve__body {
  fill: rgba(2, 6, 23, 0.95);
  stroke: #94a3b8;
  stroke-width: 1.5;
}
.pid-valve.is-active .pid-valve__body {
  stroke: #f87171;
  fill: rgba(248, 113, 113, 0.12);
}
.pid-valve__pid,
.pid-mix-valve__pid {
  fill: #94a3b8;
  font-size: 8px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.pid-bin { cursor: pointer; }
.pid-bin__body {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #94a3b8;
  stroke-width: 1.4;
}
.pid-bin__label {
  fill: #94a3b8;
  font-size: 8px;
  letter-spacing: 0.1em;
  pointer-events: none;
}
.pid-bin__count {
  fill: #e2e8f0;
  font-size: 10px;
  pointer-events: none;
}

.plant-detail {
  border-top: 1px solid var(--plant-stroke);
  padding: 0.45rem 0.75rem;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.68rem;
  color: rgb(148 163 184);
}

.plant-detail__empty {
  margin: 0;
  color: rgb(100 116 139);
}

.plant-faceplate {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.55rem 1rem;
  justify-content: space-between;
}

.plant-faceplate__main {
  min-width: 0;
  flex: 1 1 16rem;
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.plant-faceplate__path {
  margin: 0;
  color: var(--color-brand-300);
  word-break: break-all;
  font-size: 0.62rem;
}

.plant-faceplate__row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.plant-faceplate__val {
  color: rgb(226 232 240);
  font-weight: 500;
  font-size: 0.85rem;
}

.plant-faceplate__meta {
  color: rgb(100 116 139);
  font-size: 0.62rem;
}

.plant-faceplate__write {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.plant-faceplate__write-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: rgb(148 163 184);
  font-size: 0.62rem;
}

.plant-faceplate__input {
  width: 4.5rem;
  border: 1px solid var(--plant-stroke);
  background: rgba(2, 6, 23, 0.7);
  color: rgb(226 232 240);
  font: inherit;
  font-size: 0.68rem;
  padding: 0.2rem 0.35rem;
}

.plant-faceplate__unit {
  color: rgb(100 116 139);
}

.plant-faceplate__confirm {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  color: rgb(253 230 138);
}
.plant-faceplate__confirm[hidden] { display: none; }
.plant-faceplate__msg {
  font-size: 0.62rem;
  color: rgb(148 163 184);
}
.plant-faceplate__msg:empty { display: none; }
.plant-faceplate__msg[data-tone="bad"] { color: #fca5a5; }
.plant-faceplate__msg[data-tone="good"] { color: var(--plant-good); }
.plant-faceplate__hint {
  flex-basis: 100%;
  font-size: 0.58rem;
  color: rgb(100 116 139);
}
.plant-faceplate__input:disabled { opacity: 0.6; }

/* Recipe + batch genealogy (faceplate of a BatchId tag) */
.plant-batch-trail__recipe {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: rgb(148 163 184);
  padding: 0.1rem 0.4rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 2px;
}
.plant-recipe { display: grid; gap: 0.25rem; }
.plant-recipe__head,
.plant-gen__head {
  margin: 0;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(100 116 139);
}
.plant-recipe__head strong,
.plant-gen__head strong {
  color: rgb(226 232 240);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.plant-recipe__targets {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.12rem 0.6rem;
  margin: 0;
  font-size: 0.62rem;
}
.plant-recipe__targets dt { color: rgb(100 116 139); }
.plant-recipe__targets dd { margin: 0; color: rgb(203 213 225); }
.plant-gen {
  flex: 1 1 22rem;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  font-size: 0.62rem;
}
.plant-gen__row {
  margin: 0;
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  color: rgb(203 213 225);
}
.plant-gen__k {
  color: rgb(100 116 139);
  text-transform: uppercase;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
}
.plant-gen__route {
  list-style: none;
  margin: 0;
  padding: 0 0 0 2.2rem;
  display: grid;
  gap: 0.1rem;
}
.plant-gen__route li {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.6rem;
  padding-left: 0.8rem;
  color: rgb(203 213 225);
}
/* Route rail: filled for done steps, cyan at the current one, hollow when planned */
.plant-gen__route li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: rgb(148 163 184);
}
.plant-gen__route li[data-status="here"]::before { background: var(--color-brand-400, #22d3ee); box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.25); }
.plant-gen__route li[data-status="planned"] { color: rgb(100 116 139); }
.plant-gen__route li[data-status="planned"]::before { background: transparent; border: 1px solid rgb(71 85 105); }
.plant-gen__equip { min-width: 3.4rem; font-weight: 600; }
.plant-gen__time { color: rgb(100 116 139); font-variant-numeric: tabular-nums; }
.plant-gen__here { color: var(--color-brand-300, #67e8f9); font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.08em; }
li[data-status="planned"] .plant-gen__here { color: rgb(100 116 139); }
.plant-gen__qa { color: rgb(148 163 184); }
.plant-gen__qa[data-ok="false"] { color: #fca5a5; }

/* OEE breakdown + downtime Pareto (faceplate of OEE / A / P / Q) */
.plant-pareto-wrap { display: grid; gap: 0.3rem; }
.plant-pareto__apq {
  margin: 0;
  font-size: 0.64rem;
  color: rgb(100 116 139);
}
.plant-pareto__apq strong { color: rgb(226 232 240); font-weight: 600; font-variant-numeric: tabular-nums; }
.plant-pareto__shift,
.plant-pareto__head {
  margin: 0;
  font-size: 0.58rem;
  color: rgb(100 116 139);
}
.plant-pareto__head { text-transform: uppercase; letter-spacing: 0.08em; }
.plant-pareto {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.6rem;
}
.plant-pareto li {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) 1fr 3.4rem 2.4rem;
  align-items: center;
  gap: 0.5rem;
  color: rgb(203 213 225);
}
.plant-pareto__why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plant-pareto__bar {
  height: 0.5rem;
  background: rgba(51, 65, 85, 0.45);
}
/* Downtime bars stay amber: lost time, not a live fault */
.plant-pareto__bar i {
  display: block;
  height: 100%;
  background: rgba(251, 191, 36, 0.7);
}
.plant-pareto__min,
.plant-pareto__cum {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.plant-pareto__cum { color: rgb(100 116 139); }

/* Event journal (alarm pane, Events view) */
.plant-event {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.64rem;
  color: rgb(203 213 225);
}
.plant-event__time {
  color: rgb(100 116 139);
  font-variant-numeric: tabular-nums;
}
.plant-event__kind {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  padding: 0.05rem 0.3rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 2px;
  color: rgb(148 163 184);
  text-align: center;
}
.plant-event[data-kind="cmd"] .plant-event__kind,
.plant-event[data-kind="sp"] .plant-event__kind {
  border-color: rgba(34, 211, 238, 0.45);
  color: var(--color-brand-300, #67e8f9);
}
.plant-event[data-kind="sim"] .plant-event__kind {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}
.plant-event__text { min-width: 0; overflow-wrap: anywhere; }
.plant-event__area {
  grid-column: 3;
  font-size: 0.56rem;
  color: rgb(100 116 139);
}

/* Trend: historian-style, last plant hour. PV cyan, SP dashed slate, alarm
   limits in their priority colour, markers at alarm activation / RTN. */
.plant-trend {
  flex: 1 1 22rem;
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 0.2rem;
}
.plant-trend__plot {
  height: 118px;
  cursor: crosshair;
  touch-action: pan-y;
}
.plant-trend__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.plant-trend__grid {
  stroke: rgba(51, 65, 85, 0.6);
  stroke-width: 1;
}
.plant-trend__grid--v {
  stroke-dasharray: 2 3;
}
.plant-trend__axis {
  fill: rgb(100 116 139);
  font-size: 9px;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
.plant-trend__pv {
  fill: none;
  stroke: var(--color-brand-300, #67e8f9);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.plant-trend__sp {
  fill: none;
  stroke: rgb(148 163 184);
  stroke-width: 1.1;
  stroke-dasharray: 4 3;
}
.plant-trend__limit {
  stroke-width: 1;
  stroke-dasharray: 6 3;
}
.plant-trend__limit--critical { stroke: rgba(248, 113, 113, 0.75); }
.plant-trend__limit--warning { stroke: rgba(251, 191, 36, 0.75); }
.plant-trend__limit-label {
  font-size: 9px;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}
.plant-trend__limit-label--critical { fill: #fca5a5; }
.plant-trend__limit-label--warning { fill: #fcd34d; }
line.plant-trend__mark {
  stroke-width: 1;
  stroke-dasharray: 1 2;
}
path.plant-trend__mark { stroke: none; }
.plant-trend__mark--on.plant-trend__mark--critical { stroke: #f87171; fill: #f87171; }
.plant-trend__mark--on.plant-trend__mark--warning,
.plant-trend__mark--on.plant-trend__mark--low { stroke: #fbbf24; fill: #fbbf24; }
.plant-trend__mark--off { stroke: rgb(148 163 184); fill: rgb(148 163 184); }
.plant-trend__cursor {
  stroke: rgb(226 232 240);
  stroke-width: 1;
  opacity: 0.55;
}
.plant-trend__dot {
  fill: var(--color-brand-300, #67e8f9);
  stroke: rgb(2 6 23);
  stroke-width: 1;
}
.plant-trend__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.8rem;
  padding-left: 40px;
  font-size: 0.58rem;
  color: rgb(100 116 139);
}
.plant-trend__key::before {
  content: "";
  display: inline-block;
  width: 0.9rem;
  margin-right: 0.3rem;
  vertical-align: middle;
  border-top: 1.5px solid var(--color-brand-300, #67e8f9);
}
.plant-trend__key--sp::before { border-top: 1.5px dashed rgb(148 163 184); }
.plant-trend__key--limit::before { border-top: 1.5px dashed rgba(248, 113, 113, 0.8); }
.plant-trend__readout {
  margin-left: auto;
  color: rgb(226 232 240);
  font-variant-numeric: tabular-nums;
}
.plant-trend__span { margin-left: auto; }

.plant-sparkline {
  width: 100%;
  height: 2rem;
  display: block;
}

.plant-sparkline__line {
  stroke: var(--color-brand-300, #7dd3fc);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.plant-sparkline__empty {
  fill: rgb(100 116 139);
  font-size: 8px;
}

.plant-tree__site-meta {
  margin-left: 0.45rem;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  white-space: nowrap;
}
.plant-tree__site--live > details > summary .plant-tree__site-meta {
  color: rgb(148 163 184);
}
.plant-tree__site--offline.plant-tree__site--spark > details > summary .plant-tree__site-meta {
  color: var(--plant-uncertain);
}

.plant-site-chip {
  margin: 0 0.75rem 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.85);
  color: rgb(148 163 184);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.plant-site-chip.is-flap {
  border-color: rgba(251, 191, 36, 0.45);
  color: rgb(253 230 138);
}
.plant-site-chip.is-offline {
  border-color: rgba(100, 116, 139, 0.5);
  color: rgb(148 163 184);
}

.plant-fleet-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  align-items: stretch;
  margin: 0 0 0.15rem;
}
.plant-site-map {
  border: 1px solid rgba(51, 65, 85, 0.95);
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.35), rgba(2, 6, 23, 0.9)),
    rgba(2, 6, 23, 0.85);
  min-height: 0;
  overflow: hidden;
}
.plant-site-map__svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 11.5rem;
  max-height: 14rem;
}
.plant-site-map__sheet {
  fill: rgba(2, 6, 23, 0.35);
  stroke: rgba(51, 65, 85, 0.9);
  stroke-width: 1;
}
.plant-site-map__title {
  fill: rgb(226 232 240);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}
.plant-site-map__rule {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 1;
}
.plant-site-map__caption {
  fill: rgb(100 116 139);
  font-size: 7px;
  letter-spacing: 0.12em;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}
.plant-site-map__sea-label {
  fill: rgba(56, 189, 248, 0.45);
  font-size: 6.5px;
  letter-spacing: 0.18em;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
}
.plant-site-map__land {
  fill: rgba(30, 41, 59, 0.72);
  stroke: rgba(100, 116, 139, 0.75);
  stroke-width: 1.1;
}
.plant-site-map__link {
  stroke: rgba(71, 85, 105, 0.55);
  stroke-width: 1.15;
  stroke-linecap: round;
}
.plant-site-map__link.is-up {
  stroke: rgba(52, 211, 153, 0.55);
  stroke-width: 1.4;
}
.plant-site-map__link.is-flap {
  stroke: rgba(251, 191, 36, 0.7);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}
.plant-site-map__link.is-down {
  stroke: rgba(71, 85, 105, 0.4);
  stroke-width: 1;
  stroke-dasharray: 2.5 3.5;
}
.plant-site-map__hit {
  fill: transparent;
  cursor: pointer;
}
.plant-site-map__ring {
  fill: none;
  stroke: rgba(71, 85, 105, 0.7);
  stroke-width: 1;
  pointer-events: none;
}
.plant-site-map__dot {
  fill: rgb(71 85 105);
  stroke: rgb(148 163 184);
  stroke-width: 1.1;
  pointer-events: none;
}
.plant-site-map__slash {
  fill: none;
  stroke: rgb(226 232 240);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0;
  pointer-events: none;
}
.plant-site-map__leader {
  stroke: rgba(71, 85, 105, 0.7);
  stroke-width: 0.9;
  pointer-events: none;
}
.plant-site-map__plate {
  fill: rgba(15, 23, 42, 0.92);
  stroke: rgba(71, 85, 105, 0.85);
  stroke-width: 0.9;
  pointer-events: none;
}
.plant-site-map__label {
  fill: rgb(226 232 240);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  pointer-events: none;
}
.plant-site-map__badge {
  fill: rgb(148 163 184);
  font-size: 6.5px;
  letter-spacing: 0.12em;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  pointer-events: none;
}
.plant-site-map__node.is-home .plant-site-map__ring {
  stroke: rgba(52, 211, 153, 0.7);
  stroke-width: 1.4;
}
.plant-site-map__node.is-home .plant-site-map__dot {
  fill: rgba(16, 185, 129, 0.95);
  stroke: rgba(167, 243, 208, 0.95);
}
.plant-site-map__node.is-home .plant-site-map__badge { fill: var(--plant-good); }
.plant-site-map__node.is-home .plant-site-map__plate {
  stroke: rgba(52, 211, 153, 0.45);
}
.plant-site-map__node.is-flap .plant-site-map__ring {
  stroke: rgba(251, 191, 36, 0.75);
}
.plant-site-map__node.is-flap .plant-site-map__dot {
  fill: rgba(245, 158, 11, 0.95);
  stroke: rgba(253, 230, 138, 0.95);
}
.plant-site-map__node.is-flap .plant-site-map__badge { fill: var(--plant-uncertain); }
.plant-site-map__node.is-flap .plant-site-map__plate {
  stroke: rgba(251, 191, 36, 0.45);
}
.plant-site-map__node.is-offline .plant-site-map__ring {
  stroke: rgba(100, 116, 139, 0.7);
  stroke-dasharray: 2.5 2;
}
.plant-site-map__node.is-offline .plant-site-map__dot {
  fill: rgb(30 41 59);
  stroke: rgb(100 116 139);
}
.plant-site-map__node.is-offline .plant-site-map__slash { opacity: 1; }
.plant-site-map__node.is-offline .plant-site-map__label { fill: rgb(148 163 184); }
.plant-site-map__node.is-offline .plant-site-map__badge { fill: rgb(148 163 184); }
.plant-site-map__node.is-selected .plant-site-map__hit {
  stroke: rgba(56, 189, 248, 0.75);
  stroke-width: 1.4;
  fill: rgba(56, 189, 248, 0.07);
}
.plant-site-map__node.is-selected .plant-site-map__plate {
  stroke: rgba(56, 189, 248, 0.65);
}
.plant-site-map__node:focus-visible .plant-site-map__hit {
  stroke: rgba(148, 163, 184, 0.85);
  stroke-width: 1.2;
}
.plant-site-map__node:hover .plant-site-map__plate {
  stroke: rgba(148, 163, 184, 0.75);
}

.plant-fleet {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0;
  min-width: 0;
}
.plant-fleet__cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.45rem 0.5rem 0.5rem;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: 2px;
  background: rgba(2, 6, 23, 0.72);
  color: rgb(148 163 184);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  min-width: 0;
}
.plant-fleet__cell:hover,
.plant-fleet__cell:focus-visible {
  border-color: rgba(148, 163, 184, 0.55);
  outline: none;
}
.plant-fleet__cell.is-selected {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}
.plant-fleet__cell.is-home {
  border-color: rgba(52, 211, 153, 0.35);
}
.plant-fleet__cell.is-offline {
  opacity: 0.72;
  color: rgb(100 116 139);
}
.plant-fleet__cell.is-flap {
  border-color: rgba(251, 191, 36, 0.45);
  color: rgb(226 232 240);
}
.plant-fleet__head {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
}
.plant-fleet__mark-wrap {
  flex: 0 0 auto;
  display: inline-flex;
  color: inherit;
}
.plant-fleet__mark {
  width: 0.85rem;
  height: 0.85rem;
  display: block;
}
.plant-fleet__cell.is-home .plant-fleet__mark-wrap { color: var(--plant-good); }
.plant-fleet__cell.is-flap .plant-fleet__mark-wrap { color: var(--plant-uncertain); }
.plant-fleet__cell.is-offline .plant-fleet__mark-wrap { color: var(--plant-stale); }
.plant-fleet__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(226 232 240);
}
.plant-fleet__cell.is-offline .plant-fleet__name {
  color: rgb(148 163 184);
}
.plant-fleet__badge {
  flex: 0 0 auto;
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  padding: 0.05rem 0.25rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 2px;
  color: var(--plant-stale);
}
.plant-fleet__cell.is-home .plant-fleet__badge {
  color: var(--plant-good);
  border-color: rgba(52, 211, 153, 0.35);
}
.plant-fleet__cell.is-flap .plant-fleet__badge {
  color: var(--plant-uncertain);
  border-color: rgba(251, 191, 36, 0.45);
}
.plant-fleet__mode {
  font-size: 0.68rem;
  font-weight: 500;
  color: rgb(226 232 240);
  letter-spacing: 0.02em;
}
.plant-fleet__cell.is-offline .plant-fleet__mode {
  color: rgb(148 163 184);
}
.plant-fleet__oee,
.plant-fleet__contact {
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .plant-site-map__svg {
    min-height: 10.5rem;
    max-height: 12.5rem;
  }
  .plant-fleet {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .plant-fleet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.plant-faceplate__note--flap {
  color: rgb(253 230 138);
}

/* Overview P&ID */
.pid-overview__box {
  fill: rgba(2, 6, 23, 0.9);
  stroke: #64748b;
  stroke-width: 1.5;
}

.pid-overview__area {
  cursor: pointer;
}

.pid-overview__area:focus-visible .pid-overview__box,
.pid-overview__area:hover .pid-overview__box {
  stroke: #94a3b8;
}

.pid-overview__label {
  fill: #e2e8f0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.pid-overview__health {
  fill: #94a3b8;
  font-size: 9px;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.pid-overview__hint {
  fill: #64748b;
  font-size: 7px;
  letter-spacing: 0.14em;
  pointer-events: none;
}

.pid-overview__area.is-run .pid-overview__box {
  stroke: #64748b;
}

.pid-overview__area.is-run .pid-overview__health {
  fill: #34d399;
}

.pid-overview__area.is-warn .pid-overview__box,
.pid-overview__area.is-hold .pid-overview__box,
.pid-overview__area.is-starved .pid-overview__box {
  stroke: #fbbf24;
}

.pid-overview__area.is-warn .pid-overview__health,
.pid-overview__area.is-hold .pid-overview__health,
.pid-overview__area.is-starved .pid-overview__health {
  fill: #fbbf24;
}

.pid-overview__finish {
  fill: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.plant-faceplate__note {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  line-height: 1.35;
  color: rgb(148 163 184);
}

.pid-overview__area.is-fault .pid-overview__box {
  stroke: #f87171;
}

.pid-overview__area.is-fault .pid-overview__health {
  fill: #f87171;
}

.pid-overview__area.is-batch .pid-overview__box {
  fill: rgba(14, 116, 144, 0.35);
  stroke-width: 2;
}

.pid-overview__area.is-batch .pid-overview__hint {
  fill: #7dd3fc;
}

.plant-noscript {
  padding: 2rem 1rem;
  text-align: center;
  color: rgb(148 163 184);
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.8rem;
}

/* ---- Alarms ---- */
.plant-alarm-tools {
  display: grid;
  gap: 0.3rem;
  padding: 0.4rem 0.55rem 0.15rem;
  border-bottom: 1px solid var(--plant-stroke);
}

.plant-alarm-tools__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.plant-alarm-tools .plant-btn {
  font-size: 0.55rem;
  padding: 0.15rem 0.4rem;
}

.plant-alarm-tools .plant-btn.is-active {
  color: rgb(226 232 240);
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(14, 116, 144, 0.25);
}

.plant-alarms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.plant-alarm {
  border: 1px solid var(--plant-stroke);
  border-radius: 0.35rem;
  padding: 0.5rem 0.55rem;
  background: rgba(2, 6, 23, 0.45);
  cursor: pointer;
}

.plant-alarm:focus-visible {
  outline: 1px solid rgba(125, 211, 252, 0.7);
  outline-offset: 1px;
}

.plant-alarm[data-sev="critical"] {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.07);
}

.plant-alarm[data-sev="warning"] {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.06);
}

.plant-alarm.is-acked {
  opacity: 0.55;
}

.plant-alarm--history {
  cursor: pointer;
  opacity: 0.75;
  border-style: dashed;
}

.plant-alarm__top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.plant-alarm__top .font-mono {
  margin-left: auto;
}

.plant-alarm__sev {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--plant-bad);
}

.plant-alarm[data-sev="warning"] .plant-alarm__sev {
  color: var(--plant-uncertain);
}

.plant-alarm__firstout {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f172a;
  background: #f87171;
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
}
.plant-alarm[data-sev="warning"] .plant-alarm__firstout {
  background: var(--plant-uncertain);
}

.plant-alarm__badge {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(148 163 184);
  border: 1px solid var(--plant-stroke);
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
}

/* The message is the row's keyboard target (a real button, so the row holds no nested controls) */
.plant-alarm__msg {
  display: block;
  width: 100%;
  margin: 0.3rem 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  color: rgb(226 232 240);
  line-height: 1.35;
  cursor: pointer;
}
.plant-alarm__msg:focus-visible {
  outline: 2px solid var(--color-brand-400);
  outline-offset: 2px;
}

.plant-alarm__path {
  margin: 0.2rem 0 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.58rem;
  color: rgb(100 116 139);
  word-break: break-all;
}

.plant-alarm__ack {
  margin-top: 0.4rem;
}

.plant-alarms-empty {
  padding: 0.75rem 0.5rem;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.68rem;
  color: rgb(100 116 139);
  text-align: center;
}

.plant-alarm-count {
  font-variant-numeric: tabular-nums;
  color: rgb(226 232 240);
}

@media (prefers-reduced-motion: reduce) {
  .plant-scan__dot,
  .pid-pipe-flow {
    animation: none !important;
  }
}


/* ---------------------------------------------------------------
   Responsive layout
   ≥1280  tree | drawing | alarms (three columns)
   1024–1279  tree | drawing, alarms under the drawing (more width
              for the P&ID, which is the point of the page)
   <1024  one column: drawing first, then alarms, then the tag
          browser (collapsed behind "Show tags"); the P&ID keeps a
          readable 860px and scrolls sideways
   --------------------------------------------------------------- */
.plant-tree-toggle,
.plant-pid-hint { display: none; }

@media (min-width: 1024px) and (max-width: 1279px) {
  /* The page scrolls here instead of squeezing the P&ID into a short
     row: the drawing takes its full width, alarms follow it, and the
     tree stays pinned beside them. */
  .plant-page { height: auto; overflow: visible; }
  .plant-shell { height: auto; min-height: 100dvh; }
  .plant-body {
    --plant-rail: 14.5rem;
    grid-template-columns: var(--plant-rail) minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .plant-pane--tree {
    grid-row: 1 / span 2;
    align-self: start;
    position: sticky;
    top: 3rem;
    max-height: calc(100dvh - 3rem);
  }
  .plant-mimic { grid-column: 2; grid-row: 1; }
  .plant-pane--alarms {
    grid-column: 2;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid var(--plant-stroke);
  }
  .plant-pid { display: block; }
  .plant-pid .pid-svg { height: auto; max-height: none; }
}

@media (max-width: 1023px) {
  /* minmax(0, …): the 860px drawing scrolls inside its box instead of
     widening the whole column (and the page) */
  .plant-body { grid-template-columns: minmax(0, 1fr); }
  .plant-pane, .plant-mimic__canvas { min-width: 0; }
  .plant-mimic { order: 1; }
  .plant-pane--alarms { order: 2; }
  .plant-pane--tree { order: 3; }

  .plant-tree-toggle {
    display: inline-flex;
    margin-left: auto;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgb(51 65 85);
    background: transparent;
    color: var(--color-brand-300);
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
  }
  .plant-tree-toggle:focus-visible { outline: 2px solid var(--color-brand-400); outline-offset: 2px; }
  .plant-pane--tree .plant-pane__head-row { align-items: center; gap: 0.75rem; }
  .plant-pane--tree:not(.is-open) .plant-pane__body,
  .plant-pane--tree:not(.is-open) .plant-q-legend { display: none; }

  .plant-pid {
    display: block;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .plant-pid .pid-svg {
    width: 860px;
    min-width: 860px;
    max-width: none;
    height: auto;
    max-height: none;
  }
}
@media (max-width: 899px) {
  .plant-pid-hint {
    display: block;
    margin: 0.35rem 0 0;
    font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
    font-size: 0.625rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(148 163 184);
  }
}

/* Names sit on a dark halo so a pipe or leader passing behind never cuts
   through the text (e.g. the reject line under CHECKWEIGHER). */
.pid-equip__name,
.pid-flow-label {
  paint-order: stroke;
  stroke: #020617;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.plant-faceplate__sp {
  margin: 0.35rem 0 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.68rem;
  color: rgb(148 163 184);
}
.plant-faceplate__sp strong { color: rgb(226 232 240); font-weight: 500; }

/* ISA-18.2 alarm list details */
.plant-alarm[data-sev="low"] .plant-alarm__sev { color: #7dd3fc; }
.plant-alarm__state {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  padding: 0.05rem 0.28rem;
  border-radius: 2px;
  border: 1px solid rgb(51 65 85);
  color: rgb(203 213 225);
}
.plant-alarm__time {
  margin-left: auto;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.625rem;
  color: rgb(148 163 184);
  font-variant-numeric: tabular-nums;
}
.plant-alarm.is-rtn { opacity: 0.72; border-style: dashed; }
.plant-alarm.is-rtn .plant-alarm__state { color: var(--plant-uncertain); border-color: rgba(251, 191, 36, 0.4); }
.plant-alarm__supp {
  margin: 0.3rem 0 0;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.6rem;
  color: rgb(148 163 184);
}
.plant-alarm__ack { display: flex; gap: 0.35rem; }

/* Site bar: the case-study link yields to the SIM badge on phones */
@media (max-width: 639px) {
  .plant-site-bar__how { display: none; }
}

/* ---------------- Guided tour ---------------- */
.plant-tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  appearance: none;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.08);
  color: var(--color-brand-300, #67e8f9);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.2;
}
.plant-tour-btn svg { width: 0.6rem; height: 0.6rem; fill: currentColor; }
.plant-tour-btn:hover { border-color: rgba(34, 211, 238, 0.8); color: rgb(207 250 254); }
.plant-tour-btn:focus-visible { outline: 2px solid var(--color-brand-400); outline-offset: 1px; }

/* First-visit hint: an inline chip beside the Tour button; never opens anything by itself */
.plant-tour-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.1rem 0 0.5rem;
  border: 1px dashed rgba(34, 211, 238, 0.45);
  border-radius: 3px;
  white-space: nowrap;
}
.plant-tour-hint__go,
.plant-tour-hint__close {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.plant-tour-hint__go { color: rgb(207 250 254); padding: 0.15rem 0; }
.plant-tour-hint__go:hover { color: #fff; text-decoration: underline; text-underline-offset: 0.2em; }
.plant-tour-hint__close { color: rgb(148 163 184); font-size: 0.9rem; line-height: 1; padding: 0.1rem 0.35rem; }
.plant-tour-hint__close:hover { color: rgb(226 232 240); }

/* Spotlight: the target stays lit, everything around it dims (the shadow is not clickable) */
.plant-tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.plant-tour__spot {
  position: fixed;
  border-radius: 0.4rem;
  outline: 2px solid var(--color-brand-400, #22d3ee);
  outline-offset: 0;
  box-shadow: 0 0 0 200vmax rgba(2, 6, 23, 0.62);
}
.plant-tour__card {
  position: fixed;
  width: min(23rem, calc(100vw - 16px));
  pointer-events: auto;
  padding: 0.9rem 1rem 0.85rem;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 0.5rem;
  background: rgb(6 13 28);
  box-shadow: 0 16px 48px rgba(2, 6, 23, 0.75);
  color: rgb(203 213 225);
  font-size: 0.8rem;
  line-height: 1.55;
}
.plant-tour__eyebrow {
  display: flex;
  justify-content: space-between;
  margin: 0 0 0.35rem;
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand-300, #67e8f9);
}
.plant-tour__eyebrow span + span { color: rgb(148 163 184); font-variant-numeric: tabular-nums; }
.plant-tour__title {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: rgb(241 245 249);
  outline: none;
}
.plant-tour__body p { margin: 0 0 0.5rem; }
.plant-tour__body strong { color: rgb(241 245 249); font-weight: 600; }
.plant-tour__body a { color: var(--color-brand-300); text-decoration: underline; text-underline-offset: 0.2em; }
.plant-tour__wait {
  font-family: var(--font-mono, "JetBrains Mono"), ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fcd34d;
}
.plant-tour__checklist { margin: 0 0 0.5rem; padding-left: 1.3rem; }
.plant-tour__checklist li { margin: 0.15rem 0; }
.plant-tour__checklist li span { color: rgb(100 116 139); }
.plant-tour__checklist li.is-done { color: rgb(100 116 139); text-decoration: line-through; }
.plant-tour__checklist li.is-done::marker { color: var(--plant-good); }
.plant-tour__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.plant-tour__close { margin-left: auto; }
/* Phones: the card docks at the bottom, the spotlight still marks the target */
body.plant-tour-docked { padding-bottom: 60vh; }
.plant-tour.is-docked .plant-tour__card {
  left: 8px !important;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  top: auto !important;
  width: auto;
  max-height: 55vh;
  overflow-y: auto;
}
