/* =========================================
   IMPORT FONTS
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* =========================================
   1. GLOBAL & RESET
   ========================================= */
:root {
  --bg-app: #090d14;
  --bg-surface: #0f1520;
  --bg-panel: #141c2b;
  --bg-elevated: #1a2235;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.12);
  --accent-green: #10d9a0;
  --accent-amber: #f59e0b;
  --accent-red: #f43f5e;
  --text-main: #dde4f0;
  --text-muted: #6b7585;
  --text-subtle: #3d4654;
  --border-color: #1e2840;
  --border-bright: #3b82f6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  --shadow-kpi: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', system-ui, sans-serif;
}

body {
  display: flex;
  background-color: var(--bg-app);
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(59,130,246,0.055) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 85% 90%, rgba(16,217,160,0.035) 0%, transparent 100%);
  color: var(--text-main);
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: all 0.2s ease;
}

button.primary {
  background: var(--primary);
  color: white;
  padding: 9px 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.4), 0 4px 12px rgba(59,130,246,0.25);
}
button.primary:hover {
  background: #2563eb;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.6), 0 6px 20px rgba(59,130,246,0.35);
  transform: translateY(-1px);
}

button.danger {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-red);
  padding: 10px;
  width: 100%;
  font-weight: 600;
  border: 1px solid rgba(244, 63, 94, 0.3);
}
button.danger:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
button.danger:not(:disabled):hover {
  background: rgba(244, 63, 94, 0.2);
}

.hidden { display: none !important; }

/* =========================================
   2. LEFT NAVIGATION
   ========================================= */
.left-nav {
  width: 220px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-app) 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 1px 0 0 var(--border-color);
}

.left-nav.collapsed { width: 64px; }

.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 0 6px;
  height: 36px;
}

.logo-text {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-text::before {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 2px;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25), 0 0 12px rgba(59,130,246,0.6);
  flex-shrink: 0;
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(59,130,246,0.25), 0 0 12px rgba(59,130,246,0.6); }
  50%       { box-shadow: 0 0 0 4px rgba(59,130,246,0.15), 0 0 20px rgba(59,130,246,0.8); }
}

/* Live feed dot pulse */
@keyframes liveDotPulse {
  0%, 100% { opacity: 1;   box-shadow: 0 0 0 0   currentColor; }
  50%       { opacity: 0.7; box-shadow: 0 0 0 4px transparent; }
}
#liveFeedDot {
  animation: liveDotPulse 1.2s ease-in-out infinite;
}

.nav-toggle {
  background: transparent;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.nav-toggle:hover { color: var(--text-main); background: var(--bg-elevated); }

.left-nav.collapsed .logo-text { display: none; }
.left-nav.collapsed .nav-header { justify-content: center; }

.left-nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.left-nav li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.18s;
  font-weight: 500;
  font-size: 12px;
  position: relative;
}
.left-nav li:hover { background: var(--bg-elevated); color: var(--text-main); }
.left-nav li.active {
  background: var(--primary-glow);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.left-nav li.active .nav-icon { color: var(--primary); }
.left-nav li.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px rgba(59,130,246,0.6);
}

.nav-icon { flex-shrink: 0; }
.nav-text { font-size: 12px; }
.left-nav.collapsed .nav-text { display: none; }
.left-nav.collapsed li { justify-content: center; padding: 10px; }

/* =========================================
   3. TOP BAR & MAIN AREA
   ========================================= */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-app);
}

.top-bar {
  height: 54px;
  background: var(--topbar-bg, rgba(9,13,20,0.88));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03), 0 4px 24px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

#projectTitle {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  color: var(--text-main);
  font-size: 13px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#projectTitle::before {
  content: '◈';
  color: var(--primary);
  font-size: 16px;
}

.toggle-group { display: flex; align-items: center; gap: 10px; }
.toggle-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 1px;
}

.floor-switch-container {
  background: var(--bg-app);
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
  gap: 2px;
  border: 1px solid var(--border-color);
}

.floor-btn {
  background: transparent;
  color: var(--text-muted);
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}
.floor-btn:hover { color: var(--text-main); background: var(--bg-elevated); }
.floor-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.btn-exit {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 63, 94, 0.08);
  color: #fb7185;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(244, 63, 94, 0.2);
  font-size: 13px;
}
.btn-exit:hover { background: rgba(244, 63, 94, 0.15); border-color: rgba(244, 63, 94, 0.4); }

/* =========================================
   4. KPI STRIP
   ========================================= */
.kpi-strip {
  display: flex;
  gap: 12px;
  padding: 12px 12px 10px;
  flex-shrink: 0;
}

.kpi-card {
  flex: 1;
  background: var(--bg-surface);
  padding: 12px 16px;
  box-shadow: var(--shadow-kpi);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.kpi-card.blue::after { background: linear-gradient(90deg, var(--primary), #60a5fa); }
.kpi-card.green::after { background: linear-gradient(90deg, var(--accent-green), #6ee7b7); }
.kpi-card.yellow::after { background: linear-gradient(90deg, var(--accent-amber), #fcd34d); }
.kpi-card.red::after { background: linear-gradient(90deg, var(--accent-red), #fb7185); }

.kpi-card:hover { transform: translateY(-2px); border-color: var(--text-subtle); }

.kpi-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* =========================================
   5. WORKSPACE LAYOUT & SECTIONS
   ========================================= */
.workspace-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.section {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* DASHBOARD SECTION */
.dashboard-row {
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 0 12px 12px;
  overflow: hidden;
}

/* =========================================
   6. SENSOR SIDEBAR (COLLAPSIBLE — FIXED)
   ========================================= */
.sidebar {
  overflow: hidden;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              padding 0.35s ease,
              border-width 0.35s ease;
  flex-shrink: 0;
  /* Closed state by default */
  width: 0;
  opacity: 0;
  padding: 0;
  border-width: 0;
}

.sidebar.open {
  width: 260px;
  opacity: 1;
  padding: 20px;
  border-width: 1px;
}

.sidebar-title {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--text-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap;
}

#sensorLibrary {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#sensorLibrary::-webkit-scrollbar { width: 4px; }
#sensorLibrary::-webkit-scrollbar-track { background: transparent; }
#sensorLibrary::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 20px; }

/* TOPBAR EDIT BUTTON */
.btn-topbar-edit {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #0f172a;
  color: var(--text-muted);
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.btn-topbar-edit:hover { color: var(--text-main); border-color: var(--primary); }
.btn-topbar-edit.active {
  background: #1d4ed8;
  color: white;
  border-color: rgba(59,130,246,0.6);
  box-shadow: 0 0 16px rgba(59,130,246,0.25);
}

/* =========================================
   RIGHT PANEL WRAPPER & PANEL (BULLETPROOF)
   ========================================= */

/* The wrapper handles the width transition like a sliding window */
.right-panel-wrapper {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
  overflow: hidden; /* This hides the panel inside when shrinking */
  
  /* FORCE EXACT WIDTH SO FLEXBOX CANNOT GUESS */
  flex: 0 0 280px !important;
  width: 280px !important;
  max-width: 280px !important;
  min-width: 280px !important;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When collapsed, shrink wrapper strictly to the button's width */
.right-panel-wrapper.collapsed {
  flex: 0 0 20px !important;
  width: 20px !important;
  max-width: 20px !important;
  min-width: 20px !important;
}

/* PANEL TOGGLE TAB — sits on the left edge */
.panel-toggle-btn {
  /* Enforce exact button width */
  flex: 0 0 20px !important;
  width: 20px !important;
  min-width: 20px !important;
  
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}
.panel-toggle-btn:hover { background: var(--bg-panel); color: var(--primary); }

/* When panel is collapsed, toggle tab gets full rounded border */
.right-panel-wrapper.collapsed .panel-toggle-btn {
  border-right: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

/* THE PANEL ITSELF */
#panelMeta {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.panel {
  background: var(--bg-surface);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
  
  /* FORCE EXACT WIDTH SO IT CLIPS INSTEAD OF SQUISHING */
  flex: 0 0 260px !important;
  width: 260px !important;
  min-width: 260px !important;
  
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Fade out content inside to look smooth when masked */
.panel.collapsed {
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--text-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap;
}

/* =========================================
   7. CANVAS AREA
   ========================================= */
.canvas-container {
  flex: 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  display: flex;
  min-width: 0;
}

.canvas-frame {
  width: 100%;
  height: 100%;
  position: relative;
  flex: 1;
  overflow: hidden;
}

#canvas {
  width: 100%;
  height: 100%;
  position: relative;
  background-color: #06090f;
  background-image: radial-gradient(circle, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 26px 26px;
  overflow: hidden;
}
#canvas::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(59,130,246,0.18) 30%, rgba(59,130,246,0.35) 50%, rgba(59,130,246,0.18) 70%, transparent 100%);
  animation: scanLine 8s linear infinite;
  z-index: 2;
  pointer-events: none;
}
@keyframes scanLine {
  0%   { top: -2px; opacity: 0; }
  3%   { opacity: 1; }
  97%  { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

#unityContainer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
#unityContainer iframe { pointer-events: auto; } /* restore after login */
iframe { width: 100%; height: 100%; border: none; display: block; }

/* =========================================
   8. SENSORS
   ========================================= */
.sensor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: grab;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.18s;
  white-space: nowrap;
}
.sensor-item:hover {
  background: var(--bg-panel);
  border-color: var(--primary);
  transform: translateX(3px);
  box-shadow: -3px 0 0 var(--primary);
}
.sensor-item:active { cursor: grabbing; }
.sensor-item.armed {
  background: rgba(59,130,246,0.15);
  border-color: var(--primary);
  box-shadow: -3px 0 0 var(--primary), 0 0 12px rgba(59,130,246,0.25);
  cursor: crosshair;
}
.sensor-lib-icon { width: 16px; height: 16px; opacity: 0.6; filter: invert(1); }

/* ARM HINT BANNER */
.arm-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(59,130,246,0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

/* SENSOR DOTS ON MAP */
.sensor {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sensor:hover { transform: scale(1.25); z-index: 20; }
.sensor-icon { width: 16px; height: 16px; filter: invert(1); pointer-events: none; }

.sensor.status-ok { background: #064e3b; border: 2px solid var(--accent-green); box-shadow: 0 0 12px rgba(34, 211, 165, 0.4); }
.sensor.status-warn { background: #451a03; border: 2px solid var(--accent-amber); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.sensor.status-critical { background: #4c0519; border: 2px solid var(--accent-red); box-shadow: 0 0 12px rgba(244, 63, 94, 0.5); animation: pulse 2s infinite; }

.sensor-value {
  position: absolute;
  bottom: -28px;
  background: var(--bg-panel);
  color: var(--text-main);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border-color);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0px rgba(244, 63, 94, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0px rgba(244, 63, 94, 0); }
}

/* EDIT MODE BUTTON */
#toggleEditModeBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 8px 16px;
}

/* =========================================
   9. ALERTS, WORK ORDERS & ASSETS
   ========================================= */
.section.alerts,
.section.workorders,
.section.assets,
.section.operations,
.section.sensors,
.section.reports,
.section.compliance,
.section.sustainability,
.section.admin,
.section.analytics,
.section.people,
.section.inventory,
.section.space,
.section.energy,
.section.services {
  padding: 28px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.alert-dashboard-header {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.alert-stat-card {
  flex: 1;
  background: var(--bg-surface);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.alert-stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.alert-stat-card.red::before { background: var(--accent-red); }
.alert-stat-card.yellow::before { background: var(--accent-amber); }
.alert-stat-card.green::before { background: var(--accent-green); }
.alert-stat-card.blue::before { background: var(--primary); }

.stat-icon { font-size: 22px; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-main); }

.alert-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.search-wrapper input {
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  width: 280px;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}
.search-wrapper input::placeholder { color: var(--text-subtle); }
.search-wrapper input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.filter-wrapper { display: flex; gap: 10px; }
.filter-wrapper select {
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}

.alert-table-container {
  flex: 1;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: auto;          /* allow horizontal scroll for wide tables */
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Assets — fixed column widths so rows stay aligned regardless of content */
.section.assets .alert-table-container { overflow-x: auto; }
.section.assets .alert-table           { min-width: 980px; table-layout: fixed; width: 100%; }
.section.assets .alert-table thead,
.section.assets .alert-table tbody tr  { table-layout: fixed; }

/* Per-column widths: ID | Type | Location | Condition | Health | Serviced | Notes | Action */
/* Total = 90+130+140+110+130+120+160+100 = 980px — matches min-width above */
.section.assets .alert-table th:nth-child(1),
.section.assets .alert-table td:nth-child(1) { width: 90px; }
.section.assets .alert-table th:nth-child(2),
.section.assets .alert-table td:nth-child(2) { width: 130px; }
.section.assets .alert-table th:nth-child(3),
.section.assets .alert-table td:nth-child(3) { width: 140px; }
.section.assets .alert-table th:nth-child(4),
.section.assets .alert-table td:nth-child(4) { width: 110px; }
.section.assets .alert-table th:nth-child(5),
.section.assets .alert-table td:nth-child(5) { width: 130px; }
.section.assets .alert-table th:nth-child(6),
.section.assets .alert-table td:nth-child(6) { width: 120px; }
.section.assets .alert-table th:nth-child(7),
.section.assets .alert-table td:nth-child(7) { width: 160px; }
.section.assets .alert-table th:nth-child(8),
.section.assets .alert-table td:nth-child(8) { width: 100px; }

/* Truncate long text cleanly in all asset cells */
.section.assets .alert-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.alert-table thead {
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.alert-table th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.alert-table tbody { display: block; overflow-y: auto; max-height: calc(100vh - 340px); width: 100%; }
.alert-table thead, .alert-table tbody tr { display: table; width: 100%; table-layout: fixed; }
.alert-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}
.alert-table tr:hover td { background: var(--bg-elevated); }
.alert-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.013); }
.alert-table tbody tr:nth-child(even):hover td { background: var(--bg-elevated); }

/* BADGES */
.badge {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}
.badge.critical { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.green { background: rgba(34, 211, 165, 0.12); color: var(--accent-green); border: 1px solid rgba(34, 211, 165, 0.25); }
.badge.open { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.progress { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.done { background: rgba(34, 211, 165, 0.12); color: var(--accent-green); border: 1px solid rgba(34, 211, 165, 0.25); }
.badge.high { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge.medium { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }
.badge.low { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-color); }

/* ASSIGNEE */
.assignee-badge { display: flex; align-items: center; gap: 8px; }
.assignee-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-family: 'Space Mono', monospace;
}

.btn-resolve {
  padding: 5px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
}
.btn-resolve:hover { background: var(--primary-glow); color: var(--primary); border-color: rgba(59,130,246,0.5); }

/* =========================================
   10. ADMIN, SPACE, ENERGY & SERVICES
   ========================================= */
.section.admin, .section.space, .section.energy, .section.services,
.section.inventory, .section.people {
  padding: 28px;
  overflow-y: auto;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.admin-card.full-width { grid-column: span 2; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.admin-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.setting-group { margin-bottom: 18px; }
.setting-group label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.range-wrap { display: flex; align-items: center; gap: 14px; }
input[type=range] { flex: 1; accent-color: var(--primary); }
output {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  width: 48px;
  text-align: right;
}

.btn-save {
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.btn-save:hover { border-color: var(--primary); color: var(--primary); }

/* USER TABLE */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.admin-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 30px; height: 30px;
  background: var(--bg-elevated);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-family: 'Space Mono', monospace;
}

.role-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
}
.role-badge.admin { background: rgba(244, 63, 94, 0.12); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.25); }
.role-badge.editor { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.25); }
.role-badge.viewer { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border-color); }

.status-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 5px;
}
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.offline { background: var(--text-subtle); }

.btn-add {
  border: 1px dashed var(--border-color);
  background: transparent;
  color: var(--primary);
  padding: 6px 12px;
  font-size: 12px;
}
.btn-add:hover { background: var(--primary-glow); border-color: var(--primary); }

/* BATTERY GRID */
.battery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.battery-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-elevated);
}
.bat-header { font-size: 11px; color: var(--text-muted); display: flex; justify-content: space-between; font-family: 'Space Mono', monospace; }
.bat-level-bg { height: 4px; background: var(--bg-app); border-radius: 2px; overflow: hidden; }
.bat-level-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot.ok { background: var(--accent-green); }
.dot.warn { background: var(--accent-red); }

/* =========================================
   11. MODAL & UTILS
   ========================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal {
  background: var(--bg-surface);
  padding: 36px;
  border-radius: var(--radius-lg);
  width: 420px;
  text-align: center;
  border: 1px solid var(--border-color);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal h3 {
  margin-top: 0;
  color: var(--text-main);
  font-size: 20px;
  margin-bottom: 8px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
}
.modal p { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* Modal form inputs */
.modal input, .modal select {
  background: var(--bg-elevated) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  font-family: 'DM Sans', sans-serif !important;
}
.modal input:focus, .modal select:focus {
  border-color: var(--primary) !important;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

body.setup .left-nav, body.setup .main-area { display: none; }
.center-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  background: var(--bg-surface);
  margin: 0 28px 28px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}
.center-page h2 { color: var(--text-muted); margin-bottom: 8px; }

/* Room status table in Space section */
.section.space .alert-table thead { background: var(--bg-app); }
.secticon.space .alert-table td { border-bottom-color: var(--border-color); }

.dashboard-row .hidden { display: none !important; }

/* =========================================
   VISUAL POLISH — added enhancements
   ========================================= */

/* Section fade-in animation */
@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section:not(.hidden) {
  animation: sectionFadeIn 0.22s ease;
}

/* KPI card coloured left-border accents */
.kpi-card { border-left: 3px solid transparent; }
.kpi-card.blue   { border-left-color: var(--primary); }
.kpi-card.green  { border-left-color: var(--accent-green); }
.kpi-card.yellow { border-left-color: var(--accent-amber); }
.kpi-card.red    { border-left-color: var(--accent-red); }

/* Stat cards coloured left-border accents */
.alert-stat-card { border-left: 3px solid transparent; }
.alert-stat-card.blue   { border-left-color: var(--primary); }
.alert-stat-card.green  { border-left-color: var(--accent-green); }
.alert-stat-card.yellow { border-left-color: var(--accent-amber); }
.alert-stat-card.red    { border-left-color: var(--accent-red); }

/* Table row hover */
.alert-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: rgba(59,130,246,0.06);
  transition: background 0.15s ease;
}

/* Backend status indicator */
.backend-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 6px;
}
.status-dot-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-indicator.online  { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot-indicator.offline { background: var(--accent-red); }

/* Badge colour variants */
.badge.blue   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge.green  { background: rgba(34,211,165,0.15);  color: var(--accent-green); }

/* Inventory / People — single-column card stack, natural table height */
.section.inventory .admin-grid,
.section.people .admin-grid {
  grid-template-columns: 1fr;
  max-width: 100%;
  margin: 0;
  gap: 16px;
}

/* Let tables inside these admin-cards grow naturally (section scrolls) */
.section.inventory .admin-card .alert-table tbody,
.section.people .admin-card .alert-table tbody {
  display: table-row-group;
  max-height: none;
  overflow-y: visible;
  width: auto;
}
.section.inventory .admin-card .alert-table thead,
.section.people .admin-card .alert-table thead {
  display: table-header-group;
}
.section.inventory .admin-card .alert-table thead tr,
.section.inventory .admin-card .alert-table tbody tr,
.section.people .admin-card .alert-table thead tr,
.section.people .admin-card .alert-table tbody tr {
  display: table-row;
  width: auto;
}

/* =========================================
   EXPAND TABLE BUTTON
   ========================================= */
.btn-expand-table {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-expand-table:hover {
  color: var(--primary);
  border-color: rgba(59,130,246,0.5);
  background: var(--primary-glow);
}
.btn-expand-table.expanded {
  color: var(--accent-amber);
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.08);
}

/* When section is in table-expanded mode — hide charts + stat cards */
.section.table-expanded .section-charts-row     { display: none !important; }
.section.table-expanded .alert-dashboard-header { display: none !important; }
.section.table-expanded .alert-table-container  { flex: 1; min-height: 0; overflow-y: auto; }
.section.table-expanded .alert-table            { font-size: 14px !important; }
.section.table-expanded .alert-table td,
.section.table-expanded .alert-table th         { padding: 12px 16px !important; }

/* Scrollable table box */
.table-scroll-box {
  max-height: 320px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.table-scroll-box thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-panel);
}
.admin-card.card-expanded .table-scroll-box {
  max-height: none;
  overflow-y: visible;
  border: none;
  border-radius: 0;
}

/* Card expanded — full-screen overlay */
.admin-card.card-expanded {
  position: fixed;
  inset: 54px 0 0 0;
  z-index: 800;
  border-radius: 0;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg-app);
}
.admin-card.card-expanded .admin-header {
  margin-bottom: 20px;
}
.admin-card.card-expanded .alert-table {
  width: 100% !important;
  font-size: 14px !important;
}
.admin-card.card-expanded .alert-table tbody {
  display: table-row-group !important;
  max-height: none !important;
  overflow-y: visible !important;
}
.admin-card.card-expanded .alert-table thead    { display: table-header-group !important; }
.admin-card.card-expanded .alert-table thead tr,
.admin-card.card-expanded .alert-table tbody tr { display: table-row !important; width: auto !important; }
.admin-card.card-expanded .alert-table td,
.admin-card.card-expanded .alert-table th       { padding: 12px 16px !important; }

/* =========================================
   SECTION CHART ROW — reusable 2-col chart grid
   ========================================= */
.section-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.section-charts-row .admin-card { padding: 16px 18px; }
.section-charts-row .chart-wrap { min-height: 180px; position: relative; }

/* Sections that have chart rows need scroll + padding */
.section.alerts,
.section.workorders,
.section.assets,
.section.operations,
.section.inventory,
.section.people {
  overflow-y: auto;
}

/* Service status cards grid */
.services-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.service-card-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.service-uptime-bar { height: 5px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.service-uptime-fill { height: 100%; border-radius: 3px; }
.service-meta { font-size: 11px; color: var(--text-muted); font-family: 'Space Mono', monospace; }

/* Pulse dot animation */
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0px currentColor; }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0px transparent; }
}
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  animation: livePulse 2s infinite;
}
.pulse-dot.online   { background: var(--accent-green); color: var(--accent-green); }
.pulse-dot.warning  { background: var(--accent-amber); color: var(--accent-amber); animation-duration: 1s; }
.pulse-dot.offline  { background: var(--accent-red);   color: var(--accent-red);   animation: none; }

/* Space section room cards */
.room-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.room-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-card-title { font-size: 13px; font-weight: 600; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; }
.room-occ-bar { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.room-occ-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.room-meta { font-size: 11px; color: var(--text-muted); font-family: 'Space Mono', monospace; }

/* =========================================
   ANALYTICS SECTION
   ========================================= */
.section.analytics {
  padding: 28px;
  overflow: auto;          /* override base overflow:hidden on both axes */
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0;
  max-width: 100%;
  flex-shrink: 0;          /* don't compress — let section scroll vertically */
}
.analytics-chart-card { min-height: 280px; display: flex; flex-direction: column; }
.analytics-full { grid-column: span 2; }
.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 200px;
  max-height: 240px;
}

/* Health Score pill */
.health-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
}
.health-bar-bg {
  width: 52px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* =========================================
   THEME TOGGLE BUTTON
   ========================================= */
.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}
.btn-theme-toggle:hover {
  color: var(--accent-amber);
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.08);
}

/* =========================================
   LIGHT MODE THEME
   ========================================= */
body.light-mode {
  --bg-app:       #f1f5f9;
  --bg-surface:   #ffffff;
  --bg-panel:     #f8fafc;
  --bg-elevated:  #e2e8f0;
  --primary:      #2563eb;
  --primary-glow: rgba(37,99,235,0.1);
  --accent-green: #059669;
  --accent-amber: #d97706;
  --accent-red:   #e11d48;
  --text-main:    #0f172a;
  --text-muted:   #475569;
  --text-subtle:  #94a3b8;
  --border-color: #cbd5e1;
  --border-bright:#2563eb;
  /* top bar uses this CSS variable */
  --topbar-bg:    rgba(255,255,255,0.92);
}

/* Body ambient glow — softer in light mode */
body.light-mode {
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(37,99,235,0.04) 0%, transparent 100%),
    radial-gradient(ellipse 55% 40% at 85% 90%, rgba(5,150,105,0.025) 0%, transparent 100%);
}

/* Top bar — fully light */
body.light-mode .top-bar {
  box-shadow: 0 1px 0 var(--border-color), 0 4px 16px rgba(0,0,0,0.06);
}

/* Canvas dot-grid in light mode */
body.light-mode #canvas {
  background-color: #f3f6fb;
  background-image: radial-gradient(circle, rgba(37,99,235,0.12) 1px, transparent 1px);
  background-size: 26px 26px;
}
/* Scan line — subtler in light mode */
body.light-mode #canvas::after {
  background: linear-gradient(90deg, transparent 0%, rgba(37,99,235,0.08) 30%, rgba(37,99,235,0.18) 50%, rgba(37,99,235,0.08) 70%, transparent 100%);
}

/* Chart wrap — no dark tint in light mode */
body.light-mode .chart-wrap {
  background: transparent;
}

/* Alert ticker — light mode stays red, just slightly softer */
body.light-mode #alertTicker {
  background: linear-gradient(90deg,
    rgba(225,29,72,0.18) 0%,
    rgba(225,29,72,0.12) 30%,
    rgba(225,29,72,0.12) 70%,
    rgba(225,29,72,0.18) 100%);
  border-color: rgba(225,29,72,0.35);
}

/* Panel (detail slide-over) — light bg */
body.light-mode .panel {
  background: rgba(255,255,255,0.97);
  border: 1px solid var(--border-color);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
}

/* Sensor sidebar — light bg */
body.light-mode #sensorSidebar {
  background: rgba(255,255,255,0.97);
  border: 1px solid var(--border-color);
}

/* Active nav item — light mode contrast */
body.light-mode .left-nav li.active {
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.22);
  box-shadow: inset 0 0 10px rgba(37,99,235,0.04);
  color: #1d4ed8;
}
body.light-mode .left-nav li.active .nav-icon {
  color: #1d4ed8;
}
body.light-mode .left-nav li.active::before {
  background: #2563eb;
  box-shadow: 0 0 6px rgba(37,99,235,0.4);
}

/* Nav hover in light mode */
body.light-mode .left-nav li:hover {
  background: var(--bg-elevated);
}

/* Table header border */
body.light-mode .alert-table th {
  border-bottom: 1px solid var(--border-color);
}
body.light-mode .alert-table tbody tr:nth-child(even) td {
  background: rgba(37,99,235,0.025);
}

/* Topbar edit button */
body.light-mode .btn-topbar-edit {
  background: var(--bg-elevated);
}

/* Modal shadow lighter */
body.light-mode .modal {
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

/* Logo dot — no glow in light mode */
body.light-mode .logo-text::before {
  box-shadow: none;
  animation: none;
}

/* Alert/sensor status chips look fine with rgba — but sensor border glows too strong */
body.light-mode .sensor.status-ok     { box-shadow: 0 0 6px rgba(5,150,105,0.35); }
body.light-mode .sensor.status-warn   { box-shadow: 0 0 6px rgba(217,119,6,0.35); }
body.light-mode .sensor.status-critical { box-shadow: 0 0 8px rgba(225,29,72,0.4); }

/* =========================================
   TOPBAR — LIVE CLOCK + FACILITY INFO
   ========================================= */
.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.topbar-facility {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.3px;
}
.facility-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--primary);
  background: var(--primary-glow);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 3px;
  padding: 1px 5px;
}
.facility-divider { color: var(--border-color); }
.topbar-clock {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  background: var(--primary-glow);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  min-width: 80px;
  text-align: center;
}

/* =========================================
   CRITICAL ALERT TICKER
   ========================================= */
.alert-ticker {
  height: 32px;
  background: rgba(225, 29, 72, 0.12);
  border-bottom: 1px solid rgba(225, 29, 72, 0.3);
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
  gap: 0;
}
.alert-ticker.hidden { display: none; }
.ticker-label {
  flex-shrink: 0;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent-red);
  padding: 0 16px;
  border-right: 1px solid rgba(225,29,72,0.3);
  height: 100%;
  display: flex;
  align-items: center;
  background: rgba(225,29,72,0.18);
  white-space: nowrap;
}
.ticker-track-wrap {
  flex: 1;
  overflow: hidden;
  height: 100%;
  position: relative;
}
.ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: tickerScroll 30s linear infinite;
  height: 100%;
  position: absolute;
  top: 0;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 28px 0 16px;
  font-size: 12px;
  color: var(--text-main);
  border-right: 1px solid rgba(225,29,72,0.2);
  height: 100%;
}
.ticker-item .ticker-sev {
  font-size: 10px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.ticker-sev.critical { background: rgba(225,29,72,0.2); color: var(--accent-red); }
.ticker-sev.warning  { background: rgba(245,158,11,0.2); color: var(--accent-amber); }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  pointer-events: all;
  animation: toastIn 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.toast.success::before { background: var(--accent-green); }
.toast.error::before   { background: var(--accent-red); }
.toast.warning::before { background: var(--accent-amber); }
.toast.info::before    { background: var(--primary); }
.toast-icon { font-size: 16px; flex-shrink: 0; line-height: 1.4; }
.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}
.toast-msg { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.toast-close:hover { color: var(--text-main); }
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--primary);
  opacity: 0.5;
  animation: toastProgress 4s linear forwards;
}
.toast.success .toast-progress { background: var(--accent-green); }
.toast.error   .toast-progress { background: var(--accent-red); }
.toast.warning .toast-progress { background: var(--accent-amber); }
.toast.fadeout { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to   { opacity: 0; transform: translateX(60px) scale(0.9); max-height: 0; padding: 0; margin: 0; }
}
@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* =========================================
   STYLED CONFIRM DIALOG
   ========================================= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.confirm-overlay.hidden { display: none; }
.confirm-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: slideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.confirm-icon { font-size: 36px; margin-bottom: 14px; line-height: 1; }
.confirm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}
.confirm-message {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 28px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.confirm-btn-cancel {
  flex: 1;
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.confirm-btn-cancel:hover { color: var(--text-main); border-color: var(--text-subtle); }
.confirm-btn-ok {
  flex: 1;
  padding: 10px 20px;
  background: var(--accent-red);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.confirm-btn-ok:hover { opacity: 0.85; }
.confirm-btn-ok.safe { background: var(--primary); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================
   LAST UPDATED TIMESTAMP
   ========================================= */
.table-last-updated {
  font-size: 11px;
  color: var(--text-subtle);
  font-family: 'Space Mono', monospace;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-last-updated::before {
  content: '↺';
  font-size: 12px;
  color: var(--accent-green);
}

/* =========================================
   RBAC UTILITY
   ========================================= */
/* Used by showLoginScreen() / hideLoginScreen() */
.rbac-hidden { display: none !important; }

/* =========================================
   LOGIN OVERLAY
   ========================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;          /* above everything — toast (2000), confirm (3000), etc. */
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;   /* explicit — ensure clicks reach the card */
}
.login-overlay .login-card {
  pointer-events: auto;
  position: relative;
  z-index: 10000;
}
.login-overlay.hidden { display: none !important; }

.login-card {
  width: 400px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 44px 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-logo-text {
  font-family: 'Space Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 5px;
}
.login-logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.login-facility-tag {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: var(--accent-amber);
  border: 1px solid rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.06);
  border-radius: 4px;
  padding: 5px 10px;
  width: fit-content;
  margin-top: -6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-field label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.login-field input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  padding: 11px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-error {
  color: #f87171;
  font-size: 12px;
  background: rgba(244,63,94,0.08);
  border: 1px solid rgba(244,63,94,0.25);
  border-radius: 4px;
  padding: 9px 12px;
}
.login-error.hidden { display: none; }

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.2s, transform 0.1s;
}
.login-btn:hover   { opacity: 0.88; }
.login-btn:active  { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
.login-footer code {
  font-family: 'Space Mono', monospace;
  background: var(--bg-elevated);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--accent-green);
  font-size: 10px;
}

/* Light mode adjustments for login */
body.light-mode .login-card   { background: #fff; border-color: var(--border-color); }
body.light-mode .login-field input { background: #f8fafc; }

/* =========================================
   TOPBAR USER DISPLAY
   ========================================= */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: default;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}
.user-role-badge {
  display: inline-block;
  font-size: 9px;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.user-role-badge.role-admin      { background: rgba(244,63,94,0.15);   color: #f87171; }
.user-role-badge.role-manager    { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.user-role-badge.role-technician { background: rgba(245,158,11,0.15);  color: var(--accent-amber); }
.user-role-badge.role-security   { background: rgba(34,211,165,0.15);  color: var(--accent-green); }
.user-role-badge.role-viewer     { background: rgba(139,92,246,0.15);  color: #a78bfa; }

/* =========================================
   VISUAL ENHANCEMENTS — counters, sparklines,
   gauge, nav badge, row colours, clock
   ========================================= */

/* 1. KPI value row — value + sparkline side by side */
.kpi-value-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.kpi-sparkline {
  width: 80px !important;
  height: 32px !important;
  margin-bottom: 3px;
  opacity: 0.85;
}

/* KPI trend indicator */
.kpi-trend {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  margin-top: 4px;
  letter-spacing: 0.4px;
  opacity: 0.85;
}
.kpi-trend.up   { color: var(--accent-green); }
.kpi-trend.down { color: var(--accent-red); }
.kpi-trend.flat { color: var(--text-muted); }

/* 2. Building Health Gauge card */
.kpi-gauge-card {
  flex: 1.4;
  align-items: center;
}
.kpi-gauge-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 62px;
  margin: 0 auto;
}
.kpi-gauge-wrap canvas {
  width: 110px !important;
  height: 62px !important;
}
.gauge-center-text {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 2px;
  pointer-events: none;
}
.gauge-score {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  color: var(--text-main);
  line-height: 1;
}
.gauge-unit {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
}
.kpi-gauge-card::after {
  background: linear-gradient(90deg, var(--accent-green), #6ee7b7);
}

/* 3. Pulsing nav alert badge */
.nav-alert-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: auto;
  flex-shrink: 0;
  animation: badgePulse 2s ease-in-out infinite;
}
.nav-alert-badge.hidden { display: none !important; }
@keyframes badgePulse {
  0%, 100% { opacity: 1;   transform: scale(1);    box-shadow: 0 0 0 0 rgba(244,63,94,0.6); }
  50%       { opacity: 0.9; transform: scale(1.08); box-shadow: 0 0 0 4px rgba(244,63,94,0); }
}

/* 4. Color-coded table rows */
tr.row-critical { background: rgba(244,63,94,0.07)  !important; }
tr.row-warning  { background: rgba(245,158,11,0.07) !important; }
tr.row-good     { background: rgba(34,211,165,0.04) !important; }
tr.row-critical:hover { background: rgba(244,63,94,0.13)  !important; }
tr.row-warning:hover  { background: rgba(245,158,11,0.13) !important; }
tr.row-good:hover     { background: rgba(34,211,165,0.09) !important; }

/* 5. Topbar clock — make it stand out more */
.topbar-clock {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 1.5px;
  background: rgba(34,211,165,0.08);
  border: 1px solid rgba(34,211,165,0.2);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
}

/* 6. Section entry animation */
@keyframes sectionFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section:not(.hidden) {
  animation: sectionFadeUp 0.25s ease-out forwards;
}

/* =========================================
   SENSORS SECTION
   ========================================= */
.sensor-filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--primary); }
.sensor-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 0 4px;
  flex-shrink: 0;
}
.btn-page {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-page:hover { background: var(--bg-hover); }
.btn-page:disabled { opacity: 0.35; cursor: not-allowed; }
.sensor-type-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─────────────────────────────────────────────
   GLOBAL POLISH ADDITIONS
   ───────────────────────────────────────────── */

/* Stat cards — icon circle + hover */
.alert-stat-card {
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.alert-stat-card:hover { transform: translateY(-2px); }
.alert-stat-card.red:hover    { border-color: rgba(244,63,94,0.35); }
.alert-stat-card.yellow:hover { border-color: rgba(245,158,11,0.35); }
.alert-stat-card.green:hover  { border-color: rgba(34,211,165,0.35); }
.alert-stat-card.blue:hover   { border-color: rgba(59,130,246,0.35); }

.alert-stat-card .stat-icon {
  font-size: 22px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
}
.alert-stat-card.red    .stat-icon { background: rgba(244,63,94,0.1); }
.alert-stat-card.yellow .stat-icon { background: rgba(245,158,11,0.1); }
.alert-stat-card.green  .stat-icon { background: rgba(34,211,165,0.08); }
.alert-stat-card.blue   .stat-icon { background: rgba(59,130,246,0.1); }

/* Table header cleaner underline */
.alert-table thead { border-bottom: 2px solid var(--border-color); }

/* Badge — slight glow on critical */
.badge.critical { box-shadow: 0 0 0 1px rgba(244,63,94,0.25); }

/* KPI card sub-label under value */
.kpi-sub { font-size: 10px; color: var(--text-muted); font-family: 'Space Mono', monospace; margin-top: 2px; }

/* Report/compliance/sustainability table empty placeholder */
.empty-state-row td {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 13px;
}
.empty-state-row td span { display: block; font-size: 28px; margin-bottom: 8px; opacity: 0.4; }

/* Compliance status pill width */
.badge { white-space: nowrap; display: inline-block; }

/* Room card hover */
.room-card {
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}
.room-card:hover {
  border-color: rgba(59,130,246,0.35);
  transform: translateY(-2px);
}

/* Service status card hover */
.service-card { transition: border-color 0.2s, transform 0.2s; }
.service-card:hover { border-color: rgba(59,130,246,0.3); transform: translateY(-1px); }

/* Admin card hover */
.admin-card { transition: border-color 0.2s; }
.admin-card:hover { border-color: rgba(59,130,246,0.2); }

/* Download button for reports */
.btn-download {
  padding: 5px 12px;
  background: rgba(34,211,165,0.1);
  border: 1px solid rgba(34,211,165,0.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--accent-green);
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.btn-download:hover { background: rgba(34,211,165,0.2); }

/* ─────────────────────────────────────────────
   AMBIENT & DEPTH REFINEMENTS
   ───────────────────────────────────────────── */

/* KPI strip — subtle gradient background */
.kpi-strip {
  background: linear-gradient(90deg, rgba(15,21,32,0.8) 0%, rgba(20,28,43,0.6) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
body.light-mode .kpi-strip {
  background: linear-gradient(90deg, #f1f5f9 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border-color);
}

/* Canvas container border glow */
.canvas-container {
  box-shadow: 0 0 0 1px rgba(59,130,246,0.08), inset 0 0 40px rgba(0,0,0,0.5);
}

/* Dashboard row subtle separator */
.dashboard-row {
  gap: 14px;
}

/* Section header refinement */
.admin-header {
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.admin-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

/* Alert ticker — bold red, theme-aware */
#alertTicker {
  background: linear-gradient(90deg,
    rgba(225,29,72,0.32) 0%,
    rgba(225,29,72,0.22) 30%,
    rgba(225,29,72,0.22) 70%,
    rgba(225,29,72,0.32) 100%);
  border-color: rgba(225,29,72,0.45);
  backdrop-filter: blur(8px);
}

/* Chart wrap — subtle inner shadow */
.chart-wrap {
  background: rgba(6,9,15,0.3);
  border-radius: var(--radius-sm);
}

/* Table — slightly more refined header */
.alert-table th {
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Shimmer animation for loading states */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.04) 50%, var(--bg-elevated) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 4px;
}

/* Panel — glass refinement */
.panel {
  background: rgba(15,21,32,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}

/* Sidebar — glass refinement */
#sensorSidebar {
  background: rgba(15,21,32,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.07);
}

/* Nav active item — refined glow */
.left-nav li.active {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  box-shadow: inset 0 0 12px rgba(59,130,246,0.06);
}

/* Service card background */
.service-card {
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
}

/* Room card background */
.room-card {
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Topbar facility tag */
.facility-tag {
  background: rgba(59,130,246,0.12);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  border: 1px solid rgba(59,130,246,0.2);
}

/* Workspace wrapper — subtle vignette */
.workspace-wrapper {
  background: var(--bg-app);
}
