/* ==========================================================================
   ME2C Monitoring Platform - Modern Filigree Design System
   Multi-Theme (Light & Dark) • Collapsible Sidebar • High-Precision UI
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Common Accent Tokens */
  --accent-primary: #0284c7;         /* Sky Blue */
  --accent-primary-hover: #0369a1;
  --accent-primary-glow: rgba(2, 132, 199, 0.12);
  --accent-emerald: #059669;         /* Fresh Emerald Green */
  --accent-emerald-glow: rgba(5, 150, 105, 0.12);
  --accent-emerald-subtle: rgba(5, 150, 105, 0.08);
  --accent-amber: #d97706;           /* Amber */
  --accent-amber-glow: rgba(217, 119, 6, 0.12);
  --accent-rose: #e11d48;            /* Rose / Red */
  --accent-rose-glow: rgba(225, 29, 72, 0.12);
  --accent-cyan: #0891b2;            /* Cyan */
  --accent-purple: #7c3aed;          /* Purple */

  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Spacing & Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --sidebar-width-expanded: 256px;
  --sidebar-width-collapsed: 68px;
  --topbar-height: 60px;
  --transition-speed: 0.22s;
  --transition-bezier: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (Default / Bright & Filigree) */
[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f1f5f9;
  --bg-surface-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  --border-color: #e2e8f0;
  --border-color-subtle: #edf2f7;
  --border-color-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 6px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-dropdown: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);

  --chart-grid-color: rgba(100, 116, 139, 0.12);
  --chart-label-color: #64748b;
  --chart-title-color: #0f172a;
  --code-box-bg: #f8fafc;
  --code-box-border: #e2e8f0;
  --code-box-text: #0284c7;
}

/* Dark Theme (Modern Sleek Slate Dark) */
[data-theme="dark"] {
  --bg-page: #0b1120;
  --bg-surface: #111a2e;
  --bg-surface-secondary: #17233d;
  --bg-surface-tertiary: #1f3052;
  --bg-card: #131f36;
  --bg-card-hover: #182744;
  --bg-input: #0e172a;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.09);

  --border-color: #1f3050;
  --border-color-subtle: #17243c;
  --border-color-strong: #2c426b;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --text-inverse: #0f172a;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-card: 0 2px 6px 0 rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 8px 20px 0 rgba(0, 0, 0, 0.35);
  --shadow-dropdown: 0 12px 30px 0 rgba(0, 0, 0, 0.45);

  --chart-grid-color: rgba(255, 255, 255, 0.06);
  --chart-label-color: #94a3b8;
  --chart-title-color: #f8fafc;
  --code-box-bg: #070c17;
  --code-box-border: #1f3050;
  --code-box-text: #38bdf8;
}

/* --------------------------------------------------------------------------
   2. Reset & Global Typography
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-main);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Headings with fine, filigree weights */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 1.65rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }
h6 { font-size: 0.85rem; }

p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-primary-hover);
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   3. Application Shell & Sidebar Layout
   -------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--bg-page);
}

/* Left Sidebar */
.me2c-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width-expanded);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition-speed) var(--transition-bezier), transform var(--transition-speed) var(--transition-bezier);
  box-shadow: var(--shadow-sm);
}

/* Sidebar Brand Header */
.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color-subtle);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.brand-logo-img {
  height: 30px;
  width: auto;
  border-radius: var(--radius-xs);
  background: #ffffff;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  transition: opacity var(--transition-speed) ease, width var(--transition-speed) ease;
}

.brand-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

.brand-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-emerald);
  letter-spacing: 0.03em;
}

/* Sidebar Navigation Items */
.sidebar-nav {
  flex: 1;
  padding: 0.85rem 0.65rem;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 0.6rem 0.65rem 0.25rem;
  white-space: nowrap;
  transition: opacity var(--transition-speed) ease;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.87rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  position: relative;
}

.nav-link-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-link-item.active {
  background-color: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  font-weight: 600;
}

.nav-link-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background-color: var(--accent-emerald);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.nav-label {
  flex: 1;
  transition: opacity var(--transition-speed) ease;
}

.nav-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-surface-secondary);
  color: var(--text-muted);
}

/* Sidebar Footer (User info & collapse toggle) */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-collapse-btn {
  width: 100%;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color-strong);
}

/* Collapsed Sidebar State */
.sidebar-collapsed .me2c-sidebar {
  width: var(--sidebar-width-collapsed);
}

.sidebar-collapsed .brand-info,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .sidebar-nav-header,
.sidebar-collapsed .collapse-text {
  display: none !important;
}

.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0 0.5rem;
}

.sidebar-collapsed .nav-link-item {
  justify-content: center;
  padding: 0.6rem 0;
}

.sidebar-collapsed .sidebar-collapse-btn {
  padding: 0.45rem 0;
}

/* --------------------------------------------------------------------------
   4. Main Content Wrapper & Topbar
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width-expanded);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--transition-speed) var(--transition-bezier);
}

.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-width-collapsed);
}

/* Topbar Header */
.me2c-topbar {
  height: var(--topbar-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 900;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.topbar-toggle-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color-strong);
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Live MQTT Pulse Badge */
.live-pulse-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background-color: var(--accent-emerald-glow);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 5px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Theme Switcher Button */
.theme-switch-btn {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.theme-switch-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color-strong);
  transform: translateY(-1px);
}

.theme-icon-sun, .theme-icon-moon {
  width: 17px;
  height: 17px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* User Role & Switcher */
.role-badge {
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.role-badge.admin { background-color: var(--accent-rose-glow); color: var(--accent-rose); border: 1px solid rgba(225, 29, 72, 0.25); }
.role-badge.reseller { background-color: var(--accent-primary-glow); color: var(--accent-primary); border: 1px solid rgba(2, 132, 199, 0.25); }
.role-badge.user { background-color: var(--accent-emerald-glow); color: var(--accent-emerald); border: 1px solid rgba(5, 150, 105, 0.25); }

.user-profile-btn {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-profile-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-color-strong);
}

/* Page Main Body Container */
.me2c-content-body {
  flex: 1;
  padding: 1.5rem 1.75rem;
  max-width: 100%;
}

/* Footer */
.me2c-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  padding: 0.85rem 1.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   5. Filigree Card & KPI Component Architecture
   -------------------------------------------------------------------------- */
.me2c-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color var(--transition-speed) ease;
}

.me2c-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-strong);
}

.card-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-color-subtle);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: -0.01em;
}

/* KPI Grid & Filigree Metric Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-strong);
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.kpi-card-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  opacity: 0.85;
}

.kpi-card-value {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  line-height: 1.15;
}

.kpi-unit {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --------------------------------------------------------------------------
   6. Status Badges, Status Pills & Interactive Elements
   -------------------------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-pill.online {
  background-color: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.status-pill.warning {
  background-color: var(--accent-amber-glow);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.status-pill.fault, .status-pill.offline {
  background-color: var(--accent-rose-glow);
  color: var(--accent-rose);
  border: 1px solid rgba(225, 29, 72, 0.25);
}

/* Buttons */
.btn-me2c-primary {
  background: var(--accent-emerald);
  color: #ffffff !important;
  border: 1px solid var(--accent-emerald);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
  transition: all 0.15s ease;
}

.btn-me2c-primary:hover {
  background: #047857;
  border-color: #047857;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.3);
  transform: translateY(-1px);
}

.btn-me2c-secondary {
  background-color: var(--bg-surface-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-me2c-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-color-strong);
  color: var(--text-main);
}

/* Code Box Component */
.code-box {
  background-color: var(--code-box-bg);
  border: 1px solid var(--code-box-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--code-box-text);
  overflow-x: auto;
  line-height: 1.6;
}

/* Form Controls Adaptivity */
.form-control, .form-select {
  background-color: var(--bg-input) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px var(--accent-primary-glow) !important;
  outline: none;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

/* Modals */
.modal-content {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
}

.modal-header {
  border-bottom: 1px solid var(--border-color-subtle) !important;
  padding: 1rem 1.25rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color-subtle) !important;
  padding: 0.85rem 1.25rem;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Dropdowns */
.dropdown-menu {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 0.4rem;
}

.dropdown-item {
  color: var(--text-secondary) !important;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
  padding: 0.4rem 0.65rem;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background-color: var(--bg-hover) !important;
  color: var(--text-main) !important;
}

.dropdown-divider {
  border-color: var(--border-color-subtle) !important;
  margin: 0.3rem 0;
}

.dropdown-header {
  color: var(--text-muted) !important;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.65rem 0.2rem;
}

/* --------------------------------------------------------------------------
   7. DevExtreme Theme Integration Overrides
   -------------------------------------------------------------------------- */
.dx-widget, .dx-datagrid, .dx-chart {
  font-family: var(--font-main) !important;
}

.dx-datagrid {
  background-color: transparent !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
}

.dx-datagrid-headers {
  background-color: var(--bg-surface-secondary) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dx-data-row {
  border-bottom: 1px solid var(--border-color-subtle) !important;
  transition: background-color 0.12s ease !important;
}

.dx-data-row:hover {
  background-color: var(--bg-hover) !important;
}

.dx-datagrid .dx-row-alt {
  background-color: var(--bg-surface-secondary) !important;
}

.dx-datagrid-search-panel input {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.82rem !important;
}

.dx-pager {
  border-top: 1px solid var(--border-color-subtle) !important;
  padding-top: 0.5rem !important;
}

/* --------------------------------------------------------------------------
   8. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .me2c-sidebar {
    transform: translateX(-100%);
  }

  .sidebar-mobile-open .me2c-sidebar {
    transform: translateX(0);
  }

  .app-main, .sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
  }

  .sidebar-mobile-open .sidebar-backdrop {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   9. OpenStreetMap & Leaflet Live Telemetry Map Styles
   -------------------------------------------------------------------------- */
.map-container {
  height: calc(100vh - var(--topbar-height) - 170px);
  min-height: 520px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  z-index: 1;
}

/* Custom Leaflet Map Marker */
.plant-map-marker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 4px 10px 4px 6px;
  font-family: var(--font-main);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.plant-map-marker:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  border-color: var(--accent-primary);
  z-index: 1000 !important;
}

.plant-marker-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.plant-marker-dot.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 0 2px var(--accent-emerald-glow);
  animation: pulseDotGreen 2s infinite;
}

.plant-marker-dot.warning {
  background: var(--accent-amber);
  box-shadow: 0 0 0 2px var(--accent-amber-glow);
}

.plant-marker-dot.fault, .plant-marker-dot.offline {
  background: var(--accent-rose);
  box-shadow: 0 0 0 2px var(--accent-rose-glow);
}

@keyframes pulseDotGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

.plant-marker-power {
  font-weight: 700;
  color: var(--accent-emerald);
  letter-spacing: -0.01em;
}

.plant-marker-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-dropdown) !important;
  padding: 0 !important;
  font-family: var(--font-main) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.5 !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  padding: 6px !important;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--text-main) !important;
}

.map-popup-card {
  padding: 14px 16px;
  min-width: 250px;
}

.map-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color-subtle);
}

.map-popup-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.map-popup-power {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-emerald);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.map-popup-power-unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Map HUD Overlays */
.map-hud-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  backdrop-filter: blur(8px);
}

.map-control-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  gap: 6px;
}