* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --bg: #07101f;
  --bg-gradient: radial-gradient(circle at 85% 0%, #17345e 0%, transparent 28%), linear-gradient(145deg, #07101f 0%, #0b1729 100%);
  --card-bg: linear-gradient(145deg, rgba(25, 43, 68, 0.96), rgba(13, 27, 46, 0.98));
  --panel-bg: #1a1e24;
  --panel-border: #2a3040;
  --text: #e2e8f0;
  --text-bright: #ffffff;
  --dim: #7a8fa5;
  --label-blue: #7eb8e0;
  --value-yellow: #e8d44d;
  --value-green: #4ade80;
  --value-red: #f87171;
  --value-amber: #fbbf24;
  --primary: #3b7fc4;
  --primary-light: #5a9ee0;
  --primary-dim: rgba(59, 127, 196, 0.15);
  --sidebar-bg: linear-gradient(180deg, #1e3250 0%, #162540 100%);
  --sidebar-border: rgba(80, 140, 220, 0.15);
  --sidebar-active: rgba(59, 127, 196, 0.18);
  --header-bg: rgba(30, 50, 80, 0.92);
  --green-dim: rgba(74, 222, 128, 0.12);
  --red-dim: rgba(248, 113, 113, 0.12);
  --sidebar-width: 220px;
  --header-height: 50px;
}
html,
body {
  font-family: "Inter", sans-serif;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-gradient);
  color: var(--text);
}
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

/* ===== LOGIN ===== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(380px, 0.72fr);
  min-height: 100dvh;
  overflow: auto;
  background: #07101f;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
body.authenticated .login-screen {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100dvh;
  padding: clamp(28px, 4vw, 64px);
  isolation: isolate;
  background:
    linear-gradient(90deg, rgba(3, 11, 25, 0.84) 0%, rgba(3, 13, 29, 0.38) 58%, rgba(3, 12, 27, 0.74) 100%),
    linear-gradient(180deg, rgba(4, 12, 27, 0.12), rgba(4, 12, 27, 0.76)),
    url("plant-purwakarta.png") center / cover no-repeat;
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 65% 30%, rgba(64, 170, 255, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(7, 32, 58, 0.16), transparent 55%);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 8px 13px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(4, 15, 31, 0.54);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}
.login-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}
.login-brand strong,
.login-brand span {
  display: block;
}
.login-brand strong {
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.15px;
}
.login-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.welcome-copy {
  max-width: 780px;
  padding: clamp(30px, 6vw, 80px) 0;
}
.welcome-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.2px;
}
.welcome-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
}
.welcome-copy h1 {
  max-width: 720px;
  color: #fff;
  font-size: clamp(32px, 4.3vw, 68px);
  font-weight: 780;
  line-height: 1.04;
  letter-spacing: -2px;
  text-wrap: balance;
  text-shadow: 0 5px 28px rgba(0, 0, 0, 0.38);
}
.welcome-copy h1 em {
  display: block;
  margin-top: 13px;
  color: #bce9ff;
  font-size: 0.43em;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}
.welcome-copy p {
  max-width: 600px;
  margin-top: 18px;
  color: rgba(232, 243, 255, 0.72);
  font-size: clamp(11px, 1.1vw, 15px);
  line-height: 1.75;
}
.login-photo-credit {
  color: rgba(255, 255, 255, 0.45);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
}
.login-panel {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: clamp(24px, 4vw, 62px);
  background:
    radial-gradient(circle at 100% 0%, rgba(48, 130, 211, 0.2), transparent 35%),
    linear-gradient(160deg, #0c1b2f, #07111f);
}
.login-card {
  width: min(390px, 100%);
}
.login-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.login-lock {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(90, 158, 224, 0.24);
  border-radius: 11px;
  color: #71c6f4;
  background: rgba(59, 127, 196, 0.12);
  box-shadow: 0 0 28px rgba(59, 127, 196, 0.12);
}
.login-card-heading p {
  margin-bottom: 3px;
  color: #68819b;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}
.login-card-heading h2 {
  color: #fff;
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -0.5px;
}
.login-description {
  margin-bottom: 26px;
  color: #8197ae;
  font-size: 11px;
  line-height: 1.65;
}
.login-field {
  display: block;
  margin-bottom: 15px;
}
.login-field > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: #a7b9cb;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.35px;
}
.login-input-wrap {
  display: flex;
  align-items: center;
  height: 46px;
  overflow: hidden;
  border: 1px solid rgba(134, 167, 199, 0.15);
  border-radius: 9px;
  color: #5f7690;
  background: rgba(2, 10, 21, 0.5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login-input-wrap:focus-within {
  border-color: rgba(90, 177, 231, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 127, 196, 0.1);
}
.login-input-wrap > i {
  width: 42px;
  text-align: center;
  font-size: 12px;
}
.login-input-wrap input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  color: #f2f7fc;
  background: transparent;
  font: 500 11px "Inter", sans-serif;
}
.login-input-wrap input::placeholder {
  color: #52667d;
}
.password-toggle {
  width: 42px;
  height: 100%;
  border: 0;
  color: #627991;
  background: transparent;
  cursor: pointer;
}
.password-toggle:hover { color: #9acff0; }
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 5px 0 16px;
  color: #758ca4;
  font-size: 9px;
}
.login-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.login-options input { accent-color: #3b82c4; }
.login-status {
  color: #71d69a;
}
.login-status i {
  margin-right: 4px;
  font-size: 5px;
  vertical-align: middle;
  box-shadow: 0 0 8px #4ade80;
}
.login-error {
  min-height: 16px;
  margin-bottom: 5px;
  color: #fb8181;
  font-size: 9px;
}
.login-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(113, 198, 244, 0.2);
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #236bad, #3b8bc8);
  box-shadow: 0 10px 28px rgba(35, 107, 173, 0.24);
  font: 700 10px "Inter", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(35, 107, 173, 0.34);
}
.login-submit:active { transform: translateY(0); }
.programmer-credit {
  margin-top: 15px;
  color: #587087;
  font-size: 7px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.75px;
}
.programmer-credit strong {
  color: #88a9c1;
  font-weight: 700;
}
.programmer-credit span {
  margin-left: 3px;
  padding: 2px 5px;
  border-radius: 10px;
  color: #6dc9e9;
  background: rgba(75, 185, 226, 0.08);
}
.logout-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.logout-btn:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual {
    min-height: 46dvh;
    padding: 24px;
    background-position: center 58%;
  }
  .welcome-copy { padding: 42px 0 18px; }
  .welcome-copy h1 {
    max-width: 620px;
    font-size: clamp(28px, 9vw, 44px);
    letter-spacing: -1.2px;
  }
  .welcome-copy p { display: none; }
  .login-photo-credit { display: none; }
  .login-panel { min-height: 54dvh; padding: 34px 24px 42px; }
}

/* Centered premium login composition */
.login-screen {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  background: #06101e;
}
.login-visual {
  position: absolute;
  inset: 0;
  min-height: 100%;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(2, 9, 20, 0.46) 0%, rgba(3, 13, 27, 0.22) 42%, rgba(2, 9, 20, 0.78) 100%),
    radial-gradient(circle at 50% 42%, transparent 10%, rgba(2, 9, 20, 0.4) 78%),
    url("plant-purwakarta.png") center 34% / cover no-repeat;
}
.login-visual::after {
  background:
    linear-gradient(90deg, rgba(2, 9, 20, 0.28), transparent 28%, transparent 72%, rgba(2, 9, 20, 0.28)),
    radial-gradient(circle at 50% 40%, rgba(76, 180, 255, 0.13), transparent 35%);
}
.login-brand {
  position: absolute;
  top: clamp(20px, 3vw, 38px);
  left: clamp(20px, 3vw, 44px);
  z-index: 2;
  padding: 7px 12px 7px 7px;
  background: rgba(4, 15, 31, 0.62);
}
.login-brand img {
  width: 42px;
  height: 42px;
}
.welcome-copy {
  position: absolute;
  top: clamp(75px, 9vh, 104px);
  left: 50%;
  width: min(900px, calc(100% - 48px));
  max-width: none;
  padding: 0;
  transform: translateX(-50%);
  text-align: center;
}
.welcome-kicker {
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 20px;
  background: rgba(4, 19, 37, 0.46);
  backdrop-filter: blur(10px);
}
.welcome-kicker::before { display: none; }
.welcome-copy h1 {
  max-width: none;
  font-size: clamp(29px, 3.15vw, 50px);
  line-height: 1.08;
  letter-spacing: -1.5px;
}
.welcome-copy h1 em {
  margin-top: 7px;
  font-size: 0.42em;
  color: #d2f1ff;
}
.welcome-copy p {
  max-width: 660px;
  margin: 11px auto 0;
  font-size: 10px;
  line-height: 1.6;
}
.login-photo-credit {
  position: absolute;
  right: 28px;
  bottom: 22px;
}
.login-panel {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 100dvh;
  padding: 185px 24px 28px;
  background: transparent;
}
.login-card {
  width: min(410px, 100%);
  padding: 28px 30px 24px;
  border: 1px solid rgba(183, 220, 244, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(12, 29, 49, 0.74), rgba(5, 17, 32, 0.66));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(125%);
}
.login-card::before {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  margin: -12px auto 22px;
  border-radius: 2px;
  background: linear-gradient(90deg, #38bdf8, #7dd3fc);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
}
.login-card-heading {
  justify-content: center;
  text-align: left;
}
.login-description {
  margin: 0 auto 22px;
  max-width: 300px;
  text-align: center;
}
.login-input-wrap {
  height: 44px;
  background: rgba(2, 10, 21, 0.64);
}
.login-submit {
  background: linear-gradient(135deg, #1768a6, #3a9ad1);
}

@media (max-width: 820px) {
  .login-screen {
    display: block;
    overflow-y: auto;
  }
  .login-visual {
    position: fixed;
    min-height: 100dvh;
    background-position: center 34%;
  }
  .login-brand {
    position: absolute;
    top: 16px;
    left: 16px;
  }
  .welcome-copy {
    position: absolute;
    top: 92px;
    width: calc(100% - 32px);
  }
  .welcome-copy h1 {
    font-size: clamp(25px, 7.8vw, 38px);
    letter-spacing: -0.8px;
  }
  .welcome-copy p { display: none; }
  .login-panel {
    min-height: 100dvh;
    padding: 250px 16px 32px;
  }
  .login-card {
    margin: 0 auto;
    padding: 24px 21px 21px;
    border-radius: 15px;
  }
}

@media (max-height: 740px) and (min-width: 821px) {
  .welcome-copy { top: 55px; }
  .welcome-copy p { display: none; }
  .login-panel { padding-top: 150px; }
  .login-card { padding-top: 22px; padding-bottom: 18px; }
  .login-description { margin-bottom: 16px; }
  .login-field { margin-bottom: 11px; }
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(90, 160, 230, 0.3),
    transparent
  );
}
.sidebar-logo {
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: transparent; /* hapus background merah */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.logo-text h1 {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}
.logo-text small {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}
.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
}
.nav-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.25);
  padding: 10px 12px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--primary-light);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 13px;
}
.nav-badge {
  margin-left: auto;
  font-size: 9px;
  padding: 1px 7px;
  border-radius: 8px;
  font-weight: 700;
}
.nav-badge.live {
  background: var(--green-dim);
  color: var(--value-green);
}
.nav-badge.count {
  background: var(--red-dim);
  color: var(--value-red);
}
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-footer .company-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-programmer-credit {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.25);
  font-size: 7px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.65px;
}
.sidebar-programmer-credit strong {
  color: rgba(255, 255, 255, 0.5);
}
.sidebar-programmer-credit span {
  margin-left: 3px;
  color: #5baed4;
}
.company-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}
.company-details p {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}
.company-details span {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.35);
}
/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  z-index: 150;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hamburger {
  display: none;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slideshow-toggle.active {
  color: #74d8f5;
  border-color: rgba(86, 190, 230, 0.35);
  background: rgba(56, 160, 202, 0.12);
  box-shadow: 0 0 14px rgba(56, 160, 202, 0.1);
}
.slideshow-indicator {
  width: 145px;
  margin-left: 4px;
}
.slideshow-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.slideshow-meta span {
  overflow: hidden;
  color: #9bb6cc;
  font-size: 8px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slideshow-meta small {
  flex: 0 0 auto;
  color: #617b91;
  font: 600 7px "JetBrains Mono", monospace;
}
.slideshow-progress {
  height: 2px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}
.slideshow-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2985ba, #65d3ef);
  box-shadow: 0 0 7px rgba(101, 211, 239, 0.45);
  transform: scaleX(0);
  transform-origin: left;
}
.header-ctrl-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.header-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.page-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-title i {
  color: var(--primary-light);
  font-size: 15px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-clock {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-clock i {
  color: var(--primary-light);
  font-size: 10px;
}
.mqtt-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 10px;
  font-weight: 600;
}
.mqtt-badge.online {
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: var(--value-green);
}
.mqtt-badge.connecting {
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.25);
  color: #fde047;
}
.mqtt-badge.offline {
  background: var(--red-dim);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: var(--value-red);
}
.mqtt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.mqtt-badge.online .mqtt-dot {
  background: var(--value-green);
  box-shadow: 0 0 6px var(--value-green);
  animation: blink 2s infinite;
}
.mqtt-badge.connecting .mqtt-dot {
  background: #fde047;
  box-shadow: 0 0 6px #fde047;
  animation: blink 1s infinite;
}
.mqtt-badge.offline .mqtt-dot {
  background: var(--value-red);
  box-shadow: 0 0 6px var(--value-red);
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
/* ===== MAIN CONTENT ===== */
.main-content {
  position: relative;
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.dashboard-heading h2 {
  font-size: clamp(20px, 2vw, 28px);
  color: var(--text-bright);
  letter-spacing: -0.6px;
  margin-bottom: 4px;
}
.dashboard-heading p {
  color: #8da3bd;
  font-size: 12px;
}
.summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.summary-item {
  min-width: 92px;
  padding: 8px 12px;
  border: 1px solid rgba(126, 184, 224, 0.14);
  border-radius: 9px;
  background: rgba(12, 26, 45, 0.62);
  text-align: right;
}
.summary-item strong {
  display: block;
  color: #fff;
  font: 700 16px "JetBrains Mono", monospace;
}
.summary-item span {
  font-size: 9px;
  color: #71869d;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.dashboard-view {
  display: none;
}
.dashboard-view.active {
  display: block;
  animation: dashboardSlideIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes dashboardSlideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-view.active { animation: none; }
}
.empty-state {
  min-height: calc(100vh - var(--header-height) - 40px);
  display: grid;
  place-items: center;
}
.empty-state-card {
  width: min(520px, 100%);
  padding: 42px 30px;
  text-align: center;
  border: 1px dashed rgba(126, 184, 224, 0.3);
  border-radius: 16px;
  background: rgba(12, 26, 45, 0.56);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}
.empty-state-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-light);
  background: var(--primary-dim);
  font-size: 21px;
}
.empty-state-card h2 {
  color: #fff;
  font-size: 23px;
  margin-bottom: 8px;
}
.empty-state-card p {
  color: #8298b1;
  font-size: 12px;
  line-height: 1.7;
}
.empty-state-label {
  display: inline-block;
  margin-top: 18px;
  padding: 6px 10px;
  border-radius: 20px;
  color: #9fb4ca;
  background: rgba(255, 255, 255, 0.05);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
/* ===== MMF GRID ===== */
.mmf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
}
#mmfView.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
#mmfView .dashboard-heading {
  margin-bottom: 12px;
}
#mmfView .dashboard-heading h2 {
  color: #f5f8fc;
}
#mmfView .dashboard-heading p {
  color: #8298b1;
}
#mmfView .summary-item {
  border-color: rgba(126, 184, 224, 0.15);
  background: linear-gradient(145deg, rgba(22, 42, 65, 0.82), rgba(9, 24, 42, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
#mmfView .summary-item strong { color: #f2f6fa; }
#mmfView .summary-item span { color: #7189a2; }
.total-flow-summary { min-width: 190px; }
.total-flow-summary strong {
  color: #63c7ef !important;
  font-size: 15px;
}
.total-flow-summary strong small {
  color: #718da2;
  font-size: 8px;
}
/* ===== MMF MONITORING CARD ===== */
.mmf-card {
  background:
    radial-gradient(circle at 88% 0%, rgba(56, 144, 199, 0.13), transparent 35%),
    linear-gradient(150deg, #172b43, #0e2137 58%, #091827);
  border: 1px solid rgba(126, 184, 224, 0.14);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mmf-card:hover {
  border-color: rgba(90, 178, 224, 0.42);
  transform: translateY(-2px);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.mmf-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #287bb0, #5bc1e8, transparent 88%);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.unit-name {
  color: #f7f9fc;
  font-size: 15px;
  font-weight: 780;
  letter-spacing: 0.3px;
}
.unit-name small {
  display: block;
  color: #687f96;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 2px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
.status-pill.running { color: #4ade80; background: rgba(74, 222, 128, 0.1); }
.status-pill.stop { color: #fbbf24; background: rgba(251, 191, 36, 0.11); }
.status-pill.trip { color: #f87171; background: rgba(248, 113, 113, 0.11); }
.mmf-card .status-pill.running { color: #4ade80; background: rgba(74, 222, 128, 0.11); }
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 12px 13px 10px;
  flex: 1;
  align-content: center;
}
.metric {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(4, 15, 29, 0.72), rgba(12, 30, 49, 0.7));
  border: 1px solid rgba(126, 184, 224, 0.08);
  border-radius: 10px;
  padding: 11px 12px;
  min-width: 0;
}
.metric::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(80, 185, 239, 0.38), transparent);
}
.metric-primary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 62px;
}
.metric-total {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.metric-label {
  display: block;
  color: #7791aa;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 7px;
}
.metric-value {
  color: #f3dc58;
  font: 700 clamp(17px, 1.25vw, 22px) "JetBrains Mono", monospace;
  letter-spacing: -0.6px;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(243, 220, 88, 0.1);
}
.metric-total .metric-label { margin-bottom: 0; }
.metric-total .metric-value {
  font-size: clamp(14px, 1.05vw, 18px);
  text-align: right;
}
.metric-value small {
  color: #71869d;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0;
}
.process-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 14px 13px;
  color: #70869f;
  font-size: 9px;
}
.process-value {
  padding: 4px 8px;
  border-radius: 20px;
  font-weight: 750;
  color: #e9cf50;
  background: rgba(233, 207, 80, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.process-value.standby { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.process-value.service { color: #62b6ed; background: rgba(98, 182, 237, 0.09); }
.process-value.backwash, .process-value.rinse { color: #c084fc; background: rgba(192, 132, 252, 0.09); }
.acf-softener-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
}
#acfSoftenerView.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
#acfSoftenerView .dashboard-heading {
  margin-bottom: 12px;
}
.acf-total-flow-summary {
  min-width: 205px;
  border-color: rgba(154, 115, 225, 0.2);
  background: linear-gradient(145deg, rgba(83, 57, 132, 0.22), rgba(19, 35, 56, 0.72));
}
.acf-total-flow-summary strong {
  color: #c9a8fa;
  font-size: 15px;
}
.acf-total-flow-summary strong small {
  color: #7b8da4;
  font-size: 8px;
}
.combo-card {
  position: relative;
  border: 1px solid rgba(126, 184, 224, 0.15);
  border-radius: 14px;
  background:
    radial-gradient(circle at 90% 0%, rgba(74, 129, 194, 0.12), transparent 35%),
    linear-gradient(150deg, #172b43, #0e2137 58%, #091827);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  overflow: hidden;
  min-height: 0;
  animation: fadeIn 0.4s ease-out both;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.combo-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  z-index: 2;
  background: linear-gradient(90deg, #3b7fc4, #62b6ed 50%, #8b5cf6, transparent 92%);
}
.combo-card:hover {
  transform: translateY(-2px);
  border-color: rgba(90, 158, 224, 0.42);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}
.combo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(90deg, rgba(59, 127, 196, 0.13), rgba(139, 92, 246, 0.05), transparent);
}
.combo-card-header h3 {
  color: #fff;
  font-size: 16px;
  font-weight: 780;
  letter-spacing: 0.2px;
}
.combo-card-header span {
  color: #8fb6d4;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 8px;
  border: 1px solid rgba(126, 184, 224, 0.14);
  border-radius: 20px;
  background: rgba(7, 16, 31, 0.45);
}
.combo-sections {
  display: grid;
  grid-template-columns: minmax(150px, 0.72fr) minmax(0, 1.28fr);
  gap: 11px;
  padding: 12px;
}
.equipment-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 13px;
  min-width: 0;
  border: 1px solid rgba(91, 184, 232, 0.1);
  border-radius: 11px;
  background: linear-gradient(155deg, rgba(8, 25, 43, 0.88), rgba(3, 14, 28, 0.76));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
}
.equipment-panel::before {
  content: "";
  position: absolute;
  inset: 0 16px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(91, 193, 232, 0.5), transparent);
}
.equipment-panel + .equipment-panel {
  border-color: rgba(173, 130, 235, 0.12);
}
.equipment-panel + .equipment-panel::before {
  background: linear-gradient(90deg, transparent, rgba(178, 132, 242, 0.5), transparent);
}
.equipment-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.equipment-title h4 {
  color: #8ac9f1;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.equipment-title small {
  display: block;
  color: #698097;
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 3px;
}
.equipment-panel:last-child .equipment-title h4 {
  color: #b59af8;
}
.compact-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.compact-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.compact-status.running { color: #4ade80; background: rgba(74, 222, 128, 0.1); }
.compact-status.stop { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.compact-status.trip { color: #f87171; background: rgba(248, 113, 113, 0.1); }
.compact-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.equipment-panel:first-child .compact-metrics {
  grid-template-columns: 1fr;
}
.equipment-panel:first-child .compact-row {
  display: flex;
  min-height: 82px;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
}
.equipment-panel:first-child .compact-row strong {
  font-size: clamp(18px, 1.35vw, 22px);
}
.compact-row {
  display: block;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(126, 184, 224, 0.07);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(15, 36, 58, 0.82), rgba(7, 22, 38, 0.78));
  min-width: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.compact-row:hover {
  border-color: rgba(94, 184, 228, 0.2);
  background: linear-gradient(145deg, rgba(18, 43, 68, 0.9), rgba(8, 25, 43, 0.84));
}
.soft-total-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.soft-total-row span:first-child {
  margin-bottom: 0;
}
.soft-total-row strong {
  text-align: right;
}
.compact-row span:first-child {
  display: block;
  color: #7189a2;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  margin-bottom: 7px;
}
.compact-row strong {
  color: #f2da58;
  font: 700 clamp(13px, 1vw, 16px) "JetBrains Mono", monospace;
  letter-spacing: -0.45px;
  white-space: nowrap;
  text-shadow: 0 0 16px rgba(242, 218, 88, 0.08);
}
.compact-row strong small {
  color: #71879c;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0;
}
.compact-process {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 9px 2px 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #7189a2;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.compact-process strong {
  color: #c084fc;
  font-size: 9.5px;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 20px;
  background: rgba(192, 132, 252, 0.09);
}
.tank-storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 20px;
}
.storage-process-flow {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(90px, 0.7fr) minmax(150px, 1fr) minmax(72px, 0.55fr) minmax(150px, 1fr) minmax(110px, 0.8fr) minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(126, 184, 224, 0.12);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(27, 58, 86, 0.55), rgba(8, 25, 43, 0.72)),
    rgba(7, 20, 36, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
.flow-tank-node {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(78, 184, 226, 0.15);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(16, 43, 67, 0.82), rgba(6, 23, 40, 0.86));
}
.flow-node-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #70d2ef;
  background: rgba(48, 166, 208, 0.12);
  font: 700 9px "JetBrains Mono", monospace;
}
.flow-tank-node strong,
.flow-tank-node small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-tank-node strong {
  color: #eef8ff;
  font-size: 10px;
}
.flow-tank-node small {
  margin-top: 3px;
  color: #637f98;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.flow-connector {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 46px;
  color: #56bee6;
}
.flow-connector::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, rgba(86, 190, 230, 0.15), rgba(86, 190, 230, 0.72), rgba(86, 190, 230, 0.15));
}
.flow-connector span {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 22px);
  padding: 4px 7px;
  overflow: hidden;
  border: 1px solid rgba(86, 190, 230, 0.16);
  border-radius: 20px;
  color: #9ddcf3;
  background: #0c2238;
  font-size: 7px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  white-space: nowrap;
}
.flow-connector i {
  position: absolute;
  z-index: 2;
  right: -1px;
  padding-left: 3px;
  background: #0b2035;
  font-size: 10px;
}
.storage-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(126, 184, 224, 0.14);
  border-radius: 13px;
  background: var(--card-bg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  animation: fadeIn 0.4s ease-out both;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.storage-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #3b82f6, transparent 88%);
}
.storage-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.4);
}
.storage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.tank-specs {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 12px 0;
}
.tank-spec-item {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(86, 190, 230, 0.09);
  border-radius: 8px;
  background: rgba(6, 20, 35, 0.5);
}
.tank-spec-item span,
.tank-spec-item strong {
  display: block;
}
.tank-spec-item span {
  margin-bottom: 5px;
  color: #68839b;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
}
.tank-spec-item strong {
  overflow: hidden;
  color: #b9deee;
  font: 700 clamp(11px, 0.85vw, 14px) "JetBrains Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tank-spec-item strong small {
  color: #6d879b;
  font-size: 8px;
}
.dimension-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.dimension-values b {
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid rgba(86, 190, 230, 0.09);
  border-radius: 6px;
  color: #d2ebf5;
  background: rgba(14, 39, 60, 0.62);
  font: 700 clamp(11px, 0.85vw, 14px) "JetBrains Mono", monospace;
  text-align: center;
  white-space: nowrap;
}
.dimension-values b small {
  display: block;
  margin-bottom: 3px;
  color: #638096;
  font: 600 6px "Inter", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.45px;
}
.dimension-values b em {
  color: #7090a5;
  font-size: 8px;
  font-style: normal;
}
.storage-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.storage-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.1);
  font-size: 14px;
}
.storage-title h3 { color: #fff; font-size: 14px; }
.storage-title small {
  display: block;
  margin-top: 3px;
  color: #657c95;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}
.level-badge {
  min-width: 72px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.09);
  font: 750 16px "JetBrains Mono", monospace;
  text-align: center;
}
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}
.storage-content {
  display: grid;
  grid-template-columns: minmax(210px, 0.9fr) minmax(0, 1.35fr);
  align-items: stretch;
}
.tank-visual {
  --level: 50;
  position: relative;
  min-height: 210px;
  margin: 12px 0 12px 12px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 25%, rgba(30, 64, 110, 0.35), rgba(3, 10, 22, 0.82));
}
.tank-shell {
  position: absolute;
  inset: 15% 8% 10% 14%;
  z-index: 2;
  border: 5px solid #536579;
  border-top-width: 8px;
  border-radius: 3px 3px 7px 7px;
  background:
    linear-gradient(90deg, transparent 32.5%, rgba(105, 128, 153, 0.32) 33%, transparent 33.5%, transparent 66%, rgba(105, 128, 153, 0.32) 66.5%, transparent 67%),
    linear-gradient(180deg, transparent 48.5%, rgba(105, 128, 153, 0.3) 49%, transparent 49.5%),
    rgba(16, 32, 52, 0.78);
  box-shadow:
    inset 0 0 0 2px rgba(8, 17, 31, 0.9),
    0 12px 24px rgba(0, 0, 0, 0.25);
}
.tank-shell::before,
.tank-shell::after {
  content: "";
  position: absolute;
  top: -12px;
  bottom: -8px;
  width: 6px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2c3d52, #718399, #2c3d52);
}
.tank-shell::before { left: -8px; }
.tank-shell::after { right: -8px; }
.tank-inner {
  position: absolute;
  inset: 7px;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.12);
  border-radius: 1px 1px 3px 3px;
  background: linear-gradient(180deg, rgba(2, 9, 20, 0.94), rgba(9, 26, 45, 0.86));
}
.tank-ladder {
  position: absolute;
  z-index: 5;
  left: 10px;
  top: -7px;
  bottom: -9px;
  width: 24px;
  border-left: 3px solid #73859a;
  border-right: 3px solid #73859a;
  background: repeating-linear-gradient(to bottom, transparent 0 13px, #73859a 13px 16px);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}
.tank-ladder::before,
.tank-ladder::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  height: 5px;
  border-radius: 2px;
  background: linear-gradient(180deg, #8a9bae, #3b4d62);
}
.tank-ladder::before { top: 0; }
.tank-ladder::after { bottom: 0; }
.tank-rim {
  position: absolute;
  z-index: 6;
  left: 12%;
  right: 6%;
  top: 13%;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, #8796a8, #3b4d63 60%, #26374b);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.animated-water {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--level) * 1%);
  max-height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(67, 217, 255, 0.72), rgba(14, 116, 208, 0.52));
  opacity: 0.82;
  transition: height 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.animated-water::before,
.animated-water::after {
  content: "";
  position: absolute;
  left: -10%;
  top: -8px;
  width: 120%;
  height: 18px;
  border-radius: 48%;
  background: rgba(150, 239, 255, 0.8);
  animation: waterWave 3.6s ease-in-out infinite;
}
.animated-water::after {
  top: -4px;
  opacity: 0.48;
  animation-delay: -1.8s;
  animation-direction: reverse;
}
.tank-level-overlay {
  position: absolute;
  z-index: 4;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 7px;
  color: #baf4ff;
  background: rgba(3, 12, 24, 0.78);
  font: 750 13px "JetBrains Mono", monospace;
  backdrop-filter: blur(5px);
}
.tank-scale {
  position: absolute;
  z-index: 5;
  top: 22%;
  right: 4%;
  bottom: 15%;
  width: 10px;
  border-right: 1px solid rgba(103, 232, 249, 0.45);
  background: repeating-linear-gradient(to bottom, rgba(103, 232, 249, 0.5) 0 1px, transparent 1px 20%);
}
@keyframes waterWave {
  0%, 100% { transform: translateX(-2%) translateY(0) rotate(-1deg); }
  50% { transform: translateX(2%) translateY(4px) rotate(1deg); }
}
.sensor-item {
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  background: rgba(4, 13, 25, 0.4);
  min-width: 0;
}
.sensor-item.level {
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
}
.level-track {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
}
.level-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #06b6d4, #38bdf8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
  transition: width 0.35s ease;
}
.sensor-label {
  display: block;
  margin-bottom: 6px;
  color: #7189a2;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
}
.sensor-value {
  color: #f1d952;
  font: 700 clamp(15px, 1.15vw, 19px) "JetBrains Mono", monospace;
  letter-spacing: -0.45px;
  white-space: nowrap;
  text-shadow: 0 0 16px rgba(241, 217, 82, 0.08);
}
.sensor-value small {
  color: #71869d;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0;
}
/* ===== TREND & HISTORY ===== */
#trendView.active {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trend-heading { align-items: center; }
.trend-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.trend-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 8px;
  color: #69e799;
  background: rgba(74, 222, 128, 0.08);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
.trend-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
  animation: blink 1.6s infinite;
}
.trend-live.history {
  color: #7ec8f2;
  border-color: rgba(56, 189, 248, 0.22);
  background: rgba(56, 189, 248, 0.09);
}
.trend-live.history i {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: none;
}
.trend-select-label {
  display: grid;
  gap: 3px;
  color: #71869d;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
.trend-select-label.compact { min-width: 150px; }
.trend-select-label.hidden { display: none; }
.trend-select {
  height: 34px;
  min-width: 130px;
  padding: 0 28px 0 10px;
  border: 1px solid rgba(126, 184, 224, 0.16);
  border-radius: 8px;
  outline: none;
  color: #d9e7f4;
  background: #0b192a;
  font: 600 9px "Inter", sans-serif;
  cursor: pointer;
}
.trend-select:focus { border-color: rgba(90, 158, 224, 0.55); }
.trend-select:disabled { opacity: 0.45; cursor: not-allowed; }
.trend-date-field { display: none; }
.trend-date-field.visible { display: grid; }
.trend-date-input {
  min-width: 145px;
  color-scheme: dark;
  padding-right: 8px;
}
.trend-last-update {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  color: #71869d;
  border: 1px solid rgba(126, 184, 224, 0.1);
  border-radius: 8px;
  background: rgba(8, 20, 36, 0.48);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.trend-last-update strong {
  color: #a8bdd2;
  font: 600 9px "JetBrains Mono", monospace;
}
.trend-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(56, 189, 248, 0.11);
  border-radius: 8px;
  color: #7890a8;
  background: rgba(14, 41, 65, 0.34);
  font-size: 9px;
}
.trend-notice i { color: #56bde8; }
.trend-grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.trend-card {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 11px;
  border: 1px solid rgba(126, 184, 224, 0.13);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(25, 43, 68, 0.95), rgba(11, 25, 43, 0.98));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.17);
}
.trend-card-wide { grid-column: span 2; }
.trend-card-header {
  min-height: 36px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.trend-card-header > div:first-child > span {
  display: block;
  margin-bottom: 2px;
  color: #5f7f9d;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.trend-card-header h3 {
  color: #f0f7ff;
  font-size: 14px;
  letter-spacing: -0.2px;
}
.trend-unit {
  padding: 5px 8px;
  border: 1px solid rgba(90, 158, 224, 0.13);
  border-radius: 6px;
  color: #86a8c5;
  background: rgba(4, 13, 25, 0.38);
  font: 600 8px "JetBrains Mono", monospace;
}
.trend-segment {
  display: flex;
  padding: 2px;
  border: 1px solid rgba(126, 184, 224, 0.11);
  border-radius: 7px;
  background: rgba(4, 13, 25, 0.42);
}
.trend-segment button {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: #637c94;
  background: transparent;
  font: 700 7px "Inter", sans-serif;
  cursor: pointer;
}
.trend-segment button.active {
  color: #dcebfa;
  background: rgba(59, 127, 196, 0.28);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}
.trend-legend {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  margin-top: 5px;
  color: #7890a8;
  font-size: 7px;
  white-space: nowrap;
}
.trend-legend span { display: inline-flex; align-items: center; gap: 4px; }
.trend-legend i { width: 12px; height: 2px; border-radius: 2px; }
.trend-canvas-wrap {
  min-height: 0;
  flex: 1;
  border: 1px solid rgba(126, 184, 224, 0.06);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(4, 13, 25, 0.2);
}
.trend-canvas-wide { height: auto; }
.trend-canvas-wrap canvas { display: block; width: 100%; height: 100%; }

/* ===== ALARM HISTORY ===== */
.alarm-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.alarm-summary-card {
  padding: 12px 14px;
  border: 1px solid rgba(126, 184, 224, 0.12);
  border-radius: 10px;
  background: rgba(12, 26, 45, 0.72);
}
.alarm-summary-card span {
  display: block;
  color: #71869d;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 5px;
}
.alarm-summary-card strong {
  color: #fff;
  font: 700 20px "JetBrains Mono", monospace;
}
.alarm-summary-card.critical strong { color: #f87171; }
.alarm-summary-card.warning strong { color: #fbbf24; }
.alarm-summary-card.acknowledged strong { color: #4ade80; }
.alarm-panel {
  overflow: hidden;
  border: 1px solid rgba(126, 184, 224, 0.13);
  border-radius: 12px;
  background: rgba(12, 26, 45, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.alarm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.alarm-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.alarm-filter,
.alarm-search {
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  outline: none;
  color: #b9c8d8;
  background: rgba(4, 13, 25, 0.55);
  font: 500 10px "Inter", sans-serif;
}
.alarm-filter { padding: 0 9px; cursor: pointer; }
.alarm-search { width: min(240px, 100%); padding: 0 10px; }
.alarm-search:focus, .alarm-filter:focus { border-color: rgba(90, 158, 224, 0.55); }
.alarm-table-wrap { overflow-x: auto; }
.alarm-table { width: 100%; border-collapse: collapse; min-width: 850px; }
.alarm-table th {
  padding: 10px 12px;
  color: #627991;
  background: rgba(4, 13, 25, 0.35);
  font-size: 8px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.alarm-table td {
  padding: 11px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: #aebed0;
  font-size: 10px;
  vertical-align: middle;
}
.alarm-table tr:hover td { background: rgba(59, 127, 196, 0.05); }
.alarm-code { color: #8ac9f1; font-family: "JetBrains Mono", monospace; }
.alarm-message { color: #e1e8f0; font-weight: 550; }
.severity-badge, .alarm-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 20px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.severity-badge.critical { color: #f87171; background: rgba(248, 113, 113, 0.1); }
.severity-badge.warning { color: #fbbf24; background: rgba(251, 191, 36, 0.1); }
.severity-badge.info { color: #62b6ed; background: rgba(98, 182, 237, 0.1); }
.alarm-state.active { color: #f87171; background: rgba(248, 113, 113, 0.08); }
.alarm-state.acknowledged { color: #4ade80; background: rgba(74, 222, 128, 0.08); }
.ack-btn {
  padding: 5px 8px;
  border: 1px solid rgba(90, 158, 224, 0.2);
  border-radius: 6px;
  color: #8ac9f1;
  background: rgba(59, 127, 196, 0.08);
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
}
.ack-btn:hover { background: rgba(59, 127, 196, 0.18); }
.ack-btn:disabled { color: #5e7186; cursor: default; background: transparent; }
.alarm-empty { padding: 34px; color: #71869d; text-align: center; font-size: 11px; }
/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.mmf-card {
  animation: fadeIn 0.4s ease-out both;
}
.mmf-card:nth-child(1) {
  animation-delay: 0.02s;
}
.mmf-card:nth-child(2) {
  animation-delay: 0.04s;
}
.mmf-card:nth-child(3) {
  animation-delay: 0.06s;
}
.mmf-card:nth-child(4) {
  animation-delay: 0.08s;
}
.mmf-card:nth-child(5) {
  animation-delay: 0.1s;
}
.mmf-card:nth-child(6) {
  animation-delay: 0.12s;
}
.mmf-card:nth-child(7) {
  animation-delay: 0.14s;
}
.mmf-card:nth-child(8) {
  animation-delay: 0.16s;
}
.mmf-card:nth-child(9) {
  animation-delay: 0.18s;
}
.mmf-card:nth-child(10) {
  animation-delay: 0.2s;
}
.mmf-card:nth-child(11) {
  animation-delay: 0.22s;
}
.mmf-card:nth-child(12) {
  animation-delay: 0.24s;
}
/* ===== RESPONSIVE ===== */
@media (max-width: 1400px) {
  #mmfView.active {
    display: block;
    height: auto;
  }
  .mmf-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
    padding-bottom: 20px;
  }
  #acfSoftenerView.active {
    display: block;
    height: auto;
  }
  .acf-softener-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    padding-bottom: 20px;
  }
}
@media (max-width: 1000px) {
  .mmf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .acf-softener-grid { grid-template-columns: 1fr; }
  .tank-storage-grid { grid-template-columns: 1fr; }
  .alarm-summary-grid { grid-template-columns: repeat(2, 1fr); }
  #trendView.active {
    display: block;
    height: auto;
    overflow: visible;
  }
  .trend-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding-bottom: 20px;
  }
  .trend-card-wide { grid-column: auto; }
  .trend-canvas-wrap, .trend-canvas-wide { height: 220px; flex: none; }
  .storage-process-flow {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .flow-connector {
    height: 46px;
  }
  .flow-connector::before {
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, rgba(86, 190, 230, 0.15), rgba(86, 190, 230, 0.72), rgba(86, 190, 230, 0.15));
  }
  .flow-connector i {
    right: auto;
    bottom: -1px;
    left: 50%;
    padding: 3px 0 0;
    transform: translateX(-50%) rotate(90deg);
  }
}
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .header {
    left: 0;
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger {
    display: flex;
  }
  .slideshow-indicator { width: 105px; }
  .mmf-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .main-content { padding: 14px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .summary { width: 100%; }
  .summary-item { flex: 1; text-align: left; }
  .mmf-grid { grid-template-columns: 1fr; }
  .combo-sections { grid-template-columns: 1fr; }
  .sensor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storage-content { grid-template-columns: 1fr; }
  .tank-visual { min-height: 230px; margin-right: 12px; }
  .tank-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dimension-spec { grid-column: 1 / -1; }
  .alarm-toolbar { align-items: stretch; flex-direction: column; }
  .alarm-search { width: 100%; }
  .trend-toolbar { width: 100%; justify-content: flex-start; }
  .trend-last-update { display: none; }
  .trend-card { padding: 11px; }
  .trend-card-header { flex-direction: column; }
  .trend-segment { width: 100%; }
  .trend-segment button { flex: 1; }
  .trend-canvas-wrap, .trend-canvas-wide { height: 210px; }
  .equipment-panel + .equipment-panel {
    border-left: 0;
    border-top: 1px solid rgba(139, 92, 246, 0.18);
  }
  .slideshow-indicator { display: none; }
  .header-clock { display: none; }
}
/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 190;
}
.sidebar-overlay.active {
  display: block;
}
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
