* {
  box-sizing: border-box;
}

.tab {
  overflow: hidden;
  border: 1px solid #ccc;
  background-color: #324254;
}

.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #202932;
  border-top: none;
}

input[type=text],
input[type=password],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical
}


body {
  margin: 0;
  font-family: Arial
}

.topnav {
  overflow: hidden;
  background-color: #004679;
}

.topnav a {
  float: left;
  display: block;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

.active {
  background-color: #003052;
  color: #FEC228;
}

.topnav .icon {
  display: none;
}

.dropdown {
  float: left;
  overflow: hidden;
}

.dropdown .dropbtn {
  font-size: 17px;
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.topnav a:hover,
.dropdown:hover .dropbtn {
  background-color: #202932;
  color: white;
  transition: .5s;
  cursor: pointer;
}

.dropdown-content a:hover {
  background-color: #ddd;
  color: black;
}

@keyframes fadeEffect {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.dropdown:hover .dropdown-content {
  display: block;
}

@media screen and (max-width: 1100px) {

  .topnav a,
  .dropdown .dropbtn {
    display: none;
  }

  .topnav a.icon {
    float: right;
    display: block;
  }
}

@media screen and (max-width: 1100px) {
  .topnav.responsive {
    position: relative;
  }

  .topnav.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }

  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }

  .topnav.responsive .dropdown {
    float: none;
  }

  .topnav.responsive .dropdown-content {
    position: relative;
  }

  .topnav.responsive .dropdown .dropbtn {
    display: block;
    width: 100%;
    text-align: left;
  }
}

.badge {
  background-color: #d55050;
  color: white;
  padding: 4px 8px;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.cslButton {
  background-color: #004679;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: bold;
}

.cslButton i {
  color: #FEC228;
}

.cslButton:hover {
  /*text-decoration: underline;*/
  background-color: #003052;
}

.cslLoginForm {
  margin: auto;
  width: 50%;
  border: 2px solid #04AA6D;
  padding: 10px;
}

@media screen and (max-width: 1100px) {
  .cslLoginForm {
    margin: auto;
    width: 95%;
    border: 2px solid #04AA6D;
    padding: 10px;
  }

  #btMenu {
    display: flex;
    flex-direction: column;
  }

  #btMenu>.cslButton {
    margin-bottom: 5px;
    text-align: center;
  }

  #btMenu>.cslButton:last-of-type {
    margin-bottom: 0px;
  }
}

#container-SI1 {
  display: none;
}

#bannerBottom {
  text-align: center; /* center the content inside */
  margin: 0 auto;     /* center the div if it has a fixed width */
  width: fit-content; /* adjust width to fit content, optional */
}

.mqttContentBlock {
  width: 90%;
  background-color: #324254;
  padding: 5px;
  border-radius: 10px;
  color: white;
  display: flex;
  align-items: center;
}

.mqttContentBlock:hover {
  cursor: pointer;
}

@media only screen and (max-width: 1000px) {
  .mqttContentBlock {
    width: 99%;
  }
}

#mqtt-icon-container {
  position: relative;
  min-width: 150px;
  min-height: 150px;
  background-color: #ececec;
  border-radius: 20px;
}

#mqtt-icon-container > i {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 100px;
  transform: translate(-50%, -50%);
  color: #324254;
}

#mqtt-icon-container > p {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 30px;
  transform: translate(-50%, -80%);
  z-index: 10;
}

#mqtt-description-container {
  width: inherit;
  font-size: 18px;
  padding: 0px 10px;
}

#mqtt-visit-icon-container {
  position: relative;
  min-width: 150px;
  min-height: 150px;
  background-color: #ececec;
  border-radius: 20px;
}

#mqtt-visit-icon-container > i {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 100px;
  transform: translate(-50%, -65%);
  color: #324254;
}

#mqtt-visit-icon-container > p {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: 30px;
  font-weight: bold;
  transform: translate(-50%, -10%);
  z-index: 10;
  color: #324254;
}

.loading-overlay[hidden] { display: none !important; }
.loading-overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,0.35); z-index: 9999;
}
.loading-card {
  display: flex; align-items: center; gap: .75rem;
  background: #fff; padding: 1rem 1.25rem; border-radius: .75rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  font: 500 14px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #ddd; border-top-color: #555;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media only screen and (max-width: 768px) {
  .mqttContentBlock {
    flex-wrap: wrap;
    justify-content: center;
  }

  #mqtt-icon-container {
    order: 0;
    width: calc(50% - 10px);
    margin-right: 10px;
  }

  #mqtt-description-container {
    padding-top: 10px;
    order: 2;
  }

  #mqtt-visit-icon-container {
    order: 1;
    width: calc(50% - 10px);
  }

}

/* Light theme tokens (override as needed) */
:root {
  --io-bg: #ffffff;
  --io-panel-bg: #f7f8fa;
  --io-text: #1c1f23;
  --io-muted: #6b7280;
  --io-border: #e5e7eb;
  --io-on: #16a34a;
  --io-off: #9ca3af;
  --io-error: #ef4444;
  --io-disabled: #d1d5db;
  --io-shadow: 0 2px 8px rgba(0,0,0,.06);
}

/* Panel */
.io-panel {
  background: var(--io-panel-bg);
  border: 1px solid var(--io-border);
  border-radius: 16px;
  padding: 16px;
}

.io-title {
  color: var(--io-text);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 12px 4px;
}

/* Grid of tiles */
.io-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* Tile */
.io-tile {
  position: relative;
  background: var(--io-bg);
  border: 1px solid var(--io-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--io-shadow);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 140px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  z-index: 0;
}

.io-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
  z-index: 2;
}

/* Gear button inside tile */
.io-gear {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--io-border);
  background: var(--io-bg);
  border-radius: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}

.io-gear i { font-size: 14px; color: var(--io-muted); }
.io-gear:hover { border-color: #c7cad1; transform: scale(1.03); }

/* Header row */
.io-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.io-name {
  font-weight: 600;
  color: var(--io-text);
  letter-spacing: .2px;
}

/* Status dot reflects state via tile class */
.io-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--io-off);
  box-shadow: inset 0 0 0 2px #fff;
  border: 1px solid var(--io-border);
}

/* Main icon */
.io-icon {
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--io-muted);
}

/* Footer (status text) */
.io-foot {
  text-align: center;
  font-size: .85rem;
  color: var(--io-muted);
  font-weight: 600;
  letter-spacing: .3px;
}

/* State styles */
.io-tile.is-on {
  border-color: rgba(22, 163, 74, .25);
  box-shadow: 0 2px 10px rgba(22,163,74,.06);
}
.io-tile.is-on .io-dot { background: var(--io-on); }
.io-tile.is-on .io-icon, .io-tile.is-on .io-foot { color: var(--io-on); }

.io-tile.is-off .io-dot { background: var(--io-off); }
.io-tile.is-off .io-icon, .io-tile.is-off .io-foot { color: var(--io-off); }

.io-tile.is-error {
  border-color: rgba(239, 68, 68, .3);
  box-shadow: 0 2px 12px rgba(239,68,68,.08);
}
.io-tile.is-error .io-dot { background: var(--io-error); }
.io-tile.is-error .io-icon, .io-tile.is-error .io-foot { color: var(--io-error); }

.io-tile.is-disabled {
  opacity: .65;
}
.io-tile.is-disabled .io-dot { background: var(--io-disabled); }
.io-tile.is-disabled .io-icon, .io-tile.is-disabled .io-foot { color: var(--io-disabled); }

/* Focus (keyboard accessibility) */
.io-gear:focus-visible,
.io-tile:focus-within {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 14px;
}

/* Bottom-right info icon */
.io-info {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  z-index: 2;
}

/* Popover panel */
.io-popover {
  position: absolute;
  right: 8px;
  bottom: 48px; /* above the info icon */
  min-width: 220px;
  max-width: 260px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: 8px;
  display: none;
  z-index: 3;
}

/* Arrow */
.io-popover::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: -8px;
  width: 14px; height: 14px;
  background: #fff;
  border-left: 1px solid #e5e7eb;
  border-top: 1px solid #e5e7eb;
  transform: rotate(45deg);
}

/* Show on click (we toggle .show-info in JS) */
.io-tile.show-info .io-popover { display: block; }

/* Show on tap/click (mobile) */
.io-tile.show-info .io-popover { display: block; }

/* The tile with an open info panel should be on top of everything nearby */
.io-tile.show-info { z-index: 999; }

/* Popover itself should sit above its tile content */
.io-popover { position: absolute; z-index: 1000; }

/* (Optional) If you use transforms anywhere on tiles, keep the open one above all */
.io-tile.show-info { transform: none; } /* remove if you prefer the hover lift even when open */

/* Settings list inside popover */
.io-meta {
  list-style: none;
  margin: 0; padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: .85rem;
}
.io-meta li { display: flex; justify-content: space-between; gap: 8px; }
.io-meta li span { color: #6b7280; }
.io-meta li strong { color: #111827; font-weight: 700; }

/* Disabled tile look stays slightly muted */
.io-tile.is-disabled { opacity: .85; }

/* Counter pill */
.io-counter {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: none;                 /* hidden by default; JS shows in mode=2 */
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  font-size: .85rem;
  z-index: 2;                    /* above tile body */
}
.io-counter i { font-size: .9em; color: #6b7280; }
.io-tile.is-disabled .io-counter { opacity: .7; }  /* muted if disabled */

/* Optional: compact on very small tiles */
@media (max-width: 480px) {
  .io-counter { padding: 4px 8px; font-size: .8rem; }
}


/* ---------- Modal ---------- */
.io-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.io-modal.show { display: flex; }
.io-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
}
.io-modal__card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  width: 400px;
  z-index: 1;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.io-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.io-modal__close {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
}

.io-form { display: flex; flex-direction: column; gap: 10px; }
.io-label { font-weight: 600; color: #222; }
.io-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
}
.io-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-secondary {
  background: #f5f5f5;
  color: #333;
}

/**DIGITAL OUTPUTS**/

.io-title { margin: 0 0 12px; font-size: 1.25rem; font-weight: 600; }

.io-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.btn { padding: 6px 10px; border: 1px solid #e0e0e0; background: #fff; border-radius: 8px; cursor: pointer; }
.btn:active { transform: translateY(1px); }

.io-grid { display: grid; gap: 12px; }
.io-grid-do { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.io-tile {
  position: relative;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .2s, box-shadow .2s;
}
.io-tile:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.io-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.io-name { font-weight: 600; }
.io-dot { width: 10px; height: 10px; border-radius: 50%; background: #c6c6c6; }

.io-icon { font-size: 22px; opacity: .9; margin-bottom: 10px; }
.io-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.io-toggle { width: 100%; text-transform: uppercase; font-weight: 600; }

.io-tile.is-on { border-color: #ccead1; }
.io-tile.is-on .io-dot { background: #27ae60; }
.io-tile.is-on .io-toggle { background: #e8f7ee; }

.io-tile.is-off { border-color: #eee; }
.io-tile.is-off .io-dot { background: #c6c6c6; }
.io-tile.is-off .io-toggle { background: #f6f6f6; }

.io-tile.is-disabled { opacity: .55; }
.io-tile.is-disabled .io-toggle { cursor: not-allowed; }


/* --- Universal Card Layout --- */
.card {
  background: #fafafa;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 20px;
  font-weight: 600;
}

.card-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card label {
  font-size: 14px;
  font-weight: 500;
  display: block;
  margin-bottom: 3px;
}

.card input[type=text],
.card input[type=number],
.card input[type=file],
.card textarea,
.card select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #7e7e7e;
  border-radius: 6px;
  font-size: 14px;
}

.card textarea {
  resize: vertical;
  min-height: 80px;
}

.card hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 15px 0;
}

#page-wrapper {
  max-width: 1100px;     /* set your desired desktop width */
  margin: 0 auto;        /* center horizontally */
  padding: 0 20px;       /* small side padding */
}

/* Full width layout on mobile */
@media screen and (max-width: 1100px) {
  #page-wrapper {
    max-width: 100%;     /* allow full width */
    padding: 0 10px;     /* smaller padding for phones */
  }
}

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hide text on desktop */
.menu-text {
  display: none;
  margin-left: 8px;
}

/* Tooltip text from the data-label attribute */

/* MOBILE MODE — show text next to icons */
@media screen and (max-width: 1100px) {
  .menu-text {
    display: inline;
  }

  .cslButton {
    display: flex;
    align-items: center;
    font-size: 18px;
    justify-content: flex-start;
    gap: 10px;
  }

  .cslButton i {
    font-size: 20px;
  }

  .menu-text {
        display: inline-block;
    }

    .menu-item {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .menu-item:hover::after {
        content: none; /* disable tooltip on touch devices */
    }
}

.menu-item:hover::after {
    content: attr(data-label);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #202932;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    margin-left: 8px;
    font-size: 14px;
    z-index: 2000;
    pointer-events: none;
}

.active i {
  color: #FEC228;
}

.active .menu-text {
  font-weight:bold;
}