:root {
  --bg: #030d1d;
  --bg-2: #06172b;
  --panel: rgba(5, 25, 46, 0.86);
  --panel-2: rgba(5, 30, 55, 0.82);
  --line: rgba(24, 136, 203, 0.38);
  --line-bright: rgba(33, 193, 255, 0.84);
  --cyan: #18d9fb;
  --cyan-soft: #7ae8ff;
  --blue: #39bff5;
  --green: #2de7a9;
  --yellow: #ffc94f;
  --red: #ff5269;
  --amber: #efa93f;
  --text: #d4edff;
  --muted: #6e9bb8;
  --muted-2: #466d8a;
  --number: "Bahnschrift", "DIN Alternate", "Roboto Mono", "Microsoft YaHei", monospace;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 51% 4%, rgba(10, 91, 151, 0.25), transparent 31%),
    radial-gradient(circle at 94% 88%, rgba(0, 169, 127, 0.08), transparent 27%),
    linear-gradient(145deg, #020915 0%, #05152b 52%, #020b18 100%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body.drawer-open {
  overscroll-behavior: none;
}

button {
  color: inherit;
  font: inherit;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.screen-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 136, 194, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 136, 194, 0.026) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 92%);
}

.screen-atmosphere::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(100deg, transparent 30%, rgba(55, 210, 255, 0.025) 50%, transparent 70%);
  animation: atmosphere-scan 8s linear infinite;
}

.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  min-height: 768px;
  padding: 0 14px 12px;
}

.topbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(500px, 1.5fr) minmax(300px, 1fr);
  align-items: center;
  flex: 0 0 64px;
  border-bottom: 1px solid rgba(31, 174, 243, 0.34);
  background: linear-gradient(180deg, rgba(7, 38, 67, 0.84), rgba(3, 16, 33, 0.24));
}

.topbar::before,
.topbar::after {
  position: absolute;
  bottom: -1px;
  width: 30%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.72;
}

.topbar::before {
  left: 10%;
}

.topbar::after {
  right: 10%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
}

.brand-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(34, 220, 255, 0.55);
  background: linear-gradient(135deg, rgba(22, 223, 255, 0.18), rgba(39, 238, 171, 0.06));
  box-shadow: inset 0 0 16px rgba(24, 217, 251, 0.1), 0 0 12px rgba(24, 217, 251, 0.12);
  transform: rotate(45deg);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  color: var(--green);
  transform: rotate(-45deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  color: #dffbff;
  font-family: var(--number);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.title-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 21px;
}

.title-lockup h1 {
  margin: 0;
  color: #eefcff;
  font-size: clamp(23px, 1.63vw, 32px);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-shadow: 0 0 16px rgba(51, 205, 255, 0.42), 0 2px 1px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.title-lockup i {
  position: relative;
  width: clamp(58px, 6vw, 108px);
  height: 8px;
  border-top: 1px solid rgba(30, 195, 250, 0.42);
  border-bottom: 1px solid rgba(30, 195, 250, 0.11);
}

.title-lockup i::before,
.title-lockup i::after {
  position: absolute;
  top: 2px;
  width: 42%;
  height: 2px;
  content: "";
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.title-lockup i::before {
  right: 0;
}

.title-lockup i::after {
  left: 0;
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-right: 11px;
  color: #93bbd4;
  font-size: 11px;
  white-space: nowrap;
}

.topbar-meta time {
  display: inline-flex;
  gap: 12px;
  color: #bfe5f8;
  font-family: var(--number);
  font-size: 13px;
  letter-spacing: 0.035em;
}

.topbar-meta b {
  color: var(--cyan);
  font-family: var(--number);
  font-size: 19px;
}

.meta-divider {
  width: 1px;
  height: 15px;
  background: rgba(100, 174, 211, 0.3);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(185px, 1.1fr);
  gap: 7px;
  flex: 0 0 103px;
  padding: 10px 0 8px;
}

.metric-card,
.panel {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(10, 46, 74, 0.52), rgba(3, 20, 39, 0.32)),
    var(--panel);
  box-shadow:
    inset 0 0 32px rgba(0, 105, 158, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.25);
}

.metric-card::before,
.panel::before,
.metric-card::after,
.panel::after {
  position: absolute;
  z-index: 2;
  width: 9px;
  height: 9px;
  pointer-events: none;
  content: "";
}

.metric-card::before,
.panel::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--cyan);
  border-left: 2px solid var(--cyan);
}

.metric-card::after,
.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid rgba(25, 167, 230, 0.8);
  border-bottom: 2px solid rgba(25, 167, 230, 0.8);
}

.metric-card {
  min-width: 0;
  overflow: hidden;
  padding: 10px 12px 8px;
  background:
    radial-gradient(ellipse at 90% 100%, rgba(16, 129, 192, 0.16), transparent 54%),
    linear-gradient(180deg, rgba(8, 35, 59, 0.92), rgba(3, 18, 34, 0.91));
}

.metric-card::selection {
  background: var(--cyan);
}

.metric-card:hover {
  border-color: rgba(46, 197, 252, 0.61);
}

.metric-card .metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #98c4dc;
  font-size: 11px;
  white-space: nowrap;
}

.metric-head svg {
  width: 15px;
  height: 15px;
  color: rgba(79, 192, 234, 0.64);
  stroke-width: 1.3;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 2px;
  font-family: var(--number);
}

.metric-value b {
  color: #e6fbff;
  font-size: clamp(28px, 2.1vw, 37px);
  font-weight: 500;
  letter-spacing: -0.03em;
  text-shadow: 0 0 13px rgba(51, 210, 255, 0.2);
  transition: color 0.25s ease, transform 0.25s ease;
}

.metric-value b.bump {
  color: var(--cyan-soft);
  transform: translateY(-2px);
}

.metric-value small {
  color: #789fb7;
  font-size: 11px;
}

.metric-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6689a1;
  font-size: 9px;
  white-space: nowrap;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--number);
  font-size: 10px;
}

.trend svg {
  width: 9px;
  height: 9px;
  stroke-width: 1.9;
}

.trend.up {
  color: var(--green);
}

.trend.down {
  color: var(--red);
}

.trend em {
  font-style: normal;
}

.metric-progress {
  position: absolute;
  right: 11px;
  bottom: 8px;
  left: 12px;
  height: 2px;
  overflow: hidden;
  background: rgba(32, 99, 131, 0.32);
}

.metric-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(19, 138, 186, 0.08), var(--blue));
  box-shadow: 0 0 7px var(--blue);
  transition: width 1s ease;
}

.online-card {
  padding-right: 11px;
}

.online-main {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 4px;
}

.online-main > b {
  color: var(--green);
  font-family: var(--number);
  font-size: 29px;
  font-weight: 500;
  text-shadow: 0 0 14px rgba(45, 231, 169, 0.23);
}

.online-split {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #678da5;
  font-family: var(--number);
  font-size: 9px;
  white-space: nowrap;
}

.online-split em {
  color: #bfe9f7;
  font-style: normal;
}

.online-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: #829eb1;
  font-size: 9px;
}

.online-status > i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
}

.online-status b {
  color: var(--green);
  font-family: var(--number);
  font-weight: 400;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(303px, 18.35%) minmax(0, 1fr) minmax(360px, 21.25%);
  gap: 8px;
  min-height: 0;
  flex: 1;
}

.column {
  display: grid;
  min-width: 0;
  min-height: 0;
  gap: 8px;
}

.left-column {
  grid-template-rows: 1.6fr 1.32fr 0.9fr;
}

.center-column {
  grid-template-rows: minmax(330px, 1.56fr) minmax(260px, 1fr);
}

.right-column {
  grid-template-rows: 1.17fr 1fr 0.86fr 1.08fr;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 35px;
  padding: 0 11px;
  border-bottom: 1px solid rgba(29, 125, 175, 0.3);
  background: linear-gradient(90deg, rgba(13, 64, 99, 0.52), rgba(4, 23, 42, 0.1));
}

.panel-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.panel-title > i {
  position: relative;
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--cyan), #1273af);
  box-shadow: 0 0 7px rgba(24, 217, 251, 0.58);
}

.panel-title > i::after {
  position: absolute;
  top: -3px;
  left: 2px;
  width: 9px;
  height: 1px;
  content: "";
  background: rgba(24, 217, 251, 0.45);
}

.panel-title h2 {
  overflow: hidden;
  margin: 0;
  color: #d2f1ff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-extra {
  flex-shrink: 0;
  color: #6c98b0;
  font-size: 9px;
  white-space: nowrap;
}

.panel-extra b {
  color: #c7efff;
  font-family: var(--number);
  font-weight: 500;
}

.panel-extra em {
  color: var(--green);
  font-style: normal;
}

.warning-text {
  color: var(--yellow);
}

.warning-text b {
  color: var(--yellow);
}

.good-text {
  color: var(--green);
}

.good-text > i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.device-list,
.alert-list {
  height: calc(100% - 35px);
  overflow: hidden;
}

.device-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  height: calc(100% / 6);
  min-height: 39px;
  padding: 5px 10px 5px 13px;
  border-bottom: 1px solid rgba(39, 109, 147, 0.18);
  background: linear-gradient(90deg, rgba(12, 58, 89, 0.4), transparent 82%);
  transition: background 0.25s ease;
}

.device-item::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 4px;
  width: 2px;
  content: "";
  background: transparent;
}

.device-item:hover {
  background: linear-gradient(90deg, rgba(18, 88, 130, 0.56), transparent 88%);
}

.device-item.alarm::before {
  background: var(--red);
  box-shadow: 0 0 9px var(--red);
}

.device-name {
  overflow: hidden;
  color: #c2e4f5;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-name span {
  margin-left: 4px;
  color: #577e96;
  font-size: 9px;
}

.device-detail {
  grid-column: 1;
  overflow: hidden;
  margin-top: 2px;
  color: #5f8ba1;
  font-family: var(--number);
  font-size: 9px;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-detail b {
  color: #8fbfd5;
  font-weight: 400;
}

.status-pill {
  align-self: center;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 38px;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 9px;
  text-align: center;
}

.status-pill.running {
  border-color: rgba(45, 231, 169, 0.5);
  color: var(--green);
  background: rgba(45, 231, 169, 0.09);
}

.status-pill.warning {
  border-color: rgba(255, 201, 79, 0.58);
  color: var(--yellow);
  background: rgba(255, 201, 79, 0.1);
}

.status-pill.alarm {
  border-color: rgba(255, 82, 105, 0.65);
  color: #ff8495;
  background: rgba(255, 82, 105, 0.12);
  animation: alarm-pulse 1.6s infinite;
}

.alert-counters {
  display: flex;
  gap: 8px;
  color: #648ca2;
  font-size: 9px;
}

.alert-counters b {
  color: var(--cyan);
  font-family: var(--number);
  font-size: 11px;
  font-weight: 500;
}

.alert-item {
  position: relative;
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 35px;
  padding: 4px 9px;
  border-bottom: 1px solid rgba(38, 106, 144, 0.15);
  animation: alert-enter 0.4s ease both;
}

.alert-item.fresh {
  background: linear-gradient(90deg, rgba(15, 100, 145, 0.3), transparent);
}

.alert-tag {
  width: max-content;
  padding: 2px 5px;
  border: 1px solid;
  font-size: 8px;
}

.alert-item.alarm .alert-tag {
  border-color: rgba(255, 82, 105, 0.42);
  color: #ff7185;
  background: rgba(255, 82, 105, 0.08);
}

.alert-item.warning .alert-tag {
  border-color: rgba(255, 201, 79, 0.4);
  color: var(--yellow);
  background: rgba(255, 201, 79, 0.07);
}

.alert-item.order .alert-tag {
  border-color: rgba(57, 191, 245, 0.42);
  color: #63d5ff;
  background: rgba(57, 191, 245, 0.08);
}

.alert-content {
  overflow: hidden;
  padding: 0 6px;
  color: #9dbfd1;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-time {
  color: #517990;
  font-family: var(--number);
  font-size: 8px;
  white-space: nowrap;
}

.inventory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100% - 35px);
  padding: 6px 9px;
  gap: 4px 10px;
}

.inventory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 3px 7px;
  background: linear-gradient(90deg, rgba(9, 52, 79, 0.4), transparent);
}

.inventory-name {
  overflow: hidden;
  color: #7ba2b8;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-value {
  flex-shrink: 0;
  color: #d0edf8;
  font-family: var(--number);
  font-size: 15px;
}

.inventory-value small {
  margin-left: 2px;
  color: #60879d;
  font-size: 8px;
}

.inventory-item.low .inventory-value {
  color: var(--yellow);
}

.inventory-item.low .inventory-value::after {
  margin-left: 3px;
  color: var(--yellow);
  font-size: 8px;
  content: "↓";
}

.process-panel .panel-head {
  min-height: 36px;
}

.process-note {
  color: #557d93;
}

.process-canvas {
  position: relative;
  height: calc(100% - 36px);
  overflow: hidden;
  background:
    linear-gradient(rgba(18, 113, 163, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 113, 163, 0.035) 1px, transparent 1px);
  background-size: 25px 25px;
}

.process-canvas::after {
  position: absolute;
  right: 4%;
  bottom: 5%;
  width: 47%;
  height: 58%;
  pointer-events: none;
  border: 1px solid rgba(25, 135, 178, 0.09);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 50px rgba(0, 137, 189, 0.04);
}

.process-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.process-links .link-bases path {
  stroke: rgba(32, 132, 173, 0.36);
  stroke-width: 1.4;
}

.process-links .link-bases .return-path {
  stroke-dasharray: 4 5;
  stroke: rgba(232, 167, 63, 0.28);
}

.process-links .link-bases .aux-path {
  stroke-dasharray: 3 5;
  stroke: rgba(40, 171, 214, 0.22);
}

.process-links .link-flows path {
  stroke: url("#flowGradient");
  stroke-width: 2;
  stroke-dasharray: 7 18;
  filter: url("#glow");
  animation: flow-line 1.2s linear infinite;
}

.process-links .link-flows .return-path {
  stroke: url("#flowAmber");
  stroke-dasharray: 3 17;
  animation-duration: 2.1s;
}

.process-links .flow-particles circle {
  fill: #bff9ff;
  stroke: #24dfff;
  stroke-width: 1;
  filter: url("#glow");
}

.process-links .flow-particles .amber-particle {
  fill: #ffe2a4;
  stroke: #e5a337;
}

.process-node {
  position: absolute;
  top: var(--y);
  left: var(--x);
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: var(--w);
  height: var(--h);
  min-height: 66px;
  padding: 8px 11px;
  overflow: hidden;
  border: 1px solid rgba(36, 170, 229, 0.55);
  background:
    linear-gradient(135deg, rgba(15, 68, 103, 0.87), rgba(5, 27, 48, 0.96)),
    var(--panel);
  box-shadow: inset 0 0 20px rgba(19, 143, 198, 0.08), 0 0 13px rgba(11, 126, 190, 0.11);
  text-align: left;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.process-node::before,
.process-node::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.process-node::before {
  top: 0;
  left: 0;
  width: 38%;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 7px var(--cyan);
}

.process-node::after {
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
}

.process-node:hover,
.process-node:focus-visible {
  border-color: rgba(80, 227, 255, 0.9);
  outline: none;
  background: linear-gradient(135deg, rgba(22, 92, 132, 0.92), rgba(5, 32, 55, 0.98));
  box-shadow: inset 0 0 22px rgba(28, 177, 231, 0.16), 0 0 19px rgba(21, 191, 240, 0.2);
}

.process-node.fault {
  border-color: var(--red);
  animation: fault-border 0.8s infinite alternate;
}

.node-kicker {
  overflow: hidden;
  margin-bottom: 3px;
  color: #4f819d;
  font-family: var(--number);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-node > strong {
  margin-bottom: 4px;
  color: #dcf8ff;
  font-size: clamp(11px, 0.74vw, 14px);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.process-node > span:not(.node-kicker) {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  color: #56849c;
  font-size: 8px;
  line-height: 1.55;
  white-space: nowrap;
}

.process-node > span em {
  overflow: hidden;
  font-style: normal;
  text-overflow: ellipsis;
}

.process-node > span b {
  color: #9cd5e6;
  font-family: var(--number);
  font-size: 8px;
  font-weight: 400;
}

.node-status {
  position: absolute;
  right: 7px;
  bottom: 5px;
  color: var(--green);
  font-size: 7px;
  font-style: normal;
  letter-spacing: 0.04em;
}

.node-status::before {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 4px currentColor;
  content: "";
}

.node-status.amber {
  color: var(--yellow);
}

.node-small {
  padding: 8px 10px;
}

.recycle-node {
  background:
    linear-gradient(135deg, rgba(55, 47, 30, 0.57), rgba(14, 29, 44, 0.95)),
    var(--panel);
  border-color: rgba(221, 161, 54, 0.48);
}

.recycle-node::before,
.recycle-node::after {
  border-color: var(--yellow);
}

.twin-hint {
  position: absolute;
  bottom: 10px;
  left: 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #4b788f;
  font-size: 8px;
}

.twin-hint span {
  color: #76a9be;
}

.twin-hint i {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 5px var(--cyan);
}

.center-bottom {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(248px, 0.92fr);
  gap: 8px;
  min-height: 0;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #7198ad;
  font-size: 8px;
  white-space: nowrap;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chart-legend i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 5px currentColor;
}

.chart-legend em {
  color: #51788e;
  font-style: normal;
}

.trend-chart {
  position: relative;
  height: calc(100% - 35px);
  cursor: crosshair;
}

#trendSvg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 126px;
  padding: 8px 9px;
  pointer-events: none;
  border: 1px solid rgba(39, 185, 235, 0.55);
  background: rgba(3, 20, 37, 0.95);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.38), inset 0 0 20px rgba(15, 149, 203, 0.08);
  opacity: 0;
  transform: translate(-50%, -113%);
  transition: opacity 0.14s ease;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip strong {
  display: block;
  padding-bottom: 4px;
  color: #cfeeff;
  font-family: var(--number);
  font-size: 10px;
  font-weight: 500;
}

.chart-tooltip span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 3px;
  color: #7197ab;
  font-size: 8px;
}

.chart-tooltip span i {
  width: 4px;
  height: 4px;
  margin-right: 4px;
  border-radius: 50%;
}

.chart-tooltip span b {
  color: #c7eaf7;
  font-family: var(--number);
  font-weight: 400;
}

.vehicle-panel .panel-head {
  min-height: 34px;
}

.vehicle-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 47px;
  margin: 5px 7px 2px;
  border: 1px solid rgba(29, 125, 175, 0.23);
  background: rgba(8, 38, 61, 0.35);
}

.vehicle-overview div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(29, 125, 175, 0.17);
}

.vehicle-overview div:last-child {
  border-right: 0;
}

.vehicle-overview small {
  color: #5d879d;
  font-size: 7px;
}

.vehicle-overview b {
  margin-top: 1px;
  color: var(--cyan-soft);
  font-family: var(--number);
  font-size: 15px;
  font-weight: 500;
}

.vehicle-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  height: calc(100% - 88px);
  padding: 3px 7px 7px;
}

.vehicle-item {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(28, 119, 162, 0.23);
  background: linear-gradient(135deg, rgba(10, 51, 76, 0.4), rgba(4, 23, 42, 0.28));
}

.vehicle-top {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.vehicle-top > i {
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(31, 192, 235, 0.38);
  border-radius: 50%;
  color: var(--cyan);
}

.vehicle-top svg {
  width: 10px;
  height: 10px;
}

.vehicle-top strong {
  overflow: hidden;
  color: #c3e3f2;
  font-family: var(--number);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  margin-top: 4px;
  color: #527b92;
  font-size: 7px;
  white-space: nowrap;
}

.vehicle-state {
  color: var(--green);
}

.vehicle-state.transit {
  color: var(--cyan);
}

.vehicle-state.waiting {
  color: var(--yellow);
}

.people-list {
  height: calc(100% - 35px);
  overflow: hidden;
}

.person-item {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  height: 25%;
  min-height: 42px;
  padding: 4px 9px;
  border-bottom: 1px solid rgba(34, 110, 150, 0.18);
}

.person-avatar {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid rgba(41, 178, 225, 0.6);
  border-radius: 50%;
  color: #bdefff;
  background: radial-gradient(circle, rgba(22, 157, 206, 0.26), rgba(5, 36, 59, 0.6));
  font-family: var(--number);
  font-size: 8px;
}

.person-copy {
  min-width: 0;
}

.person-name {
  color: #b9dceb;
  font-size: 10px;
}

.person-name strong {
  font-weight: 500;
}

.person-name span {
  margin-left: 4px;
  color: #568096;
  font-size: 8px;
}

.person-trail {
  overflow: hidden;
  margin-top: 3px;
  color: #588096;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-trail::before {
  margin-right: 4px;
  color: var(--cyan);
  content: "◎";
}

.person-tag {
  padding: 2px 5px;
  border: 1px solid;
  font-size: 8px;
}

.person-tag.onsite {
  border-color: rgba(45, 231, 169, 0.45);
  color: var(--green);
  background: rgba(45, 231, 169, 0.06);
}

.person-tag.patrol {
  border-color: rgba(57, 191, 245, 0.48);
  color: var(--cyan);
  background: rgba(57, 191, 245, 0.07);
}

.person-tag.work {
  border-color: rgba(255, 201, 79, 0.45);
  color: var(--yellow);
  background: rgba(255, 201, 79, 0.07);
}

.plc-list {
  height: calc(100% - 35px);
  overflow: hidden;
}

.plc-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  height: 20%;
  min-height: 33px;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(31, 106, 146, 0.15);
  transition: background 0.2s ease;
}

.plc-item.abnormal {
  background: linear-gradient(90deg, rgba(160, 46, 55, 0.2), transparent);
}

.plc-name {
  overflow: hidden;
  color: #85acbd;
  font-family: var(--number);
  font-size: 8px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plc-code {
  color: #4c7186;
  font-family: var(--number);
  font-size: 7px;
}

.plc-state {
  min-width: 43px;
  color: #69a8bd;
  font-size: 8px;
  text-align: right;
}

.plc-state::before {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
  content: "";
}

.plc-item.abnormal .plc-state {
  color: var(--red);
}

.plc-item.abnormal .plc-state::before {
  background: var(--red);
  box-shadow: 0 0 5px var(--red);
  animation: blink 0.85s steps(1) infinite;
}

.environment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100% - 35px);
  padding: 6px 8px;
  gap: 5px;
}

.env-item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: 4px 9px 7px;
  overflow: hidden;
  border: 1px solid rgba(28, 121, 166, 0.23);
  background: linear-gradient(135deg, rgba(8, 44, 69, 0.4), rgba(3, 19, 34, 0.18));
}

.env-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #6c91a5;
  font-size: 8px;
}

.env-label em {
  color: #4f768b;
  font-style: normal;
}

.env-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}

.env-value b {
  color: var(--green);
  font-family: var(--number);
  font-size: clamp(15px, 1.03vw, 20px);
  font-weight: 500;
  transition: color 0.2s ease;
}

.env-value small {
  color: #587e93;
  font-size: 7px;
}

.env-meter {
  position: absolute;
  right: 9px;
  bottom: 6px;
  left: 9px;
  height: 2px;
  background: rgba(33, 105, 137, 0.28);
}

.env-meter i {
  display: block;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  transition: width 0.6s ease, background 0.2s ease;
}

.env-item.exceed {
  border-color: rgba(255, 82, 105, 0.55);
  background: linear-gradient(135deg, rgba(110, 27, 40, 0.35), rgba(30, 11, 21, 0.25));
  animation: fault-border 0.9s infinite alternate;
}

.env-item.exceed .env-value b {
  color: var(--red);
}

.env-item.exceed .env-meter i {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100% - 35px);
  padding: 6px 8px;
  gap: 5px;
}

.video-feed {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 131, 174, 0.28);
  background: #08131d;
  cursor: pointer;
}

.video-feed::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(7, 20, 29, 0.13), rgba(0, 0, 0, 0.38)),
    repeating-linear-gradient(0deg, rgba(116, 168, 187, 0.025) 0, rgba(116, 168, 187, 0.025) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at 67% 44%, rgba(74, 112, 119, 0.38), transparent 28%),
    linear-gradient(120deg, #09161f 10%, #172b30 48%, #08121a 90%);
}

.video-feed::after {
  position: absolute;
  right: 8%;
  bottom: 20%;
  width: 45%;
  height: 39%;
  border-radius: 50% 50% 0 0;
  content: "";
  background:
    radial-gradient(circle at 53% 28%, rgba(193, 210, 197, 0.17) 0 8%, transparent 9%),
    linear-gradient(90deg, transparent 22%, rgba(88, 111, 104, 0.35) 23% 33%, transparent 34% 46%, rgba(96, 122, 113, 0.33) 47% 56%, transparent 57%);
  filter: blur(1px);
}

.video-name {
  position: absolute;
  z-index: 2;
  top: 5px;
  left: 6px;
  color: #93bac8;
  font-family: var(--number);
  font-size: 7px;
  text-shadow: 0 1px 2px #000;
}

.video-rec {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 4px var(--green);
}

.video-feed.alert .video-rec {
  width: 6px;
  height: 6px;
  background: var(--red);
  box-shadow: 0 0 7px var(--red);
  animation: blink 0.7s steps(1) infinite;
}

.video-ai-label {
  position: absolute;
  z-index: 2;
  bottom: 5px;
  left: 6px;
  padding: 2px 4px;
  border-left: 1px solid var(--cyan);
  color: #86c9db;
  background: rgba(2, 16, 25, 0.6);
  font-size: 7px;
}

.video-feed.alert .video-ai-label {
  border-color: var(--red);
  color: #ff8595;
}

.video-feed .ai-box {
  position: absolute;
  z-index: 1;
  top: 20%;
  left: 44%;
  width: 28%;
  height: 53%;
  border: 1px solid rgba(56, 222, 255, 0.54);
  box-shadow: inset 0 0 8px rgba(83, 228, 255, 0.06);
}

.video-feed.alert .ai-box {
  border-color: rgba(255, 82, 105, 0.8);
}

.mobile-nav {
  display: none;
}

.toast-stack {
  position: fixed;
  z-index: 30;
  top: 84px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 4px auto;
  min-width: 250px;
  overflow: hidden;
  border: 1px solid rgba(37, 166, 218, 0.5);
  background: rgba(3, 26, 47, 0.96);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.38);
  animation: toast-in 0.32s ease both;
}

.toast > i {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.toast.alarm > i {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.toast-copy {
  padding: 9px 11px;
}

.toast-copy strong {
  display: block;
  color: #cdefff;
  font-size: 10px;
  font-weight: 500;
}

.toast-copy span {
  display: block;
  margin-top: 3px;
  color: #638da5;
  font-size: 8px;
}

.drawer-backdrop {
  position: fixed;
  z-index: 39;
  inset: 0;
  pointer-events: none;
  background: rgba(0, 6, 14, 0.48);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.show {
  pointer-events: auto;
  opacity: 1;
}

.detail-drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  width: 390px;
  height: 100vh;
  padding: 38px 26px 26px;
  overflow-y: auto;
  border-left: 1px solid rgba(28, 191, 240, 0.58);
  background:
    linear-gradient(180deg, rgba(8, 40, 66, 0.96), rgba(3, 15, 30, 0.99)),
    var(--bg);
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(102%);
  transition: transform 0.34s cubic-bezier(0.22, 0.78, 0.24, 1);
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 13px;
  right: 14px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(47, 153, 192, 0.43);
  background: transparent;
  cursor: pointer;
}

.drawer-close svg {
  width: 14px;
  height: 14px;
}

.drawer-eyebrow {
  color: var(--cyan);
  font-family: var(--number);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.detail-drawer h2 {
  margin: 10px 0 5px;
  color: #e5faff;
  font-size: 24px;
  font-weight: 500;
}

.detail-drawer > p {
  margin: 0;
  color: #608ca3;
  font-size: 10px;
}

.drawer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 16px;
  padding: 9px 12px;
  border: 1px solid rgba(42, 179, 207, 0.3);
  background: rgba(9, 50, 73, 0.54);
  color: #82aabc;
  font-size: 9px;
}

.drawer-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.drawer-status b {
  margin-left: auto;
  color: var(--green);
  font-family: var(--number);
  font-size: 8px;
  font-weight: 400;
}

.drawer-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.drawer-metric {
  padding: 12px;
  border: 1px solid rgba(28, 117, 159, 0.25);
  background: rgba(10, 38, 57, 0.44);
}

.drawer-metric span {
  display: block;
  color: #6089a0;
  font-size: 8px;
}

.drawer-metric strong {
  display: block;
  margin-top: 5px;
  color: #ccefff;
  font-family: var(--number);
  font-size: 19px;
  font-weight: 500;
}

.drawer-metric small {
  margin-left: 3px;
  color: #5e8295;
  font-size: 7px;
}

.drawer-chart {
  margin-top: 16px;
  padding: 11px;
  border: 1px solid rgba(30, 123, 165, 0.26);
}

.drawer-chart-head {
  display: flex;
  justify-content: space-between;
  color: #6d98ad;
  font-size: 9px;
}

.drawer-chart-head b {
  color: var(--green);
  font-family: var(--number);
  font-size: 8px;
  font-weight: 400;
}

#drawerSparkline {
  display: block;
  width: 100%;
  height: 110px;
  margin-top: 6px;
}

.drawer-events {
  margin-top: 16px;
}

.drawer-event {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(37, 107, 140, 0.16);
  color: #7fa4b6;
  font-size: 9px;
}

.drawer-event time {
  flex-shrink: 0;
  color: #506f82;
  font-family: var(--number);
  font-size: 8px;
}

.drawer-action {
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid rgba(31, 194, 237, 0.58);
  color: var(--cyan);
  background: rgba(13, 97, 131, 0.24);
  font-size: 10px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.drawer-action:hover {
  background: rgba(18, 132, 171, 0.3);
}

.flash-new {
  animation: flash-new 0.75s ease;
}

@keyframes atmosphere-scan {
  from { transform: translateX(-70%); }
  to { transform: translateX(70%); }
}

@keyframes flow-line {
  to { stroke-dashoffset: -50; }
}

@keyframes blink {
  50% { opacity: 0.18; }
}

@keyframes alarm-pulse {
  50% { box-shadow: 0 0 12px rgba(255, 82, 105, 0.3); }
}

@keyframes fault-border {
  from { box-shadow: 0 0 5px rgba(255, 82, 105, 0.2), inset 0 0 8px rgba(255, 82, 105, 0.05); }
  to { box-shadow: 0 0 19px rgba(255, 82, 105, 0.5), inset 0 0 20px rgba(255, 82, 105, 0.09); }
}

@keyframes alert-enter {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes flash-new {
  0% { background: rgba(24, 217, 251, 0.2); }
  100% { background: transparent; }
}

@media (max-width: 1550px) {
  .dashboard-grid {
    grid-template-columns: minmax(286px, 18.1%) minmax(0, 1fr) minmax(340px, 21.1%);
  }

  .process-note {
    display: none;
  }

  .chart-legend {
    gap: 6px;
  }

  .metric-card {
    padding-right: 9px;
    padding-left: 9px;
  }

  .process-node {
    padding-right: 8px;
    padding-left: 8px;
  }
}

@media (max-height: 850px) {
  .app-shell {
    min-height: 730px;
  }

  .topbar {
    flex-basis: 57px;
  }

  .kpi-row {
    flex-basis: 92px;
    padding-top: 8px;
  }

  .metric-card {
    padding-top: 7px;
  }

  .metric-value b {
    font-size: 26px;
  }

  .panel-head {
    min-height: 31px;
  }

  .device-list,
  .alert-list,
  .inventory-grid,
  .people-list,
  .plc-list,
  .environment-grid,
  .video-grid {
    height: calc(100% - 31px);
  }

  .process-canvas {
    height: calc(100% - 31px);
  }
}

@media (max-width: 1199px) {
  html,
  body {
    min-width: 0;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: none;
  }

  .app-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 16px 28px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-template-columns: minmax(170px, 0.8fr) minmax(300px, 1.45fr) minmax(220px, 0.8fr);
    flex: 0 0 60px;
    margin: 0 -16px;
    padding: 0 16px;
    background: linear-gradient(180deg, rgba(6, 32, 57, 0.98), rgba(3, 18, 35, 0.92));
    box-shadow: 0 8px 22px rgba(0, 6, 16, 0.24);
    backdrop-filter: blur(15px);
  }

  .kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    flex: none;
    padding: 12px 0;
    gap: 8px;
  }

  .metric-card {
    min-height: 104px;
    padding: 11px 13px 10px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    flex: none;
    gap: 12px;
  }

  .column,
  .center-bottom {
    display: contents;
  }

  #processPanel {
    grid-row: 1;
  }

  #trendPanel {
    grid-row: 2;
  }

  #alertsPanel {
    grid-row: 3;
  }

  #devicePanel {
    grid-row: 4;
  }

  #vehiclePanel {
    grid-row: 5;
  }

  #peoplePanel {
    grid-row: 6;
  }

  #environmentPanel {
    grid-row: 7;
  }

  #inventoryPanel {
    grid-row: 8;
  }

  #plcPanel {
    grid-row: 9;
  }

  #videoPanel {
    grid-row: 10;
  }

  .dashboard-grid .panel {
    min-height: 0;
    scroll-margin-top: 76px;
  }

  .panel-head {
    min-height: 46px;
    padding: 0 14px;
  }

  .panel-title h2 {
    font-size: 14px;
  }

  .panel-extra {
    font-size: 10px;
  }

  .device-list,
  .alert-list,
  .inventory-grid,
  .people-list,
  .plc-list,
  .environment-grid,
  .video-grid {
    height: auto;
  }

  .device-item {
    height: auto;
    min-height: 58px;
    padding: 9px 14px 9px 17px;
  }

  .device-name {
    font-size: 12px;
  }

  .device-detail {
    margin-top: 4px;
    font-size: 10px;
  }

  .status-pill {
    min-width: 48px;
    padding: 5px 9px;
    font-size: 10px;
  }

  .alert-item {
    min-height: 50px;
    padding: 8px 12px;
  }

  .alert-content {
    padding: 0 9px;
    font-size: 10px;
  }

  .alert-tag,
  .alert-time {
    font-size: 9px;
  }

  .inventory-grid {
    padding: 10px 12px;
    gap: 7px 12px;
  }

  .inventory-item {
    min-height: 44px;
    padding: 7px 10px;
  }

  .inventory-name {
    font-size: 10px;
  }

  .process-canvas {
    height: 540px;
  }

  .trend-chart {
    height: 280px;
  }

  .vehicle-list {
    height: auto;
    padding: 8px 10px 12px;
    gap: 7px;
  }

  .vehicle-item {
    min-height: 64px;
    padding: 9px 10px;
  }

  .vehicle-top strong {
    font-size: 10px;
  }

  .vehicle-meta {
    margin-top: 7px;
    font-size: 9px;
  }

  .people-list,
  .plc-list {
    padding: 4px 0;
  }

  .person-item {
    height: auto;
    min-height: 62px;
    padding: 8px 13px;
  }

  .person-name {
    font-size: 11px;
  }

  .person-trail {
    margin-top: 5px;
    font-size: 9px;
  }

  .plc-item {
    height: auto;
    min-height: 43px;
    padding: 7px 13px;
  }

  .plc-name,
  .plc-state {
    font-size: 9px;
  }

  .plc-code {
    font-size: 8px;
  }

  .environment-grid {
    padding: 10px 12px;
    gap: 8px;
  }

  .env-item {
    min-height: 82px;
    padding: 9px 12px 12px;
  }

  .env-label,
  .env-value small {
    font-size: 9px;
  }

  .env-value b {
    font-size: 20px;
  }

  .video-grid {
    padding: 10px 12px 12px;
    gap: 8px;
  }

  .video-feed {
    aspect-ratio: 16 / 9;
  }

  .video-name,
  .video-ai-label {
    font-size: 8px;
  }

  .toast-stack {
    top: 72px;
  }
}

@media (max-width: 767px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  :root {
    --mobile-pad: 12px;
  }

  body {
    -webkit-tap-highlight-color: transparent;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .app-shell {
    min-height: 100dvh;
    padding: 0 var(--mobile-pad) calc(88px + env(safe-area-inset-bottom));
  }

  .screen-atmosphere {
    background-size: 30px 30px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    flex-basis: 58px;
    min-height: 58px;
    margin: 0 calc(var(--mobile-pad) * -1);
    padding: 0 var(--mobile-pad);
    border-bottom-color: rgba(31, 174, 243, 0.24);
    background: rgba(3, 18, 35, 0.94);
    box-shadow: 0 8px 26px rgba(0, 4, 12, 0.32);
    backdrop-filter: blur(18px) saturate(140%);
  }

  .topbar::before,
  .topbar::after {
    display: none;
  }

  .brand {
    padding: 0;
  }

  .brand-icon {
    width: 27px;
    height: 27px;
  }

  .brand-icon svg {
    width: 18px;
    height: 18px;
  }

  .brand-copy {
    display: none;
  }

  .title-lockup {
    justify-content: flex-start;
    min-width: 0;
    padding-left: 10px;
  }

  .title-lockup h1 {
    overflow: hidden;
    font-size: clamp(14px, 4.25vw, 18px);
    font-weight: 500;
    letter-spacing: 0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .title-lockup i {
    display: none;
  }

  .topbar-meta {
    gap: 0;
    padding-right: 0;
  }

  .topbar-meta #systemDate,
  .topbar-location,
  .meta-divider,
  .topbar-meta > b {
    display: none;
  }

  .topbar-meta time {
    gap: 0;
    color: #91bad2;
    font-size: 10px;
    letter-spacing: 0;
  }

  .kpi-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 calc(var(--mobile-pad) * -1);
    padding: 10px var(--mobile-pad) 12px;
    scroll-padding-inline: var(--mobile-pad);
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .kpi-row::-webkit-scrollbar {
    display: none;
  }

  .metric-card {
    flex: 0 0 min(78vw, 286px);
    min-height: 108px;
    scroll-snap-align: start;
  }

  .metric-head {
    font-size: 11px;
  }

  .metric-value b {
    font-size: 32px;
  }

  .metric-foot {
    margin-top: 2px;
    font-size: 9px;
  }

  .online-main {
    margin-top: 8px;
  }

  .online-main > b {
    font-size: 31px;
  }

  .dashboard-grid {
    gap: 10px;
  }

  .dashboard-grid .panel {
    scroll-margin-top: 68px;
  }

  .panel-head {
    min-height: 44px;
    padding: 0 11px;
  }

  .panel-title {
    gap: 7px;
  }

  .panel-title h2 {
    font-size: 12px;
    letter-spacing: 0.035em;
  }

  .panel-extra {
    max-width: 46%;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  #processPanel .panel-head {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 55px;
  }

  #processPanel .panel-extra {
    display: block;
    max-width: 100%;
  }

  .process-canvas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    padding: 12px;
    padding-bottom: 45px;
    gap: 9px;
    overflow: visible;
    background-size: 20px 20px;
  }

  .process-canvas::after {
    display: none;
  }

  .process-links {
    display: none;
  }

  .process-node,
  .node-small {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    height: 120px;
    min-height: 0;
    padding: 11px 12px 17px;
    transform: none;
  }

  .process-node[data-node="intake"] {
    grid-area: 1 / 1;
  }

  .process-node[data-node="sorting"] {
    grid-area: 1 / 2;
  }

  .process-node[data-node="crushing"] {
    grid-area: 2 / 1;
  }

  .process-node[data-node="rdf"] {
    grid-area: 2 / 2;
  }

  .process-node[data-node="fermentation"] {
    grid-area: 3 / 1;
  }

  .process-node[data-node="garden"] {
    grid-area: 3 / 2;
  }

  .process-node[data-node="fuel"] {
    grid-area: 4 / 1;
  }

  .process-node[data-node="recovery"] {
    grid-area: 4 / 2;
  }

  .process-node::after {
    width: 15px;
    height: 15px;
  }

  .node-kicker {
    margin-bottom: 5px;
    font-size: 7px;
  }

  .process-node > strong {
    margin-bottom: 7px;
    font-size: 13px;
    letter-spacing: 0.02em;
  }

  .process-node > span:not(.node-kicker) {
    gap: 6px;
    font-size: 8px;
    line-height: 1.65;
  }

  .process-node > span b {
    font-size: 8px;
  }

  .node-status {
    right: 9px;
    bottom: 7px;
    font-size: 7px;
  }

  .twin-hint {
    right: 12px;
    bottom: 12px;
    left: 12px;
    justify-content: space-between;
    gap: 5px;
    font-size: 7px;
  }

  .chart-legend {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 7px;
    max-width: 58%;
    white-space: normal;
  }

  .chart-legend span {
    gap: 3px;
    font-size: 7px;
  }

  .chart-legend em {
    display: none;
  }

  .trend-chart {
    height: 250px;
    padding: 4px 3px 0;
    touch-action: pan-y;
  }

  #trendSvg text {
    font-size: 11px;
  }

  .chart-tooltip {
    min-width: 132px;
    padding: 9px 10px;
  }

  .chart-tooltip strong {
    font-size: 11px;
  }

  .chart-tooltip span {
    font-size: 9px;
  }

  .vehicle-list {
    grid-template-columns: 1fr 1fr;
    padding: 8px 9px 12px;
    gap: 7px;
  }

  .vehicle-overview {
    height: 58px;
    margin-top: 8px;
  }

  .vehicle-overview small {
    font-size: 8px;
  }

  .vehicle-overview b {
    font-size: 18px;
  }

  .device-item,
  .alert-item,
  .person-item,
  .plc-item,
  .video-feed {
    cursor: pointer;
  }

  .device-item {
    min-height: 62px;
    padding-right: 12px;
  }

  .alert-item {
    grid-template-columns: 39px minmax(0, 1fr) auto;
    min-height: 54px;
    padding: 9px 11px;
  }

  .alert-content {
    font-size: 9px;
  }

  .inventory-grid {
    height: auto;
  }

  .inventory-item {
    min-height: 48px;
  }

  .person-item {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    min-height: 67px;
  }

  .person-avatar {
    width: 30px;
    height: 30px;
    font-size: 9px;
  }

  .person-tag {
    padding: 4px 7px;
    font-size: 9px;
  }

  .environment-grid,
  .video-grid {
    gap: 7px;
  }

  .env-item {
    min-height: 88px;
    padding: 9px 10px 13px;
  }

  .env-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .env-label em {
    font-size: 7px;
  }

  .env-value {
    margin-top: 5px;
  }

  .env-value b {
    font-size: 18px;
  }

  .video-feed {
    min-height: 104px;
  }

  .toast-stack {
    top: auto;
    right: var(--mobile-pad);
    bottom: calc(86px + env(safe-area-inset-bottom));
    left: var(--mobile-pad);
    align-items: stretch;
  }

  .toast {
    width: 100%;
    min-width: 0;
    border-color: rgba(37, 166, 218, 0.38);
    background: rgba(3, 24, 43, 0.97);
    backdrop-filter: blur(12px);
  }

  .toast-copy {
    padding: 10px 12px;
  }

  .toast-copy strong {
    font-size: 11px;
  }

  .toast-copy span {
    font-size: 9px;
  }

  .detail-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    max-height: min(88dvh, 760px);
    padding: 38px 18px calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(28, 191, 240, 0.58);
    border-left: 0;
    border-radius: 18px 18px 0 0;
    background:
      linear-gradient(180deg, rgba(9, 43, 69, 0.99), rgba(3, 15, 30, 0.995)),
      var(--bg);
    box-shadow: 0 -18px 45px rgba(0, 0, 0, 0.48);
    transform: translateY(103%);
    overscroll-behavior: contain;
  }

  .detail-drawer::before {
    position: absolute;
    top: 10px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    content: "";
    background: rgba(102, 170, 200, 0.35);
    transform: translateX(-50%);
  }

  .detail-drawer.open {
    transform: translateY(0);
  }

  .drawer-close {
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
  }

  .drawer-close svg {
    width: 17px;
    height: 17px;
  }

  .detail-drawer h2 {
    margin-top: 11px;
    font-size: 24px;
  }

  .detail-drawer > p {
    font-size: 11px;
  }

  .drawer-status {
    margin: 18px 0 14px;
    min-height: 42px;
    font-size: 10px;
  }

  .drawer-metrics {
    gap: 8px;
  }

  .drawer-metric {
    min-height: 76px;
    padding: 12px;
  }

  .drawer-metric span {
    font-size: 9px;
  }

  .drawer-metric strong {
    font-size: 20px;
  }

  #drawerSparkline {
    height: 100px;
  }

  .drawer-event {
    min-height: 44px;
    align-items: center;
    padding: 10px 0;
    font-size: 10px;
  }

  .drawer-action {
    min-height: 48px;
    margin-top: 16px;
    font-size: 11px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 25;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 64px;
    padding: 5px;
    border: 1px solid rgba(53, 167, 211, 0.38);
    border-radius: 16px;
    background: rgba(3, 20, 37, 0.94);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.46), inset 0 1px rgba(115, 222, 255, 0.08);
    backdrop-filter: blur(18px) saturate(145%);
  }

  .mobile-nav button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 52px;
    padding: 5px 2px 4px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 11px;
    color: #648ca3;
    background: transparent;
    cursor: pointer;
  }

  .mobile-nav button::before {
    position: absolute;
    top: -5px;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    content: "";
    background: transparent;
    box-shadow: none;
    transform: translateX(-50%);
  }

  .mobile-nav button.active {
    color: var(--cyan-soft);
    background: linear-gradient(180deg, rgba(33, 160, 204, 0.18), rgba(17, 106, 144, 0.06));
  }

  .mobile-nav button.active::before {
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
  }

  .mobile-nav svg {
    width: 19px;
    height: 19px;
    stroke-width: 1.5;
  }

  .mobile-nav span {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  body.drawer-open .mobile-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }
}

@media (max-width: 359px) {
  .title-lockup h1 {
    font-size: 13px;
  }

  .metric-card {
    flex-basis: 84vw;
  }

  .process-node,
  .node-small {
    padding-right: 9px;
    padding-left: 9px;
  }

  .process-node > span:not(.node-kicker) {
    font-size: 7px;
  }

  .vehicle-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
