html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  color-scheme: dark;
  /* Gradient on html itself so the correct background shows immediately on
     page transitions — before the stylesheet-driven .background::before renders */
  background: linear-gradient(to bottom, #ff8705 0%, #000000 100%);
  background-attachment: fixed;
}

html[data-theme="light"] {
  color-scheme: light;
  background: linear-gradient(to bottom, #ff8705 0%, #f0f2f5 100%);
  background-attachment: fixed;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
}

.background {
  min-height: 100vh;
  display: flex;
  width: 100%;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  isolation: isolate;
}

/* Background gradient and pulse animation live on a pseudo-element so that
   the filter never touches .background itself — a filter on any real ancestor
   breaks position:fixed by turning that ancestor into a containing block. */
.background::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, #ff8705 0%, #000000 100%);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center top;
  animation: pulseFilterbg 8s infinite ease-in-out;
  pointer-events: none;
}

@keyframes pulseFilterbg {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(1.3); }
}


/* Top navigation bar */
.topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  width: 100%;
  background-color: #1e1f2b; /* orange */
  box-shadow: 0 2px 6px rgba(0,0,0,0.2); /* subtle shadow for depth */
}

.mainnav-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: white;
  transition: color 0.2s;
}

.mainnav-status:hover {
  color: #ff8705;
  text-shadow:
    0 0 5px #ff8705,
    0 0 10px #ff8705,
    0 0 20px #ff8705;
}

.mainnav-left,
.mainnav-right {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.topnav-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.popup_message_send {
  color: white;
}

/* Links inside navigation bar */
.topnav a {
  color: black;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
  font-family: "Arial", sans-serif;
}

.topnav a:hover {
  background-color: #29180b;
  color: white;
}

.topnav a.active {
  background-color: #04AA6D;
  color: white;
}

/* Responsive adjustments */
@media screen and (max-width: 965px) {
  .topnav_link {
    flex: 1 1 25%; /* flexible width */
  }

  .button {
    flex: 1 1 24%; /* keep buttons aligned */
  }

  .first {
    background-size: 110%; /* zoom background */
  }
}

@media screen and (max-width: 715px) {
  .button {
    flex: 1 1 24%;
  }

  .topnav_link {
    flex: 1 1 25%;
  }
}

@media screen and (max-width: 600px) {
  .topnav_left,
  .topnav_right {
    flex: 1 1 100%;
    justify-content: center;
  }

  .button,
  .button_logout {
    width: 100%;
  }

  .first {
    background-size: 180%; /* zoom further for small screens */
  }
}

.mainnav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  height: 52px;
  background-color: #1e1f2b;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  box-sizing: border-box;
  gap: 12px;
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  z-index: 200;
  transition: left 0.25s ease;
}

.admin-sidebar.collapsed ~ .admin-main .mainnav {
  left: 56px;
}

/* Public navbar (unauthenticated) — full-width frosted glass over the gradient */
.background > header .mainnav {
  left: 0;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

/* Public navbar dark mode — non-transparent base so backdrop-filter doesn't render black */
.background > header .mainnav .button {
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.75) !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
}
.background > header .mainnav .button::before {
  background: #ffffff;
}
.background > header .mainnav .button:hover {
  color: #1a1a1a !important;
}

/* Public navbar — nav links: faint underline always visible, bright orange slides in on hover */
.background > header .mainnav .mainnav-left a::before {
  display: none !important;
}

.background > header .mainnav .mainnav-left a {
  color: #fff;
  background-image:
    linear-gradient(#ff8705, #ff8705),
    linear-gradient(rgba(255, 135, 5, 0.35), rgba(255, 135, 5, 0.35));
  background-size: 0% 2px, 100% 2px;
  background-repeat: no-repeat, no-repeat;
  background-position: left bottom, left bottom;
  transition: background-size 0.35s ease, color 0.3s ease;
}

.background > header .mainnav .mainnav-left a:hover {
  color: #fff !important;
  background-size: 100% 2px, 100% 2px;
}

/* Public navbar — theme toggle white */
.background > header .mainnav .theme-toggle-btn {
  border-color: rgba(255, 255, 255, 0.75);
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08);
  transition: background-color 0.25s ease, color 0.25s ease;
}
.background > header .mainnav .theme-toggle-btn::before {
  background: #ffffff;
}
.background > header .mainnav .theme-toggle-btn:hover {
  color: #1a1a1a;
}

.mainnav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.mainnav-sitename {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.mainnav-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow: visible;
}

.mainnav-right {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Compact nav buttons — override the large .button defaults */
.mainnav-right .button,
.mainnav-right button.button {
  min-width: unset !important;
  height: 28px !important;
  padding: 0 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  border: 1px solid #ff8705 !important;
  border-radius: 4px !important;
  line-height: 28px !important;
  white-space: nowrap;
}

.mainnav-right .button span,
.mainnav-right button.button span {
  font-size: 11px !important;
}

.mainnav-right form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.mainnav a {
  color: black;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
  font-family: "Arial", sans-serif;
}

.mainnav a:hover {
  background-color: #29180b;
  color: white;
}

/* Active link in main navigation */
.mainnav a.active {
  background-color: #04AA6D;
  color: white;
}

@media screen and (max-width: 768px) {
  .mainnav {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .mainnav-left,
  .mainnav-right {
    flex-direction: column;
    width: 100%;
    justify-content: center;
  }

  .topnav_link,
  .button {
    width: 90%;
    margin: 5px 0;
    font-size: 16px;
  }
}

.mainnav-left a {
  position: relative;
  display: inline-block;
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
  transition: color 0.4s ease; /* smoother text transition */
}

.mainnav-left a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #ff8705;
  opacity: 0; /* start invisible */
  transition: left 1s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 1s ease; /* fade + smooth slide */
  z-index: 0;
}

.mainnav-left a span {
  position: relative;
  z-index: 1; /* keep text above background */
}

.mainnav-left a:hover::before {
  left: 0;     /* slide in */
  opacity: 1;  /* fade in */
}

.mainnav-left a:hover {
  color: #000; /* flip text color */
  background: transparent;

}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  height: 50px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: #ff9800 !important;              /* text starts orange */
  border: 2px solid #ff8705;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.3s ease;
  text-decoration: none;
}

.button span {
  width: 100%;
  text-align: center;
}

/* sliding background */
.button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #ff8705;
  transition: left 0.3s ease;
  z-index: 0; /* keep background behind text */
}

/* text stays above background */
.button span {
  position: relative;
  z-index: 1; /* ensures text is above ::before */
}

/* hover effect */
.button:hover::before {
  left: 0; /* slide background in */
}

.button:hover {
  color: white !important; /* flip text color */
  background-color:transparent;
}

/* keep text above the sliding background */
.button span {
  position: relative;
  z-index: 1;
}



.button:active {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.button_logout,
.signup_button,
.login_button,
.start_button {
  composes: button; /* if using CSS modules */
  /* OR just add .button to their HTML alongside their specific class */
}

/* Background */
.login-body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to bottom right, #2c2f48, #0e0f1c);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* Make the whole viewport a flex container */
.login-wrapper {
  display: flex;
  justify-content: center;   /* horizontal */
  align-items: center;       /* vertical */
  min-height: 90vh;         /* full screen height */
  background: transparent;
}

/* Style the box itself */
.login-box {
  background-color: #1e1f2b;
  padding: 2.5rem 2.5rem 2rem;
  border-top: 3px solid #ff8705;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  width: 400px;
  max-width: calc(100% - 32px);
  text-align: center;
}

.back-box-header {
  display: flex;
  align-items: center;   /* vertically align logo and text */
  gap: 20px;             /* space between logo and heading */
}

/* Logo */
.login-logo {
  width: 60px;
  margin-bottom: 1rem;
}

.home-logo {
    display: block;
    text-align: center;
}

.home-logo img {
    display: inline-block;
    width: 40px;        /* prevents overflow */
    height: auto;           /* optional: control size */
}

/* Headline */
.login-box h2 {
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.login-subtitle {
  color: #777;
  font-size: 0.875rem;
  margin: 0 0 1.75rem;
}

/* Inputs */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #3a3b4c;
  border-radius: 6px;
  background-color: #2a2b3c;
  color: #fff;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #ff8705;
  outline: none;
}

/* Password toggle */
.password-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 10px;
  cursor: pointer;
  color: #aaa;
}

/* Button */
button {
  text-decoration: none;
  width: 100%;
  padding: 0.75rem;
  background-color: transparent;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

/* Links */
.login-links {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.login-links a:hover {
  color: #ff9800; /* bright orange on hover */
}

.login-links a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}

/* Solid orange CTA button inside login / signup boxes */
.login-box .button,
.signup-box .button {
  background-color: #ff8705;
  color: #fff !important;
  border-color: #ff8705;
  margin-top: 0.25rem;
}
.login-box .button::before,
.signup-box .button::before {
  background: #cc6a00;
}
.login-box .button:hover,
.signup-box .button:hover {
  color: #fff !important;
}

/* Fix browser autofill yellow in dark mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #2a2b3c inset !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
  border-color: #3a3b4c !important;
  transition: background-color 5000s ease-in-out 0s;
}

.error-message {
  color: red;
  margin-bottom: 1rem;
}

/* Target the UL wrapper */
.errorlist-signup {
    list-style: none;   /* remove bullets */
    margin: 0;          /* reset margins */
    padding: 0;         /* reset padding */
}

/* Target the LI items inside */
.errorlist-signup li {
    list-style: none;   /* remove bullets */
    margin: 0;
    padding: 0;
    color: #cc0000;     /* red text */
    font-weight: bold;
}

/* Centered content blocks */
.center {
  text-align: center;
  border-radius: 15px;
  border: 10px solid #333;
  background-color: #333;
  padding: 50px 0;
}

.client_name {
  display: block;
  font-size: 2em;
  margin: 0.67em 0;
  margin-left: 30px; /* added px unit */
  font-weight: bold;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.main_body {
  opacity: 1;
  animation: fadeIn 0.5s ease-in;
  flex: 1;
  display: flex;
  flex-direction: column;
}

header {
  position: relative; /* default */
}

.div_login,
.div_signup {
  width: 95%;
  max-width: 500px;
  color: white;
  font-size: 17px;
  border-radius: 15px;
  background-color: #854908;
  opacity: 0.9;
  margin: auto;
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  padding: 2rem;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
}

/* Background wrapper (same as login/signup) */
.about-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  background: transparent;
}

/* About box (similar to login-box) */
.div_about {
  background-color: #1e1f2b;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  max-width: 700px;
  color: #fff;
  font-size: 17px;
  opacity: 0.95;
}

.div_reset {
  color: #fff;
  font-size: 17px;
}

/* Paragraph styling */
.div_paragraph h3 {
  color: #ff9800; /* orange accent like hover links */
  margin-bottom: 1rem;
}

.div_paragraph p {
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* Login panel: compact and vertically centered */
.div_login {
  max-width: 500px;
  height: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Signup panel: same layout as login */
.div_signup {
  max-width: 500px;
  height: 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.red-btn {
  background-color: black;
  color: white;
}

.red-btn:hover {
  background-color: #29180b;
}
.disabled-btn {
  background-color: #e0e0e0; /* soft gray */
  color: #888;              /* muted text */
  cursor: not-allowed;
  border: none;
  border-radius: 4px;
}
.relay-on {
  background-color: #FFA500;
  color: white;
  animation: pulse-glow 1.2s infinite;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: bold;
}

.relay-btn {
  min-width: 100px;   /* ensures consistent width */
  min-height: 40px;   /* ensures consistent height */
  padding: 8px 16px;  /* consistent padding */
  border-radius: 4px; /* consistent shape */
  font-weight: bold;  /* consistent text weight */
  text-align: center; /* centers text */
}

.serial-btn {
  display: inline-block;   /* allows width/height/padding to apply */
  min-width: 100px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  background-color: #854908; /* optional: give it a button look */
  color: white;             /* ensure text is visible */
  text-decoration: none;    /* remove underline */
  cursor: pointer;          /* make it feel clickable */
}
.serial-btn:hover {
  background-color: #FFA500; /* bright orange hover */
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 4px #FFA500, 0 0 6px #FFA500;
  }
  50% {
    box-shadow: 0 0 8px #FFA500, 0 0 12px #FFA500;
  }
  100% {
    box-shadow: 0 0 4px #FFA500, 0 0 6px #FFA500;
  }
}

/* Inputs: keep text white */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 6px;
  background-color: #2a2b3c;
  color: #fff; /* bright white text */
}

/* Labels: softer gray for contrast */
label {
  display: block;
  margin-bottom: 0.5rem;
  color: #ccc; /* softer gray instead of pure white */
  font-weight: 500;
}

/* Background wrapper */
.signup-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90vh;
  background: transparent;
}

/* Signup box */
.signup-box {
  background-color: #1e1f2b;
  padding: 2.5rem 2.5rem 2rem;
  border-top: 3px solid #ff8705;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  width: 400px;
  max-width: calc(100% - 32px);
  text-align: center;
}

/* Logo */
.signup-logo {
  width: 60px;
  margin-bottom: 1rem;
}

/* Headline */
.signup-box h2 {
  color: #fff;
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

/* Inputs */
.form-input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 6px;
  background-color: #2a2b3c;
  color: #fff;
}

/* Labels */
label {
  display: block;
  margin-bottom: 0.5rem;
  color: #ccc; /* softer gray for hierarchy */
  font-weight: 500;
  text-align: left;
}

/* Password toggle */
.password-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 10px;
  cursor: pointer;
  color: #aaa;
  font-size: 1.2rem;
}

.toggle-password:hover {
  color: #ff9800;
}

/* Button */
.login_button {
  width: 100%;
  padding: 0.75rem;
  background-color: #007acc;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.login_button:hover {
  background-color: #005fa3;
}

.home-wrapper {
  display: block;
  background: transparent;
  padding: 10px;
  text-align: center;
}

.footer {
  background-color: rgba(0, 0, 0, 0.55);
  color: #fff;
  text-align: center;
  padding: 10px;
  font-size: 14px;
}

/* Offset footer past the fixed sidebar so it doesn't overlap it */
.background:has(.admin-sidebar) .footer {
  margin-left: 260px;
  transition: margin-left 0.25s ease;
}
.background:has(.admin-sidebar.collapsed) .footer {
  margin-left: 56px;
}

#loading-overlay {
  display: none;          /* hidden by default */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: transparent;
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.relay-row {
  display: flex;          /* puts children side by side */
  gap: 10px;              /* spacing between buttons */
}

.relay-row form {
  margin: 0;              /* remove default spacing */
}

/* ── Relay stat-cards (device detail Actions section) ── */
.relay-card {
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.relay-card:hover { border-color: #ff8705; }

.relay-card-on {
  border-color: #ff8705;
  box-shadow: 0 0 10px rgba(255, 135, 5, 0.25);
}
.relay-card-on .bms-card-icon  { color: #ff8705; }
.relay-card-on .bms-card-value { color: #ff8705; }

.relay-card-off .bms-card-icon  { color: #444; }
.relay-card-off .bms-card-value { color: #555; }
.relay-card-off .bms-card-label { color: #666; }
.relay-card-off .bms-card-sub   { color: #555; }

.relay-card-skeleton {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* Relay status area — indicator and timestamp share the same slot */
#relay-loading.htmx-indicator            { display: none; opacity: 1; }
#relay-loading.htmx-indicator.htmx-request { display: inline-flex; }
#relay-loading.htmx-request ~ .relay-ts { display: none; }

/* Compact grid for action section cards (relay + serial) */
.relay-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

/* Smaller variant — relay cards */
.relay-card-sm {
  padding: 10px 12px;
  gap: 3px;
}
.relay-card-sm .bms-card-icon  { font-size: 16px; }
.relay-card-sm .bms-card-value { font-size: 20px; }
.relay-card-sm .bms-card-sub   { font-size: 11px; }

/* Even smaller — serial card */
.relay-card-xs {
  padding: 8px 10px;
  gap: 2px;
}
.relay-card-xs .bms-card-icon  { font-size: 14px; }
.relay-card-xs .bms-card-value { font-size: 15px; }
.relay-card-xs .bms-card-label { font-size: 10px; }
.relay-card-xs .bms-card-sub   { font-size: 10px; }

.relay-card-serial {
  border-color: #00BFFF;
  box-shadow: 0 0 10px rgba(0, 191, 255, 0.25);
}
.relay-card-serial .bms-card-icon  { color: #00BFFF; }
.relay-card-serial .bms-card-value { color: #00BFFF; }

.serial-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00BFFF;
  margin-left: auto;
  animation: pulse-serial 1.4s ease-in-out infinite;
}

@keyframes pulse-serial {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 191, 255, 0.6); opacity: 1; }
  50%       { box-shadow: 0 0 0 5px rgba(0, 191, 255, 0);  opacity: 0.7; }
}

.green-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #00ff00; /* bright green */
  box-shadow: 0 0 6px #00ff00, 0 0 12px #00ff00;
  margin-left: 4px; /* spacing after text */
}

.red-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #8B0000;
  box-shadow: 0 0 6px #8B0000, 0 0 12px #8B0000;
  margin-left: 4px; /* spacing after text */
}

@keyframes pulse-green {
  0%   { box-shadow: 0 0 4px #00ff00, 0 0 6px #00ff00; }
  50%  { box-shadow: 0 0 8px #00ff00, 0 0 16px #00ff00; }
  100% { box-shadow: 0 0 4px #00ff00, 0 0 6px #00ff00; }
}

.green-dot {
  animation: pulse-green 1.2s infinite;
}

.blue-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #00BFFF; /* bright green */
  box-shadow: 0 0 6px #00BFFF, 0 0 12px #00BFFF;
  margin-left: 4px; /* spacing after text */
}

.blue-dot {
  animation: pulse-blue 1.2s infinite;
}

@keyframes pulse-blue {
  0%   { box-shadow: 0 0 4px #00BFFF, 0 0 6px #00BFFF; }
  50%  { box-shadow: 0 0 8px #00BFFF, 0 0 16px #00BFFF; }
  100% { box-shadow: 0 0 4px #00BFFF, 0 0 6px #00BFFF; }
}

.download-btn {
  display: inline-block;   /* allows width, height, padding */
  background-color: black;
  color: white;
  padding: 8px 16px;       /* give it button shape */
  border-radius: 4px;      /* rounded corners */
  text-decoration: none;   /* remove underline */
  font-weight: bold;
  cursor: pointer;
}

.download-btn:hover {
  background-color: #29180b;
}

.devices-heading {
  background-color: #333; /* match table grey */
  color: #854908;               /* dark text for contrast */
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: bold;
  margin-bottom: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.tech-button-group {
  display: flex;
  gap: 10px;
}

.tech-button:hover {
  background-color: #29180b;
}

.form-flex {
  display: flex;
  align-items: stretch; /* ensures all children take full height */
  gap: 12px;
}

.form-inputs input[type="text"],
.form-inputs select,
.tech-button {
  flex: 1;
  max-width: 400px;     /* expands but doesn’t get too huge */
  min-width: 200px;
  border-radius: 4px;
  border: 0px solid #ccc;
  box-sizing: border-box;
  transition: border-color 0.2s ease, border-width 0.2s ease, color 0.2s ease;
}

.tech-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  height: 40px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 1;         /* match input line-height */
  border-radius: 4px;
  background-color: black;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-family: inherit;
  text-decoration: none;

}

.tech-control {
  height: 40px;
  font-size: 14px;
  border-radius: 4px;
  box-sizing: border-box;
  padding: 0 12px;
  display: flex;              /* flex container */
  align-items: center;        /* vertically center text */
  justify-content: center;    /* horizontally center text */
}

/* When hovering over the input */
.form-inputs input[type="text"]:hover,
.form-inputs select:hover {
  border-color: orange;
  border-width: 2px;
}

/* Change placeholder color on hover */
.form-inputs input[type="text"]:hover::placeholder,
.form-inputs select:hover::placeholder {
  color: orange;          /* matches border color */
}

/* Focus (selected) state */
.form-inputs input[type="text"]:focus,
.form-inputs select:focus {
  border-color: orange;    /* highlight color when selected */
  border-width: 2px;        /* keep consistent thickness */
  outline: none;            /* remove default browser outline */
}

/* Floating Button */
.floating-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 60px;
  height: 60px;
  border-radius: 50%;      /* perfect circle */
  font-size: 1.8rem;       /* icon size */
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #854908;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.floating-button:hover {
  background-color: #FFA500;   /* darker shade on hover */
  transform: scale(1.1);       /* slight zoom effect */
  box-shadow: 0 6px 12px rgba(0,0,0,0.3); /* deeper shadow */
}


.popup-form {
  display: none;              /* hidden by default */
  position: fixed;            /* stays in viewport */
  bottom: 100px;              /* above your floating button */
  right: 20px;                /* aligned with button */
  background: #000;           /* black background */
  border: 2px solid orange;   /* bold orange border */
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 8px 20px rgba(255, 140, 0, 0.6), /* warm orange glow */
              0 4px 12px rgba(0,0,0,0.4);        /* deeper dark shadow */
  z-index: 2000;              /* sits above other elements */
}

.popup-form.active {
  display: block;             /* show when toggled */
  animation: popup-glow 0.6s ease-out;
}

@keyframes popup-glow {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255,165,0, 0.7);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255,165,0, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255,165,0, 0.7);
  }
}

#restartForm {
  display: flex;
  gap: 1rem;
  align-items: stretch;   /* children same height */
}

.popup-input-text {
  flex: 1;
  min-width: 250px;
  height: 50px;           /* fixed height */
  box-sizing: border-box; /* include borders/padding */
  padding: 0 12px;
  border: 2px solid orange;
  border-radius: 6px;
  background-color: #111;
  color: #fff;
  font-size: 14px;
  line-height: 1;         /* normalize baseline */
}

#restartForm .button {
  display: flex;          /* flex container for centering */
  align-items: center;    /* vertical centering */
  justify-content: center;
  height: 50px;           /* exact match to input */
  padding: 0 16px;        /* horizontal only */
  line-height: 1;         /* kill default button line-height */
  border: 2px solid orange; /* match input border if needed */
  border-radius: 6px;
}

#restartForm .button > span {
  line-height: 1;         /* prevent span text from sinking */
  display: inline-block;
}

.select_refresh {
  padding: 6px 12px;
  margin-left: 10px;          /* spacing from the label */
  border: 1px solid #ccc;     /* subtle border */
  border-radius: 4px;         /* rounded corners */
  background-color: #1e1e1e;
  border-color: #1e1e1e;/* dark background to match admin panel */
  color: orange;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;           /* remove default browser styling */
  transition: border-color 0.2s, box-shadow 0.2s;
}

.select_refresh:hover {
  border-color: orange;
}

.select_refresh:focus {
  outline: none;
  border-color: orange;
  box-shadow: 0 0 4px rgba(0, 122, 204, 0.6);
}

/* Django Tables 2 pagination */
.pagination .page-link {
    background-color: #1e1e1e;
    color: orange;              /* white text */
    border: 1px solid orange;
    transition: all 0.3s ease;
}

/* Hover effect */
.pagination .page-link:hover {
    background-color: orange;
    color: black;
    border: 1px solid black;
    box-shadow: 0 0 10px 2px rgba(255, 165, 0, 0.7);
}

/* Active page button */
.pagination .page-item.active .page-link {
    background-color: orange; /* blue for active */
    border-color: orange;
    color: black;
    box-shadow: 0 0 10px 2px rgba(255, 165, 0, 0.7);
}

/* Popup Window in FAQ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;              /* flex instead of grid for simplicity */
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay[hidden] { display: none; }

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
  display: flex;
}

.modal {
  background: #fff;           /* white background so it’s visible */
  color: #000;
  padding: 2rem;
  border-radius: 8px;
  width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1001;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  visibility: hidden;
}

.custom-modal {
  background: #1e1f2b;
  color: #000;
  padding: 2rem;
  border-radius: 8px;
  width: 80vw;              /* 80% of viewport width */
  max-width: 1200px;        /* optional cap for huge screens */
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1001;
  /* Fade animation */
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  /* Prevent overflow */
  max-height: 80vh;         /* 80% of viewport height */
  overflow-y: auto;         /* scroll internally if content exceeds */
}

.modal-overlay.show .custom-modal {
  opacity: 1;
  transform: translateY(0);
}

.faq_paragraph h2,
.faq_paragraph h3 {
  color: #ff9800; /* orange accent like hover links */
  margin-bottom: 1rem;
}

.faq_paragraph p {
  margin-bottom: 1rem;
  line-height: 1.5;
  color: #ff9800;
}

/* Scale down for tablets */
@media (max-width: 768px) {
  .custom-modal {
    width: 90vw;
    max-height: 85vh;
    padding: 1.5rem;
  }
}

/* Scale down for phones */
@media (max-width: 480px) {
  .custom-modal {
    width: 95vw;
    max-height: 90vh;
    padding: 1rem;
    border-radius: 6px;
  }

  .custom-modal img {
    width: 95%;   /* make image larger on phones */
    height: auto; /* keep aspect ratio */
  }
}

@media (max-width: 600px) {
  .responsive-img {
    width: 90%;   /* take more width on phones */
  }
}

.responsive-img {
  width: 40%;          /* shrink to 70% of container width */
  height: auto;        /* keep aspect ratio */
  max-width: 100%;     /* never overflow container */
  display: block;
  margin: 0 auto;      /* center the image */
}

.glow-paragraph {
  color: #ff9800; /* orange text */
  font-weight: 500;
  text-shadow: 0 0 5px rgba(255, 152, 0, 0.7);
  animation: orangeGlow 3s ease-in-out infinite;
}

@keyframes orangeGlow {
  0% {
    text-shadow: 0 0 5px rgba(255, 152, 0, 0.6),
                 0 0 10px rgba(255, 152, 0, 0.4);
  }
  50% {
    text-shadow: 0 0 15px rgba(255, 152, 0, 1),
                 0 0 30px rgba(255, 152, 0, 0.8);
  }
  100% {
    text-shadow: 0 0 5px rgba(255, 152, 0, 0.6),
                 0 0 10px rgba(255, 152, 0, 0.4);
  }
}

.image-row {
  display: flex;
  justify-content: center;   /* center them horizontally */
  gap: 1rem;                 /* space between images */
  flex-wrap: wrap;           /* allow wrapping if needed */
}

.responsive-img {
  width: 30%;                /* each takes ~30% of row on large screens */
  height: auto;
  max-width: 100%;
}

/* On smaller screens, stack vertically */
@media (max-width: 768px) {
  .image-row {
    flex-direction: column;  /* stack images */
    align-items: center;     /* center them */
  }

  .responsive-img {
    width: 90%;              /* make them bigger on small screens */
  }
}

.faq-link-list {
  display: flex;
  flex-direction: column;   /* stack vertically */
  gap: 0.75rem;             /* space between links */
  margin-top: 1rem;
}

.faq-orange-link {
  color: #ff6600;           /* orange text */
  text-decoration: none;    /* remove underline */
  font-weight: 500;
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}

.faq-orange-link:hover {
  color: #cc5200;           /* darker orange on hover */
  text-decoration: underline;
  transform: scale(1.05);
}

.contact-orange-link {
  color: #ff6600;           /* orange text */
  font-weight: 500;
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}

.contact-orange-link:hover {
  color: #cc5200;           /* darker orange on hover */
  text-decoration: underline;
  transform: scale(1.1);
}

.admin-orange-link {
  color: #ff6600;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-flex;        /* inline-flex works better inside table cells */
  align-items: center;
  justify-content: center;
}

.admin-orange-link:hover {
  color: #cc5200;           /* darker orange on hover */
  text-decoration: underline;
  transform: scale(1.05);
  cursor: pointer;
}

/* For Table Icons */
td .icon-center {
  display: block;       /* makes span fill the cell */
  text-align: center;   /* centers the icon */
}

.icon-green {
  color: green;   /* or #4CAF50 for Material green */
  animation: flashGreenOrange 2s infinite;
}

.icon-red {
  color: red;     /* or #F44336 for Material red */
}

@keyframes flashGreenOrange {
  0%   { color: #4CAF50; }   /* start green */
  50%  { color: orange; }    /* flash orange */
  100% { color: #4CAF50; }   /* back to green */
}

/* ================================================================
   ADMIN DASHBOARD LAYOUT
   ================================================================ */

.admin-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1;
  width: 100%;
}

/* ---- Sidebar ---- */
.admin-sidebar {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  background-color: #12131a;
  border-right: 1px solid #2a2b3c;
  transition: width 0.25s ease;
}

.sidebar-sticky-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease;
  z-index: 100;
  background-color: #12131a;
  border-right: 1px solid #2a2b3c;
}

.admin-sidebar.collapsed .sidebar-sticky-content {
  width: 56px;
}

.admin-sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

.admin-sidebar.collapsed ~ .admin-main {
  /* flex: 1 handles width automatically */
}

.admin-sidebar.collapsed .sidebar-nav-label,
.admin-sidebar.collapsed .sidebar-device-text,
.admin-sidebar.collapsed .sidebar-search-wrap,
.admin-sidebar.collapsed .sidebar-filter-row,
.admin-sidebar.collapsed .sidebar-section-header span:not(.material-icons) {
  display: none;
}

.admin-sidebar.collapsed .sidebar-device-item {
  justify-content: center;
  padding: 8px 0;
}

.admin-sidebar.collapsed .sidebar-status-dot {
  margin: 0;
}

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #2a2b3c;
  height: 52px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  overflow: hidden;
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand {
  color: #ff8705;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

/* Nav items */
.sidebar-nav {
  padding: 6px 0;
  flex-shrink: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #888;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
  font-family: inherit;
}

.sidebar-nav-item .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  background-color: #ff8705;
  color: #fff;
}

.sidebar-nav-active {
  background-color: #ff8705 !important;
  color: #fff !important;
  border-left-color: #ff8705 !important;
}

.sidebar-divider {
  height: 1px;
  background-color: #2a2b3c;
  margin: 6px 0;
  flex-shrink: 0;
}

/* Section header label */
.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  color: #555;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.sidebar-section-header .material-icons {
  font-size: 15px;
}

/* Device search inside sidebar */
.sidebar-filter-row {
  display: flex;
  gap: 6px;
  padding: 4px 12px 6px;
  flex-shrink: 0;
}

.sidebar-filter-btn {
  flex: 1;
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-radius: 4px;
  color: #aaa;
  font-size: 11px;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-filter-btn:hover {
  background: #2a2b3c;
  color: #fff;
}

.sidebar-filter-btn.sidebar-filter-active {
  background: #ff6a00;
  border-color: #ff6a00;
  color: #fff;
}

.sidebar-search-wrap {
  padding: 4px 12px 6px;
  flex-shrink: 0;
}

input.sidebar-search-input {
  width: 100%;
  background: transparent;
  border: 1px solid #2a2b3c;
  border-radius: 4px;
  color: #aaa;
  padding: 0 8px;
  height: 30px;
  font-size: 11px;
  box-sizing: border-box;
  outline: none;
}

input.sidebar-search-input:focus {
  border-color: #ff8705;
}

input.sidebar-search-input::placeholder {
  color: #444;
}

/* Device list */
.sidebar-device-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.sidebar-device-list::-webkit-scrollbar { width: 3px; }
.sidebar-device-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-device-list::-webkit-scrollbar-thumb { background: #2a2b3c; border-radius: 2px; }

.sidebar-device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  color: #aaa;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  overflow: hidden;
}

.sidebar-device-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar-device-active {
  background-color: rgba(255, 135, 5, 0.14) !important;
  border-left-color: #ff8705 !important;
  color: #ff8705 !important;
}

.sidebar-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-online  { background: #00ff00; box-shadow: 0 0 4px #00ff00; }
.dot-serial  { background: #00BFFF; box-shadow: 0 0 4px #00BFFF; }
.dot-offline { background: #ff4444; box-shadow: 0 0 4px #ff4444; }

.sidebar-device-tooltip {
  position: fixed;
  background: #1e1f2b;
  border: 1px solid #ff8705;
  border-radius: 8px;
  padding: 8px 14px;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.sidebar-device-tooltip.visible { opacity: 1; }
.sidebar-tooltip-name  { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-tooltip-email { color: #aaa; font-size: 11px; }

.sidebar-device-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.sidebar-device-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-device-email {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-empty {
  color: #444;
  font-size: 12px;
  padding: 8px 14px;
}

/* Sidebar footer / collapse button */
.sidebar-footer {
  border-top: 1px solid #2a2b3c;
  padding: 4px 0;
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  text-align: left;
}

.sidebar-footer form {
  display: block;
  width: 100%;
  margin: 0;
}

.sidebar-logout-btn {
  text-align: left;
}

/* ---- Main area ---- */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 52px;
}

.admin-content {
  padding: 20px 24px 60px;
  flex: 1;
}

/* Welcome header */
.admin-welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-welcome-title {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.admin-welcome-sub {
  color: #888;
  font-size: 14px;
  margin: 3px 0 0;
}

/* Search bar in welcome */
.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 6px;
  padding: 8px 14px;
  min-width: 220px;
  transition: border-color 0.2s;
}

.admin-search:focus-within {
  border-color: #ff8705;
}

.admin-search .material-icons {
  color: #555;
  font-size: 18px;
}

.admin-search-input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  outline: none;
  width: 100%;
}

.admin-search-input::placeholder { color: #444; }

/* Stat cards */
.admin-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background-color: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: #ff8705; }

.stat-card-icon {
  background-color: rgba(255, 135, 5, 0.14);
  border-radius: 8px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon .material-icons { color: #ff8705; font-size: 24px; }

.stat-card-icon-alarm { background-color: rgba(255, 82, 82, 0.14); }
.stat-card-icon-alarm .material-icons { color: #ff5252; }

.stat-card-info {
  display: flex;
  flex-direction: column;
}

.stat-card-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}

.stat-card-value {
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
}

.stat-card-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #888;
  font-size: 12px;
  margin-top: 2px;
}

.stat-card-alarm-block {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  grid-column: span 2;
}

.alarm-block-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 24px;
  flex: 1;
}

.alarm-block-divider {
  width: 1px;
  background: #2a2b3c;
  flex-shrink: 0;
}

.alarm-block-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #888;
  font-size: 12px;
  margin-bottom: 6px;
}

.alarm-block-icon {
  font-size: 15px !important;
  color: #ff5252;
}

.alarm-block-value {
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

/* Server info bar */
.server-info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 14px;
}

.server-info-item {
  color: #888;
  font-size: 13px;
  font-weight: 500;
}

/* Section headings inside admin */
.admin-section-heading {
  color: #ff8705;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 18px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2b3c;
}

/* ---- Device detail page ---- */
.device-detail-card {
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  padding: 22px 24px;
  margin-bottom: 16px;
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.device-detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-detail-field-label {
  color: #555;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.device-detail-field-value {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}

.device-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.status-badge-online  { background: rgba(0,255,0,0.12);   color: #00ff00; }
.status-badge-serial  { background: rgba(0,191,255,0.12); color: #00BFFF; }
.status-badge-offline { background: rgba(139,0,0,0.2);    color: #ff4444; }

/* ================================================================
   DASHBOARD WIDGETS
   ================================================================ */

.widget-card {
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  padding: 16px 18px;
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.widget-table-scroll {
  overflow-y: auto;
  max-height: 220px;
  flex: 1;
}

.widget-table-scroll::-webkit-scrollbar { width: 4px; }
.widget-table-scroll::-webkit-scrollbar-track { background: transparent; }
.widget-table-scroll::-webkit-scrollbar-thumb { background: #3a3b4c; border-radius: 2px; }

.widget-card:hover { border-color: #3a3b4c; }

.widget-card-chart {
  margin-bottom: 16px;
}

.widget-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.widget-icon {
  color: #ff8705;
  font-size: 20px;
  flex-shrink: 0;
}

.widget-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.widget-title-sub {
  color: #555;
  font-size: 12px;
  margin-left: auto;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 60px;
}

.widget-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.widget-table th {
  color: #555;
  text-align: left;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #2a2b3c;
}

.widget-table td {
  color: #bbb;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.widget-table tr:last-child td { border-bottom: none; }

.widget-table tbody tr:hover td {
  background: rgba(255,135,5,0.06);
  color: #fff;
}

.widget-no-data {
  color: #444;
  text-align: center;
  padding: 16px 8px;
  font-size: 13px;
}

.widget-no-data-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: #444;
  font-size: 13px;
}

.widget-placeholder { opacity: 0.55; }

@media (max-width: 900px) {
  .widget-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   BMS DEVICE DETAIL WIDGETS
   ================================================================ */

.bms-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.bms-refresh-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 6px;
  padding: 4px 8px;
}

.bms-refresh-label {
  color: #555;
  font-size: 11px;
  margin-right: 2px;
  white-space: nowrap;
}

.bms-refresh-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #666;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.bms-refresh-btn:hover { color: #ff8705; }

.bms-refresh-active {
  border-color: #ff8705 !important;
  color: #ff8705 !important;
}

.bms-last-refresh {
  color: #888;
  font-size: 10px;
  margin-left: 4px;
  white-space: nowrap;
}

/* Stat card grid */
.bms-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.bms-stat-card {
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s;
}

.bms-stat-card:hover { border-color: #ff8705; }

@keyframes bms-card-flash {
  0%   { border-color: #ff8705; box-shadow: 0 0 8px rgba(255,135,5,0.5); }
  100% { border-color: #2a2b3c; box-shadow: none; }
}

.bms-card-flash {
  animation: bms-card-flash 1.2s ease forwards;
}

@keyframes bms-header-flash {
  0%   { background: rgba(255,135,5,0.25); }
  100% { background: #12131a; }
}

@keyframes bms-header-flash-light {
  0%   { background: rgba(255,135,5,0.35); }
  100% { background: #ffffff; }
}

.bms-header-flash {
  animation: bms-header-flash 1.2s ease forwards;
}

.bms-card-soc { border-left: 3px solid #4caf50; }

.bms-card-bat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ff8705;
  margin-bottom: 4px;
}

.bms-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bms-card-icon { color: #ff8705; font-size: 18px; }

.bms-card-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.bms-card-value {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.bms-card-unit {
  font-size: 14px;
  font-weight: 400;
  color: #888;
  margin-left: 3px;
}

.bms-val-charge   { color: #4caf50; }
.bms-val-discharge { color: #ff5252; }
.bms-val-warn     { color: #ff8705; }

.bms-card-sub {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.bms-sub-charge   { color: #4caf50; }
.bms-sub-discharge { color: #ff5252; }
.bms-sub-neutral  { color: #666; }

/* SOC progress bar */
.bms-soc-bar-wrap {
  height: 4px;
  background: #2a2b3c;
  border-radius: 2px;
  overflow: hidden;
}

.bms-soc-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Historic data banner */
.bms-historic-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e1a10;
  border: 1px solid #5a4a1a;
  border-radius: 6px;
  color: #c8972a;
  font-size: 12px;
  padding: 6px 12px;
  margin-bottom: 10px;
}

/* No data state */
.bms-no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px;
  color: #555;
  text-align: center;
}

/* Alarm section */
.bms-alarm-section { margin-bottom: 12px; }

.bms-alarm-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.bms-alarm-badge {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid rgba(255, 82, 82, 0.4);
  color: #ff5252;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.bms-alarm-clear {
  color: #4caf50;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

/* Cell balance grid */
.bms-cells-section { margin-bottom: 12px; }

.bms-cell-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 10px;
  max-width: 480px;
}

.bms-cell {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-radius: 5px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: #555;
}

.bms-cell-balancing {
  background: rgba(255, 135, 5, 0.15);
  border-color: #ff8705;
  color: #ff8705;
  animation: cell-pulse 2.4s ease-in-out infinite;
}

.bms-cell-num { font-weight: 700; }

.bms-cell-icon {
  font-size: 13px !important;
  animation: cell-spin 3s linear infinite;
}

@keyframes cell-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes cell-pulse {
  0%, 100% {
    background: rgba(255, 135, 5, 0.10);
    box-shadow: 0 0 0px rgba(255, 135, 5, 0);
  }
  50% {
    background: rgba(255, 135, 5, 0.28);
    box-shadow: 0 0 6px rgba(255, 135, 5, 0.4);
  }
}

.bms-cell-legend {
  font-size: 11px;
  color: #555;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.bms-cell-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: rgba(255, 135, 5, 0.5);
  border: 1px solid #ff8705;
  border-radius: 2px;
}

/* ── Per-battery section layout ── */
.bms-battery-wrapper {
  margin-bottom: 8px;
}

.chart-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  color: #555;
  font-size: 12px;
}

.chart-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 19, 26, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  border-radius: 6px;
  color: #aaa;
  font-size: 12px;
}

.chart-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #2a2b3c;
  border-top-color: #ff8705;
  border-radius: 50%;
  animation: chart-spin 0.7s linear infinite;
}

@keyframes chart-spin {
  to { transform: rotate(360deg); }
}

/* Page-level battery header (rendered by device_detail.html) */
.bms-battery-main-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #12131a;
  border: 1px solid #2a2b3c;
  border-left: 3px solid #ff8705;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.bms-battery-summary {
  display: none;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.bms-battery-wrapper.bms-collapsed .bms-battery-summary {
  display: flex;
}

.bms-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #ccc;
  white-space: nowrap;
}

.bms-summary-item .material-icons {
  font-size: 14px !important;
  color: #ff8705;
}

.bms-summary-sep {
  color: #444;
  font-size: 11px;
  padding: 0 2px;
}

.bms-collapse-icon {
  margin-left: auto;
  color: #777;
  font-size: 20px !important;
  transition: transform 0.25s ease;
}

.bms-battery-wrapper.bms-collapsed .bms-collapse-icon {
  transform: rotate(180deg);
}

.bms-battery-body {
  overflow: hidden;
  max-height: 4000px;
  transition: max-height 0.4s ease;
}

.bms-battery-wrapper.bms-collapsed .bms-battery-body {
  max-height: 0;
}

.bms-battery-label {
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bms-battery-iccid {
  color: #444;
  font-size: 11px;
  margin-left: 4px;
}

.bms-battery-divider {
  height: 1px;
  background: linear-gradient(to right, #2a2b3c 60%, transparent);
  margin: 24px 0;
  transition: margin 0.4s ease;
}

/* shrink gap when battery before or after divider is collapsed */
.bms-battery-wrapper.bms-collapsed + .bms-battery-divider,
.bms-battery-divider.bms-divider-collapsed {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* shrink wrapper bottom margin when collapsed */
.bms-battery-wrapper.bms-collapsed {
  margin-bottom: 0;
}
}

/* Refresh custom dropdown */
.bms-refresh-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer !important;
  user-select: none;
}

.bms-refresh-btn-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: #ff9800;
  background: transparent;
  border: 1px solid #ff8705;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: color 0.25s ease;
}

.bms-refresh-btn-inner::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: #ff8705;
  transition: left 0.25s ease;
  z-index: 0;
}

.bms-refresh-btn-inner > * {
  position: relative;
  z-index: 1;
}

.bms-refresh-wrap:hover .bms-refresh-btn-inner::before { left: 0; }
.bms-refresh-wrap:hover .bms-refresh-btn-inner { color: #000; }

.bms-refresh-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1e1f2b;
  border: 1px solid #ff8705;
  border-radius: 4px;
  z-index: 9999;
  min-width: 90px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}


.bms-refresh-option {
  padding: 7px 14px 7px 10px;
  font-size: 11px;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bms-refresh-option::before {
  content: '';
  display: inline-block;
  width: 10px;
  flex-shrink: 0;
}

.bms-refresh-option:hover {
  background: rgba(255,135,5,0.12);
  color: #ff8705;
}

.bms-refresh-option-active {
  color: #ff8705;
}

.bms-refresh-option-active::before {
  content: '✓';
  color: #ff8705;
}

/* ================================================================
   FULL-WIDTH CONTROLS TOOLBAR (chart range + auto-refresh merged)
   ================================================================ */


.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.controls-sep {
  width: 1px;
  height: 16px;
  background: #2a2b3c;
  flex-shrink: 0;
}

.chart-preset-group {
  display: flex;
  gap: 3px;
}

.chart-preset-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #666;
  border-radius: 4px;
  padding: 0 8px;
  height: 24px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 22px;
}

.chart-preset-btn:hover {
  color: #ff8705;
  border-color: #ff8705;
}

.chart-preset-active {
  border-color: #ff8705 !important;
  color: #ff8705 !important;
}

.flatpickr-wrapper {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.bms-controls-bar .flatpickr-wrapper {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.chart-range-sep {
  color: #444;
  font-size: 13px;
}

.dt-label {
  color: #888;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}


.chart-apply-btn,
.chart-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: #ff9800;
  background: transparent;
  border: 1px solid #ff8705;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.25s ease, color 0.25s ease;
  overflow: hidden;
  position: relative;
}

.chart-apply-btn::before,
.chart-reset-btn::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: #ff8705;
  transition: left 0.25s ease;
  z-index: 0;
}

.chart-apply-btn span,
.chart-reset-btn span {
  position: relative;
  z-index: 1;
}

.chart-apply-btn:hover::before,
.chart-reset-btn:hover::before { left: 0; }

.chart-apply-btn:hover,
.chart-reset-btn:hover { color: #000; }

/* ── Shared device/admin table (devtbl) ─────────────────────────────────── */
.devtbl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #2a2b3c;
}
.devtbl-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.devtbl-filters  { display: flex; gap: 3px; }
.devtbl-filter-btn {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-radius: 4px;
  color: #aaa;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.devtbl-filter-btn:hover { background: #2a2b3c; color: #fff; }
.devtbl-filter-btn.devtbl-filter-active { background: #ff6a00; border-color: #ff6a00; color: #fff; }
.devtbl-search { width: 170px !important; }
.devtbl-site-link { color: #d0d0d0; text-decoration: none; }
.devtbl-site-link:hover { color: #ff8705; text-decoration: underline; }
.devtbl-wrap { overflow-x: auto; }
.devtbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  color: #d0d0d0;
  background: #12131a;
  table-layout: fixed;
}
.devtbl-th {
  background: #12131a;
  color: #888;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #2a2b3c;
  white-space: nowrap;
}
.devtbl-th-alarms { text-align: center; }
.devtbl-td {
  padding: 0 10px;
  height: 42px;
  vertical-align: middle;
  border-bottom: 1px solid #1e1f2b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
  background: #12131a;
}
.devtbl-row:hover .devtbl-td { background: #1a1b27; }
.devtbl-col-dot { width: 32px; text-align: center; max-width: 32px; }
.devtbl-id      { color: #ff8705; font-family: monospace; font-size: 0.75rem; }
.devtbl-lastmsg { color: #aaa; font-size: 0.73rem; }
.devtbl-alarms  { text-align: center; color: #666; font-weight: 600; }
.devtbl-alarm-active { color: #ff6a00 !important; }
.devtbl-empty   { text-align: center; color: #555; padding: 2rem; font-size: 0.8rem; }
.sortable-col   { cursor: pointer; user-select: none; }
.sortable-col:hover { color: #ff8705; }
.sort-asc::after  { content: " ▲"; font-size: 0.65em; }
.sort-desc::after { content: " ▼"; font-size: 0.65em; }
.devtbl-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid #2a2b3c;
  flex-wrap: wrap;
  gap: 8px;
}
.devtbl-pag-left   { display: flex; align-items: center; gap: 8px; }
.devtbl-pag-label  { color: #666; font-size: 0.75rem; }
.devtbl-pag-select {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  color: #ccc;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
}
.devtbl-pag-select:focus { border-color: #ff8705; }
.devtbl-pag-center { color: #666; font-size: 0.75rem; }
.devtbl-pag-right  { display: flex; gap: 4px; align-items: center; }
.pag-btn {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  color: #aaa;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 32px;
  text-align: center;
}
.pag-btn:hover:not(:disabled) { background: #2a2b3c; color: #fff; }
.pag-btn:disabled { opacity: 0.35; cursor: default; }
.pag-btn.pag-active { background: #ff6a00; border-color: #ff6a00; color: #fff; }

/* Override Bootstrap dark tables inside device-detail-card to match devtbl */
.device-detail-card .table {
  margin-bottom: 0 !important;
  font-size: 0.76rem !important;
  --bs-table-bg: #12131a;
  --bs-table-color: #d0d0d0;
  --bs-table-hover-bg: #1a1b27;
  --bs-table-border-color: #1e1f2b;
  --bs-table-striped-bg: #12131a;
}
.device-detail-card .table > thead > tr > th {
  background: #12131a !important;
  color: #888 !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 10px !important;
  border-bottom: 1px solid #2a2b3c !important;
  border-top: none !important;
  white-space: nowrap !important;
}
.device-detail-card .table > tbody > tr > td {
  padding: 0 10px !important;
  height: 42px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #1e1f2b !important;
  background: #12131a !important;
  color: #d0d0d0 !important;
}
.device-detail-card .table > tbody > tr:hover > td {
  background: #1a1b27 !important;
}
.device-detail-card .table-responsive { margin-bottom: 0 !important; }

/* Bootstrap pagination → pag-btn look */
.device-detail-card .pagination { gap: 3px; margin-bottom: 0; }
.device-detail-card .pagination .page-link {
  background: #1e1f2b !important;
  border-color: #2a2b3c !important;
  color: #aaa !important;
  font-size: 0.75rem !important;
  padding: 3px 10px !important;
  border-radius: 4px !important;
  min-width: 32px;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.device-detail-card .pagination .page-link:hover {
  background: #2a2b3c !important;
  color: #fff !important;
}
.device-detail-card .pagination .page-item.active .page-link {
  background: #ff6a00 !important;
  border-color: #ff6a00 !important;
  color: #fff !important;
}
.device-detail-card .pagination .page-item.disabled .page-link {
  background: #1a1b27 !important;
  color: #555 !important;
  opacity: 0.5;
}

/* ── Admin panel collapsible sections ── */
.admin-section-summary {
  display: none;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
  padding: 0 12px;
}
.admin-section.admin-collapsed .admin-section-summary {
  display: flex;
}
.admin-section-header {
  cursor: pointer;
  user-select: none;
}
.admin-section-header:hover { background: #1a1b27; }
.admin-section-chevron {
  color: #555;
  font-size: 1.1rem !important;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}
.admin-section.admin-collapsed .admin-section-chevron {
  transform: rotate(180deg);
}
.admin-section-body {
  overflow: hidden;
  max-height: 4000px;
  transition: max-height 0.4s ease;
}
.admin-section.admin-collapsed .admin-section-body {
  max-height: 0;
}

/* ── Server/DB monitor ── */
.smon-wrap        { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 20px; }
.smon-subtitle    { font-size: 0.72rem; font-weight: 700; color: #ff8705; text-transform: uppercase;
                    letter-spacing: 0.06em; margin-bottom: 10px; }
.smon-bar-row     { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.smon-bar-label   { flex: 0 0 160px; font-size: 0.75rem; color: #aaa; white-space: nowrap; }
.smon-bar-track   { flex: 1; height: 14px; background: #1a1b27; border-radius: 7px; overflow: hidden; }
.smon-bar-fill    { height: 100%; border-radius: 7px; transition: width 0.6s ease; }
.smon-fill-ok     { background: linear-gradient(90deg, #2e7d32, #4caf50); }
.smon-fill-warn   { background: linear-gradient(90deg, #e65100, #ff8705); }
.smon-fill-crit   { background: linear-gradient(90deg, #b71c1c, #f44336); }
.smon-bar-pct     { flex: 0 0 46px; text-align: right; font-size: 0.78rem; font-weight: 700; color: #e0e0e0; }
.smon-bottom      { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; justify-content: center; }
.smon-conn-cards  { display: flex; gap: 12px; flex-shrink: 0; }
.smon-conn-card   { background: #1a1b27; border: 1px solid #2a2b3c; border-radius: 8px;
                    padding: 12px 20px; text-align: center; min-width: 100px; }
.smon-conn-value  { font-size: 1.8rem; font-weight: 700; color: #e0e0e0; line-height: 1.1; }
.smon-conn-label  { font-size: 0.68rem; color: #666; margin-top: 4px; white-space: nowrap; }
.smon-conn-card.smon-active .smon-conn-value { color: #4caf50; }
.smon-conn-card.smon-idle   .smon-conn-value { color: #ff8705; }
.smon-donut-wrap  { flex-shrink: 0; }
.smon-donut-title { font-size: 0.7rem; color: #666; margin-bottom: 6px; }
.smon-unavail     { color: #444; font-size: 0.8rem; padding: 1rem 0; }
.smon-pct-warn    { color: #ff8705 !important; }
.smon-pct-crit    { color: #f44336 !important; }
.smon-chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 4px;
  flex-wrap: wrap;
}

/* ================================================================
   THEME TOGGLE BUTTON
   ================================================================ */

.theme-toggle-btn {
  background: transparent;
  border: 1px solid #ff8705;
  border-radius: 4px;
  color: #ff8705;
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: color 0.25s ease;
}

.theme-toggle-btn::before {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: #ff8705;
  transition: left 0.25s ease;
  z-index: 0;
}

.theme-toggle-btn:hover::before { left: 0; }
.theme-toggle-btn:hover { color: #fff; }

.theme-toggle-btn .material-icons {
  font-size: 15px;
  line-height: 1;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

[data-theme="light"] .theme-toggle-btn {
  border-color: #ff8705;
  color: #ff8705;
}
[data-theme="light"] .theme-toggle-btn::before { background: #ff8705; }
[data-theme="light"] .theme-toggle-btn:hover   { color: #fff; }


/* ================================================================
   LIGHT MODE OVERRIDES  (toggled via data-theme="light" on <html>)
   ================================================================ */

[data-theme="light"] .background::before {
  background: linear-gradient(to bottom, #ff8705 0%, #f0f2f5 100%);
}

[data-theme="light"] .admin-main { background-color: transparent; }

/* ---- Navigation ---- */
[data-theme="light"] .mainnav,
[data-theme="light"] .topnav {
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
[data-theme="light"] .mainnav-sitename     { color: #1a1a2e; }
[data-theme="light"] .mainnav-status       { color: #1a1a2e; }
[data-theme="light"] .mainnav-status:hover { color: #ff8705; text-shadow: none; }
[data-theme="light"] .mainnav-left a       { color: #1a1a2e; }

/* ---- Admin sidebar ---- */
[data-theme="light"] .admin-sidebar,
[data-theme="light"] .sidebar-sticky-content {
  background-color: #ffffff;
  border-right-color: #dde1e9;
}
[data-theme="light"] .sidebar-header  { border-bottom-color: #dde1e9; }
[data-theme="light"] .sidebar-divider { background-color: #dde1e9; }
[data-theme="light"] .sidebar-footer  { border-top-color: #dde1e9; }
[data-theme="light"] .sidebar-nav-item { color: #555; }
[data-theme="light"] .sidebar-nav-item:hover { background-color: #ff8705; color: #fff; }
[data-theme="light"] .sidebar-section-header { color: #999; }
[data-theme="light"] .sidebar-device-item    { color: #555; }
[data-theme="light"] .sidebar-device-item:hover {
  background-color: rgba(0,0,0,0.05);
  color: #1a1a2e;
}
[data-theme="light"] .sidebar-device-email { color: #777; }
[data-theme="light"] .sidebar-empty        { color: #aaa; }
[data-theme="light"] .sidebar-filter-btn {
  background: #f2f3f7;
  border-color: #dde1e9;
  color: #666;
}
[data-theme="light"] .sidebar-filter-btn:hover { background: #e0e2e8; color: #222; }
[data-theme="light"] .sidebar-filter-btn.sidebar-filter-active {
  background: #ff6a00;
  border-color: #ff6a00;
  color: #fff;
}
[data-theme="light"] input.sidebar-search-input {
  border-color: #dde1e9;
  color: #555;
}
[data-theme="light"] input.sidebar-search-input::placeholder { color: #bbb; }
[data-theme="light"] .sidebar-device-tooltip {
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
[data-theme="light"] .sidebar-tooltip-name  { color: #1a1a2e; }
[data-theme="light"] .sidebar-tooltip-email { color: #666; }
[data-theme="light"] .sidebar-device-list::-webkit-scrollbar-thumb { background: #c0c4cc; }

/* ---- Admin search ---- */
[data-theme="light"] .admin-search {
  background: #f2f3f7;
  border-color: #dde1e9;
}
[data-theme="light"] .admin-search .material-icons        { color: #888; }
[data-theme="light"] .admin-search-input                   { color: #1a1a2e; }
[data-theme="light"] .admin-search-input::placeholder      { color: #aaa; }

/* ---- Admin welcome ---- */
[data-theme="light"] .admin-welcome-title { color: #1a1a2e; }
[data-theme="light"] .admin-welcome-sub   { color: #666; }

/* ---- Stat cards ---- */
[data-theme="light"] .stat-card { background-color: #ffffff; border-color: #dde1e9; }
[data-theme="light"] .stat-card-label   { color: #777; }
[data-theme="light"] .stat-card-value   { color: #1a1a2e; }
[data-theme="light"] .stat-card-sub     { color: #777; }
[data-theme="light"] .alarm-block-divider { background: #dde1e9; }
[data-theme="light"] .alarm-block-label   { color: #777; }
[data-theme="light"] .alarm-block-value   { color: #1a1a2e; }

/* ---- Server info bar ---- */
[data-theme="light"] .server-info-bar { background: #ffffff; border-color: #dde1e9; }
[data-theme="light"] .server-info-item { color: #666; }

/* ---- Admin section headings ---- */
[data-theme="light"] .admin-section-heading     { border-bottom-color: #dde1e9; }
[data-theme="light"] .admin-section-header:hover { background: #f2f3f7; }
[data-theme="light"] .admin-section-chevron      { color: #888; }

/* ---- Widget cards ---- */
[data-theme="light"] .widget-card { background: #ffffff; border-color: #dde1e9; }
[data-theme="light"] .widget-card:hover   { border-color: #c0c4cc; }
[data-theme="light"] .widget-title        { color: #1a1a2e; }
[data-theme="light"] .widget-title-sub    { color: #888; }
[data-theme="light"] .widget-table th { color: #777; border-bottom-color: #dde1e9; }
[data-theme="light"] .widget-table td { color: #444; border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .widget-table tbody tr:hover td {
  background: rgba(255,135,5,0.06);
  color: #1a1a2e;
}
[data-theme="light"] .widget-no-data,
[data-theme="light"] .widget-no-data-center { color: #aaa; }
[data-theme="light"] .widget-table-scroll::-webkit-scrollbar-thumb { background: #c0c4cc; }

/* ---- Device detail card ---- */
[data-theme="light"] .device-detail-card { background: #ffffff; border-color: #dde1e9; }
[data-theme="light"] .device-detail-field-label { color: #888; }
[data-theme="light"] .device-detail-field-value { color: #2a2a3e; }

[data-theme="light"] .device-detail-card .table {
  --bs-table-bg:           #ffffff;
  --bs-table-color:        #2a2a3e;
  --bs-table-hover-bg:     #f5f5fa;
  --bs-table-border-color: #dde1e9;
  --bs-table-striped-bg:   #f8f8fc;
}
[data-theme="light"] .device-detail-card .table > thead > tr > th {
  background: #f8f8fc !important;
  color: #777 !important;
  border-bottom-color: #dde1e9 !important;
}
[data-theme="light"] .device-detail-card .table > tbody > tr > td {
  background: #ffffff !important;
  color: #2a2a3e !important;
  border-bottom-color: #dde1e9 !important;
}
[data-theme="light"] .device-detail-card .table > tbody > tr:hover > td { background: #f5f5fa !important; }
[data-theme="light"] .device-detail-card .pagination .page-link {
  background: #f2f3f7 !important; border-color: #dde1e9 !important; color: #555 !important;
}
[data-theme="light"] .device-detail-card .pagination .page-link:hover {
  background: #e0e2e8 !important; color: #1a1a2e !important;
}
[data-theme="light"] .device-detail-card .pagination .page-item.active .page-link {
  background: #ff6a00 !important; border-color: #ff6a00 !important; color: #fff !important;
}
[data-theme="light"] .device-detail-card .pagination .page-item.disabled .page-link {
  background: #f2f3f7 !important; color: #bbb !important;
}

/* ---- BMS stat cards & controls ---- */
[data-theme="light"] .bms-stat-card { background: #ffffff; border-color: #dde1e9; }
[data-theme="light"] .bms-card-label   { color: #777; }
[data-theme="light"] .bms-card-value   { color: #1a1a2e; }
[data-theme="light"] .bms-card-unit    { color: #777; }
[data-theme="light"] .bms-sub-neutral  { color: #777; }
[data-theme="light"] .bms-no-data      { color: #999; }
[data-theme="light"] .bms-soc-bar-wrap { background: #dde1e9; }
[data-theme="light"] .bms-refresh-control { background: #f2f3f7; border-color: #dde1e9; }
[data-theme="light"] .bms-refresh-label { color: #888; }
[data-theme="light"] .bms-refresh-btn  { color: #666; }
[data-theme="light"] .bms-last-refresh { color: #999; }
[data-theme="light"] .bms-refresh-menu { background: #ffffff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
[data-theme="light"] .bms-refresh-option { color: #555; }
[data-theme="light"] .bms-battery-main-header { background: #ffffff; border-color: #dde1e9 !important; }
[data-theme="light"] .bms-header-flash { animation: bms-header-flash-light 1.2s ease forwards; }
[data-theme="light"] .bms-battery-label { color: #1a1a2e !important; }
[data-theme="light"] .bms-battery-iccid { color: #aaa !important; }
[data-theme="light"] .bms-summary-item  { color: #555 !important; }
[data-theme="light"] .bms-summary-sep   { color: #bbb !important; }
[data-theme="light"] .bms-collapse-icon { color: #999 !important; }
[data-theme="light"] .bms-battery-divider {
  background: linear-gradient(to right, #dde1e9 60%, transparent);
}
[data-theme="light"] .chart-loading-overlay { background: rgba(242,243,247,0.85); color: #777; }
[data-theme="light"] .chart-spinner { border-color: #dde1e9; border-top-color: #ff8705; }

/* ---- Devtbl ---- */
[data-theme="light"] .devtbl-header    { border-bottom-color: #dde1e9; }
[data-theme="light"] .devtbl-filter-btn {
  background: #f2f3f7; border-color: #dde1e9; color: #666;
}
[data-theme="light"] .devtbl-filter-btn:hover { background: #e0e2e8; color: #1a1a2e; }
[data-theme="light"] .devtbl-filter-btn.devtbl-filter-active { background: #ff6a00; border-color: #ff6a00; color: #fff; }
[data-theme="light"] .devtbl { color: #2a2a3e; background: #ffffff; }
[data-theme="light"] .devtbl-th { background: #f8f8fc; color: #777; border-bottom-color: #dde1e9; }
[data-theme="light"] .devtbl-td { background: #ffffff; border-bottom-color: #eceef3; }
[data-theme="light"] .devtbl-row:hover .devtbl-td { background: #f5f5fa; }
[data-theme="light"] .devtbl-site-link  { color: #3a3a5e; }
[data-theme="light"] .devtbl-lastmsg   { color: #777; }
[data-theme="light"] .devtbl-alarms    { color: #888; }
[data-theme="light"] .devtbl-empty     { color: #aaa; }
[data-theme="light"] .devtbl-pagination { border-top-color: #dde1e9; }
[data-theme="light"] .devtbl-pag-label  { color: #777; }
[data-theme="light"] .devtbl-pag-center { color: #777; }
[data-theme="light"] .devtbl-pag-select { background: #f2f3f7; border-color: #dde1e9; color: #444; }
[data-theme="light"] .pag-btn { background: #f2f3f7; border-color: #dde1e9; color: #666; }
[data-theme="light"] .pag-btn:hover:not(:disabled) { background: #e0e2e8; color: #1a1a2e; }
[data-theme="light"] .pag-btn.pag-active { background: #ff6a00; border-color: #ff6a00; color: #fff; }

/* ---- Chart controls toolbar ---- */
[data-theme="light"] .controls-sep     { background: #dde1e9; }
[data-theme="light"] .chart-preset-btn { color: #777; }
[data-theme="light"] .dt-label         { color: #777; }
[data-theme="light"] .chart-range-sep  { color: #bbb; }

/* ---- Server monitor ---- */
[data-theme="light"] .smon-bar-label   { color: #666; }
[data-theme="light"] .smon-bar-track   { background: #e0e2e8; }
[data-theme="light"] .smon-bar-pct     { color: #2a2a3e; }
[data-theme="light"] .smon-conn-card   { background: #f2f3f7; border-color: #dde1e9; }
[data-theme="light"] .smon-conn-value  { color: #2a2a3e; }
[data-theme="light"] .smon-conn-label  { color: #888; }
[data-theme="light"] .smon-conn-card.smon-active .smon-conn-value { color: #4caf50; }
[data-theme="light"] .smon-conn-card.smon-idle   .smon-conn-value { color: #ff8705; }
[data-theme="light"] .smon-donut-title { color: #888; }
[data-theme="light"] .smon-unavail     { color: #bbb; }

/* ---- Login / signup / about ---- */
[data-theme="light"] .login-box,
[data-theme="light"] .signup-box {
  background-color: #ffffff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
[data-theme="light"] .login-box h2,
[data-theme="light"] .signup-box h2 { color: #1a1a2e; }
[data-theme="light"] .login-subtitle   { color: #888; }

/* Fix browser autofill yellow in light mode */
[data-theme="light"] input:-webkit-autofill,
[data-theme="light"] input:-webkit-autofill:hover,
[data-theme="light"] input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #f2f3f7 inset !important;
  -webkit-text-fill-color: #1a1a2e !important;
  caret-color: #1a1a2e;
  border-color: #dde1e9 !important;
  transition: background-color 5000s ease-in-out 0s;
}

[data-theme="light"] .div_about {
  background-color: #ffffff;
  color: #1a1a2e;
  box-shadow: 0 0 20px rgba(0,0,0,0.15);
}
[data-theme="light"] .div_reset { color: #1a1a2e; }
[data-theme="light"] .login-body {
  background: linear-gradient(to bottom right, #d8dce8, #c8ccd8);
}

/* ---- Inputs & labels ---- */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"] {
  background-color: #f2f3f7;
  color: #1a1a2e;
  border: 1px solid #dde1e9;
}
[data-theme="light"] .form-input {
  background-color: #f2f3f7;
  color: #1a1a2e;
  border: 1px solid #dde1e9;
}
[data-theme="light"] label           { color: #444; }
[data-theme="light"] .login-links a  { color: #555; }
[data-theme="light"] .toggle-password { color: #888; }

/* ---- Selects ---- */
[data-theme="light"] .select_refresh { background-color: #f2f3f7; border-color: #dde1e9; color: #ff8705; }

/* ---- Modals ---- */
[data-theme="light"] .custom-modal {
  background: #ffffff;
  color: #1a1a2e;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ---- Popup form ---- */
[data-theme="light"] .popup-form {
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(255,140,0,0.3), 0 4px 12px rgba(0,0,0,0.1);
}
[data-theme="light"] .popup-input-text { background-color: #f2f3f7; color: #1a1a2e; }

/* ---- Pagination ---- */
[data-theme="light"] .pagination .page-link {
  background-color: #f2f3f7; color: #ff8705; border-color: #dde1e9;
}
[data-theme="light"] .pagination .page-link:hover {
  background-color: orange; color: #fff; border-color: orange;
}
[data-theme="light"] .pagination .page-item.active .page-link {
  background-color: orange; border-color: orange; color: #fff;
}

/* ---- Footer ---- */
[data-theme="light"] .footer { background-color: rgba(0,0,0,0.1); color: #333; }

/* ---- Misc ---- */
[data-theme="light"] #loading-overlay { background: transparent; }
[data-theme="light"] .center { border-color: #dde1e9; background-color: #f8f8fc; }

/* ---- Flatpickr calendar ---- */
[data-theme="light"] .flatpickr-calendar {
  background: #ffffff !important;
  border: 1px solid #dde1e9 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
  color: #1a1a2e !important;
}
[data-theme="light"] .flatpickr-calendar.arrowTop::before { border-bottom-color: #dde1e9 !important; }
[data-theme="light"] .flatpickr-calendar.arrowTop::after  { border-bottom-color: #ffffff !important; }
[data-theme="light"] .flatpickr-months,
[data-theme="light"] .flatpickr-month   { background: #ffffff !important; color: #1a1a2e !important; fill: #1a1a2e !important; }
[data-theme="light"] .flatpickr-prev-month svg path,
[data-theme="light"] .flatpickr-next-month svg path { fill: #555 !important; }
[data-theme="light"] .flatpickr-prev-month:hover svg path,
[data-theme="light"] .flatpickr-next-month:hover svg path { fill: #ff8705 !important; }
[data-theme="light"] .flatpickr-weekdays { background: #ffffff !important; }
[data-theme="light"] .flatpickr-weekday  { background: #ffffff !important; color: #888 !important; }
[data-theme="light"] .flatpickr-days     { border-color: #dde1e9 !important; }
[data-theme="light"] .flatpickr-day      { color: #1a1a2e !important; background: transparent !important; }
[data-theme="light"] .flatpickr-day:hover,
[data-theme="light"] .flatpickr-day:focus {
  background: #f2f3f7 !important; border-color: #f2f3f7 !important; color: #1a1a2e !important;
}
[data-theme="light"] .flatpickr-day.selected,
[data-theme="light"] .flatpickr-day.startRange,
[data-theme="light"] .flatpickr-day.endRange {
  background: #ff8705 !important; border-color: #ff8705 !important; color: #fff !important;
}
[data-theme="light"] .flatpickr-day.inRange {
  background: rgba(255,135,5,0.15) !important;
  border-color: rgba(255,135,5,0.15) !important;
  box-shadow: -5px 0 0 rgba(255,135,5,0.15), 5px 0 0 rgba(255,135,5,0.15) !important;
  color: #1a1a2e !important;
}
[data-theme="light"] .flatpickr-day.prevMonthDay,
[data-theme="light"] .flatpickr-day.nextMonthDay { color: #bbb !important; }
[data-theme="light"] .flatpickr-time {
  background: #ffffff !important;
  border-top-color: #dde1e9 !important;
}
[data-theme="light"] .flatpickr-time input { background: #ffffff !important; color: #1a1a2e !important; }
[data-theme="light"] .numInputWrapper:hover { background: #f2f3f7 !important; }
[data-theme="light"] .flatpickr-current-month input.cur-year { color: #1a1a2e !important; }
[data-theme="light"] .flatpickr-current-month select.flatpickr-monthDropdown-months { color: #1a1a2e !important; background: #ffffff !important; }
[data-theme="light"] .flatpickr-input {
  background-color: #f2f3f7 !important;
  color: #1a1a2e !important;
  border-color: #dde1e9 !important;
}

/* ================================================================
   LIGHT MODE — DEPTH, ACCENTS & REMAINING DARK FIXES
   ================================================================ */

/* Background gradient shows through admin-main in light mode (same as login page) */
[data-theme="light"] .admin-main { background-color: transparent; }

/* Card elevation — lift off the background */
[data-theme="light"] .stat-card,
[data-theme="light"] .widget-card,
[data-theme="light"] .device-detail-card,
[data-theme="light"] .bms-stat-card,
[data-theme="light"] .server-info-bar {
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

/* Sidebar: warmer off-white so it separates from page */
[data-theme="light"] .admin-sidebar,
[data-theme="light"] .sidebar-sticky-content {
  background-color: #fafbff;
  border-right-color: #dde1ee;
}

/* Sidebar nav active item — keep orange bg */
[data-theme="light"] .sidebar-nav-active {
  background-color: #ff8705 !important;
  color: #fff !important;
  border-left-color: #ff8705 !important;
}

/* Device active in sidebar — subtle orange tint */
[data-theme="light"] .sidebar-device-active {
  background-color: rgba(255,135,5,0.12) !important;
  border-left-color: #ff8705 !important;
  color: #cc6a00 !important;
}

/* Navbar: crisp white with bottom border instead of shadow */
[data-theme="light"] .mainnav {
  background-color: #ffffff;
  box-shadow: none;
  border-bottom: 1px solid #dde1ee;
}

/* Public navbar light mode — frosted glass over orange gradient */
[data-theme="light"] .background > header .mainnav {
  background: rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: none;
}

/* Public navbar light mode — white pill buttons with orange text so they pop on the amber frosted glass */
[data-theme="light"] .background > header .mainnav .button {
  background-color: rgba(255, 255, 255, 0.88) !important;
  color: #e06600 !important;
  border: 1px solid #e06600 !important;
  transition: background-color 0.25s ease, color 0.25s ease !important;
}
[data-theme="light"] .background > header .mainnav .button::before {
  background: #ff8705;
  display: block !important;
}
[data-theme="light"] .background > header .mainnav .button:hover {
  color: #fff !important;
}
[data-theme="light"] .background > header .mainnav .mainnav-left a {
  color: #fff;
}
[data-theme="light"] .background > header .mainnav .mainnav-left a:hover {
  color: #fff !important;
}
[data-theme="light"] .background > header .mainnav .theme-toggle-btn {
  background-color: rgba(255, 255, 255, 0.88);
  border-color: #e06600;
  color: #e06600;
  transition: background-color 0.25s ease, color 0.25s ease;
}
[data-theme="light"] .background > header .mainnav .theme-toggle-btn::before {
  background: #ff8705;
  display: block !important;
}
[data-theme="light"] .background > header .mainnav .theme-toggle-btn:hover {
  color: #fff;
}

/* Admin nav buttons — kill the dark #29180b flash from .mainnav a:hover in light mode */
[data-theme="light"] .mainnav-right a.button:hover,
[data-theme="light"] .mainnav-right button.button:hover {
  background-color: transparent !important;
}

/* Stat card: warm tint strip on the icon */
[data-theme="light"] .stat-card-icon {
  background-color: rgba(255,135,5,0.12);
}

/* Tech buttons (Pause / Clear / serial-btn etc.) — replace black with neutral */
[data-theme="light"] .tech-button {
  background-color: #f0f2f8;
  color: #333;
  border: 1px solid #d0d4e0;
}
[data-theme="light"] .tech-button:hover {
  background-color: #ff8705;
  color: #fff;
  border-color: #ff8705;
}

/* Serial button */
[data-theme="light"] .serial-btn {
  background-color: #e8eaf2;
  color: #333;
  border: 1px solid #d0d4e0;
}
[data-theme="light"] .serial-btn:hover {
  background-color: #ff8705;
  color: #fff;
}

/* Download / red buttons */
[data-theme="light"] .download-btn {
  background-color: #e8eaf2;
  color: #333;
}
[data-theme="light"] .download-btn:hover {
  background-color: #ff8705;
  color: #fff;
}
[data-theme="light"] .red-btn {
  background-color: #e8eaf2;
  color: #333;
}
[data-theme="light"] .red-btn:hover { background-color: #c0392b; color: #fff; }

/* ---- MQTT Live Feed overrides ---- */
[data-theme="light"] .mqlf-controls  { border-bottom-color: #dde1ee; }
[data-theme="light"] .mqlf-count-badge { background: #ffe8cc; color: #cc6a00; }
[data-theme="light"] .mqlf-filter-input {
  background: #f2f3f7;
  border-color: #d0d4e0;
  color: #333;
}
[data-theme="light"] .mqlf-filter-input:focus { border-color: #ff8705; }
[data-theme="light"] .mqlf-paused-banner {
  background: #fff8ee;
  color: #cc6a00;
  border-top-color: #dde1ee;
}
/* MQTT feed area kept dark — it's a terminal, dark reads better */

/* ---- Form inputs inside admin (select, devtbl-search) ---- */
[data-theme="light"] .devtbl-search {
  background: #f2f3f7;
  border-color: #d0d4e0;
  color: #333;
}

/* ---- Inline color references on bms-summary-item spans ---- */
[data-theme="light"] .bms-summary-item { color: #444; }

/* ---- Cell balance grid ---- */
[data-theme="light"] .bms-cell {
  background: #f2f3f7;
  border-color: #dde1e9;
  color: #444;
}

/* ---- Section header hover ---- */
[data-theme="light"] .devtbl-header { background-color: #ffffff; }
[data-theme="light"] .devtbl-header:hover { background-color: #f5f6fb; }

/* ---- Widget card hover border accent ---- */
[data-theme="light"] .widget-card:hover,
[data-theme="light"] .stat-card:hover,
[data-theme="light"] .bms-stat-card:hover {
  border-color: #ff8705;
  box-shadow: 0 2px 8px rgba(255,135,5,0.12), 0 0 0 1px rgba(255,135,5,0.2);
}

/* ---- Admin section heading row ---- */
[data-theme="light"] .admin-section-heading { color: #ff8705; }

/* ---- Chart dt input (flatpickr) ---- */
[data-theme="light"] input.chart-dt-input,
[data-theme="light"] input.chart-dt-input.flatpickr-input,
[data-theme="light"] input.chart-dt-input.flatpickr-input.active {
  background: #f2f3f7 !important;
  color: #555 !important;
  border: 1px solid #dde1e9 !important;
  border-radius: 4px;
}
[data-theme="light"] input.chart-dt-input::placeholder { color: #bbb !important; }

/* ---- Relay cards (light mode) ---- */
[data-theme="light"] .relay-card {
  background: #ffffff;
  border-color: #dde1e9;
  color: #1a1a2e;
}
[data-theme="light"] .relay-card:hover { border-color: #ff8705; }
[data-theme="light"] .relay-card-on {
  border-color: #ff8705;
  box-shadow: 0 0 10px rgba(255, 135, 5, 0.15);
}
[data-theme="light"] .relay-card-off .bms-card-icon  { color: #bbb; }
[data-theme="light"] .relay-card-off .bms-card-value { color: #bbb; }
[data-theme="light"] .relay-card-off .bms-card-label { color: #aaa; }
[data-theme="light"] .relay-card-off .bms-card-sub   { color: #aaa; }
[data-theme="light"] .relay-card-serial { border-color: #0096CC; box-shadow: 0 0 10px rgba(0,150,204,0.15); }
[data-theme="light"] .relay-card-serial .bms-card-icon,
[data-theme="light"] .relay-card-serial .bms-card-value { color: #0096CC; }

/* ================================================================
   PUBLIC PAGES — About / Contact / FAQ
   ================================================================ */

.public-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 24px 60px;
  box-sizing: border-box;
}

.public-hero {
  text-align: center;
  padding: 40px 24px 48px;
}

.public-hero h1 {
  color: #fff;
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 10px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.public-hero-sub {
  color: rgba(255,255,255,0.82);
  font-size: 1rem;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.65;
}

.public-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.public-card {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-top: 3px solid #ff8705;
  border-radius: 10px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s;
}

.public-card:hover {
  box-shadow: 0 4px 24px rgba(255, 135, 5, 0.15);
}

.public-card-icon {
  width: 46px;
  height: 46px;
  background: rgba(255, 135, 5, 0.14);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.public-card-icon .material-icons { color: #ff8705; font-size: 22px; }

.public-card-avatar {
  width: 54px;
  height: 54px;
  background: rgba(255, 135, 5, 0.14);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.public-card-avatar .material-icons { color: #ff8705; font-size: 26px; }

.public-card-role {
  color: #ff8705;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.public-card h3 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.public-card p {
  color: #888;
  font-size: 0.88rem;
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

.public-card .button {
  min-width: unset !important;
  height: 38px !important;
  line-height: 38px !important;
  padding: 0 16px !important;
  font-size: 12px !important;
  margin-top: 6px;
  box-sizing: border-box;
  word-break: break-all;
}

.public-card .button span { font-size: 12px !important; }

/* ---- FAQ accordion ---- */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item.faq-open { border-color: #ff8705; }

.faq-question {
  width: 100%;
  background: transparent;
  border: none;
  padding: 18px 20px;
  text-align: left;
  color: #e0e0e0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: color 0.2s;
  font-family: inherit;
}

.faq-question:hover { color: #ff8705; }
.faq-item.faq-open .faq-question { color: #ff8705; }

.faq-chevron {
  font-size: 20px !important;
  color: #555;
  flex-shrink: 0;
  transition: transform 0.3s ease, color 0.2s;
}

.faq-item.faq-open .faq-chevron {
  transform: rotate(180deg);
  color: #ff8705;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s ease;
  padding: 0 20px;
  box-sizing: border-box;
}

.faq-item.faq-open .faq-answer {
  max-height: 5000px;
  padding-bottom: 20px;
}

.faq-answer p {
  color: #999;
  font-size: 0.88rem;
  line-height: 1.75;
  margin: 0 0 8px;
}

.faq-answer p:last-child { margin-bottom: 0; }

.faq-answer img {
  max-width: 100%;
  border-radius: 6px;
  margin: 10px 0;
  display: block;
}

.faq-answer .image-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.faq-answer .image-row .responsive-img {
  flex: 1;
  min-width: 100px;
  width: auto;
}

.faq-answer .glow-paragraph {
  color: #ff9800;
  font-size: 0.88rem;
  line-height: 1.75;
  margin: 0 0 8px;
  display: block;
}

@media (max-width: 600px) {
  .public-page { padding: 72px 16px 40px; }
  .public-hero h1 { font-size: 1.7rem; }
  .public-card-grid { grid-template-columns: 1fr; }
}

/* ---- Light mode ---- */
[data-theme="light"] .public-hero h1    { color: #fff; }
[data-theme="light"] .public-hero-sub  { color: rgba(255,255,255,0.9); }

[data-theme="light"] .public-card {
  background: #ffffff;
  border-color: #dde1e9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
[data-theme="light"] .public-card:hover {
  box-shadow: 0 4px 20px rgba(255,135,5,0.12);
  border-top-color: #ff8705;
}
[data-theme="light"] .public-card h3   { color: #1a1a2e; }
[data-theme="light"] .public-card p    { color: #555; }
[data-theme="light"] .public-card-role { color: #e06600; }

[data-theme="light"] .faq-item {
  background: #ffffff;
  border-color: #dde1e9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
[data-theme="light"] .faq-item.faq-open         { border-color: #ff8705; }
[data-theme="light"] .faq-question              { color: #1a1a2e; }
[data-theme="light"] .faq-question:hover        { color: #ff8705; }
[data-theme="light"] .faq-item.faq-open .faq-question { color: #e06600; }
[data-theme="light"] .faq-item.faq-open .faq-chevron  { color: #e06600; }
[data-theme="light"] .faq-answer p              { color: #555; }
[data-theme="light"] .faq-answer .glow-paragraph { color: #e06600; }

/* ═══════════════════════════════════════════════════════════════════
   ADVANCED DASHBOARD
   ═══════════════════════════════════════════════════════════════════ */

/* "Advanced" badge in navbar */
.adv-page-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(255,135,5,0.18);
  color: #ff8705;
  border: 1px solid rgba(255,135,5,0.4);
  flex-shrink: 0;
}

/* Advanced tab link — uses chart-apply-btn for base styling;
   these overrides suppress the conflicting .mainnav-left a rules */
.mainnav-left a.adv-nav-tab {
  padding: 0 12px !important;
  height: 28px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #ff9800 !important;
  overflow: hidden !important;
  position: relative !important;
  line-height: 28px !important;
  display: inline-flex !important;
  align-items: center !important;
}
/* Replace .mainnav-left a::before (slow opacity fade) with chart-apply-btn's fast slide */
.mainnav-left a.adv-nav-tab::before {
  opacity: 1 !important;
  transition: left 0.25s ease !important;
}
.mainnav-left a.adv-nav-tab:hover { color: #000 !important; }

/* Breadcrumb bar */
.adv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 0;
  font-size: 12px;
  color: #666;
}
.adv-back-link {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #888;
  text-decoration: none;
  transition: color 0.2s;
}
.adv-back-link:hover { color: #ff8705; }
.adv-back-link .material-icons { font-size: 14px; }
.adv-breadcrumb-sep { opacity: 0.4; }
.adv-breadcrumb-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.adv-layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  background: #1e1f2b;
  border: 1px solid #2a2b3c;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.adv-layout-btn .material-icons { font-size: 13px; line-height: 1; }
.adv-layout-btn:hover { background: #2a2b3c; color: #fff; border-color: #3a3b4c; }
.adv-layout-btn.active { background: #2a2b3c; color: #fff; border-color: #3a3b4c; }

/* Main content override */
.adv-main-content { padding-top: 6px !important; }

/* ── GridStack container ──────────────────────────────────────────── */
#advanced-grid.grid-stack { background: transparent; padding: 4px; min-height: 200px; }
.grid-stack-item-content { overflow: visible !important; }

/* ── Widget card ──────────────────────────────────────────────────── */
.adv-widget {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1c1d2a;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #282938;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
html[data-theme="light"] .adv-widget {
  background: #ffffff;
  border-color: #e2e2e8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.adv-widget-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: #22233200;
  border-bottom: 1px solid #282938;
  flex-shrink: 0;
  min-height: 32px;
  box-sizing: border-box;
}
html[data-theme="light"] .adv-widget-header { border-bottom-color: #e2e2e8; }

.adv-drag-handle {
  font-size: 16px !important;
  color: #444;
  flex-shrink: 0;
  cursor: default;
  opacity: 0.3;
  transition: opacity 0.2s, color 0.2s;
  user-select: none;
}
.adv-drag-handle:hover { color: #ff8705; }

.adv-widget-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #bbb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme="light"] .adv-widget-title { color: #333; }

.adv-widget-actions { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }

.adv-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.adv-icon-btn:hover { background: rgba(255,255,255,0.08); color: #bbb; }
.adv-icon-btn .material-icons { font-size: 13px; }
.adv-delete-btn:hover { color: #e57373 !important; background: rgba(229,115,115,0.1) !important; }
html[data-theme="light"] .adv-icon-btn { color: #888; }
html[data-theme="light"] .adv-icon-btn:hover { background: rgba(0,0,0,0.06); color: #444; }

.adv-widget-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  overflow: auto;
}
.adv-widget-body .adv-stat-cards {
  margin-bottom: 0;
}

.adv-live-stats-bat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adv-widget-body canvas {
  flex: 1;
  min-height: 0;
  width: 100% !important;
}

/* Loading and empty states */
.adv-loading, .adv-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 60px;
  color: #555;
  font-size: 12px;
  text-align: center;
}

/* Page-level empty state */
#adv-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #555;
  text-align: center;
  gap: 6px;
}
.adv-empty-icon { font-size: 48px !important; opacity: 0.25; }
#adv-empty-state p { margin: 0; font-size: 13px; }
#adv-empty-state strong { color: #ff8705; }

/* ── Fullscreen widget ────────────────────────────────────────────── */
.adv-fs {
  position: fixed !important;
  top: 52px !important;
  left: 260px !important;
  right: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  z-index: 500 !important;
}
.admin-sidebar.collapsed ~ .admin-main .adv-fs { left: 56px !important; }
body.adv-has-fs #advanced-grid { pointer-events: none; }
.adv-fs { pointer-events: all !important; }

/* ── Modals ───────────────────────────────────────────────────────── */
.adv-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.adv-modal {
  background: #1c1d2a;
  border-radius: 10px;
  border: 1px solid #2a2b3c;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 580px;
  max-width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.adv-modal-sm { width: 420px; }
html[data-theme="light"] .adv-modal { background: #fff; border-color: #ddd; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }

.adv-modal-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #2a2b3c;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}
html[data-theme="light"] .adv-modal-header { border-bottom-color: #e0e0e0; }

.adv-modal-title { font-size: 15px; font-weight: 700; color: #eee; margin: 0 0 2px; }
html[data-theme="light"] .adv-modal-title { color: #222; }

.adv-modal-sub { display: block; font-size: 11px; color: #777; }

.adv-modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: transparent; border: none;
  border-radius: 4px; cursor: pointer; color: #777; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.adv-modal-close:hover { background: rgba(255,255,255,0.08); color: #ccc; }
.adv-modal-close .material-icons { font-size: 18px; }
html[data-theme="light"] .adv-modal-close:hover { background: rgba(0,0,0,0.06); color: #333; }

.adv-modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }

.adv-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #2a2b3c;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}
html[data-theme="light"] .adv-modal-footer { border-top-color: #e0e0e0; }

/* Widget type options in Add modal */
.adv-widget-category { margin-bottom: 18px; }
.adv-category-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #ff8705;
  margin-bottom: 8px;
}
.adv-widget-options { display: flex; flex-direction: column; gap: 2px; }
.adv-widget-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.adv-widget-option:hover {
  background: rgba(255,135,5,0.08);
  border-color: rgba(255,135,5,0.25);
}
.adv-widget-option-icon { font-size: 22px !important; color: #4fc3f7; flex-shrink: 0; }
.adv-widget-option-label { font-size: 13px; font-weight: 600; color: #ddd; }
.adv-widget-option-desc  { font-size: 11px; color: #777; margin-top: 1px; }
html[data-theme="light"] .adv-widget-option-label { color: #222; }

/* Config modal form */
.adv-form-group { margin-bottom: 16px; }
.adv-form-group label {
  display: block;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: #777; margin-bottom: 6px;
}
.adv-form-input {
  width: 100%; box-sizing: border-box;
  background: #252636; border: 1px solid #2a2b3c;
  border-radius: 4px; padding: 7px 10px;
  font-size: 13px; color: #ddd; outline: none;
  transition: border-color 0.2s;
}
.adv-form-input:focus { border-color: #ff8705; }
html[data-theme="light"] .adv-form-input { background: #f5f5f7; border-color: #ddd; color: #333; }
html[data-theme="light"] .adv-form-input:focus { border-color: #ff8705; }

.adv-checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #ccc; padding: 4px 0; cursor: pointer;
}
.adv-checkbox-row input[type="checkbox"] { cursor: pointer; accent-color: #ff8705; }
html[data-theme="light"] .adv-checkbox-row { color: #333; }

/* ── HTML Widget Styles ───────────────────────────────────────────── */

/* Battery Summary */
.adv-summary-bat { margin-bottom: 10px; }
.adv-summary-bat-header {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #ff8705;
  margin-bottom: 6px; padding-bottom: 4px;
  border-bottom: 1px solid #282938;
}
html[data-theme="light"] .adv-summary-bat-header { border-bottom-color: #e2e2e8; }

.adv-summary-historic {
  font-size: 10px; color: #888; margin-bottom: 6px;
  display: flex; align-items: center; gap: 3px;
}
.adv-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
}
html[data-theme="light"] .adv-summary-row { border-bottom-color: rgba(0,0,0,0.05); }
.adv-summary-label { color: #888; }
.adv-summary-value { color: #4fc3f7; font-weight: 600; }
html[data-theme="light"] .adv-summary-label { color: #666; }
html[data-theme="light"] .adv-summary-value { color: #0277bd; }

/* Cell Balance */
.adv-cellbal-bat { margin-bottom: 10px; }
.adv-cellbal-bat-header {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #ff8705; margin-bottom: 8px;
}
.adv-cellbal-legend {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: #777; margin-bottom: 8px;
}
.adv-cellbal-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.adv-cellbal-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.adv-cellbal-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #252636;
  border: 2px solid #333;
  transition: background 0.25s, border-color 0.25s;
}
.adv-cellbal-inactive-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #252636;
  border: 2px solid #333;
  display: inline-block;
}
.adv-cellbal-active .adv-cellbal-dot {
  background: #ff8705;
  border-color: #ff8705;
  box-shadow: 0 0 6px rgba(255,135,5,0.5);
}
.adv-cellbal-label { font-size: 9px; color: #666; }
html[data-theme="light"] .adv-cellbal-dot { background: #eee; border-color: #ccc; }
html[data-theme="light"] .adv-cellbal-inactive-dot { background: #eee; border-color: #ccc; }

/* Alarms */
.adv-alarms-bat { margin-bottom: 10px; }
.adv-alarms-bat-header {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #ff8705; margin-bottom: 6px;
}
.adv-alarm-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
}
html[data-theme="light"] .adv-alarm-row { border-bottom-color: rgba(0,0,0,0.05); }
.adv-alarm-label { flex: 1; color: #ccc; }
.adv-alarm-val   { font-size: 11px; color: #888; }
.adv-alarm-ok .adv-alarm-label { color: #4caf50; }
html[data-theme="light"] .adv-alarm-label { color: #333; }
html[data-theme="light"] .adv-alarm-ok .adv-alarm-label { color: #2e7d32; }
