@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Ultra Modern Dark Theme Colors */
  --bg:           #070913;
  --surface:      rgba(15, 23, 42, 0.65);
  --surface2:     rgba(30, 41, 59, 0.7);
  --surface3:     rgba(51, 65, 85, 0.7);
  --border:       rgba(255, 255, 255, 0.08);
  --border2:      rgba(255, 255, 255, 0.15);
  
  /* Brand - Electric Cyan Glow */
  --teal:         #00f2fe;
  --teal-light:   #00f2fe;
  --teal-dark:    #4facfe;
  --teal-pale:    rgba(0, 242, 254, 0.08);
  --teal-glow:    rgba(0, 242, 254, 0.18);
  
  /* IoT Neon Categories */
  --climate:      #00d2ff;  --climate-bg: rgba(0, 210, 255, 0.1);
  --water:        #0a84ff;  --water-bg:   rgba(10, 132, 255, 0.1);
  --energy:       #ff9f0a;  --energy-bg:  rgba(255, 159, 10, 0.1);
  --security:     #bf5af2;  --security-bg:rgba(191, 90, 242, 0.1);
  --garden:       #30d158;  --garden-bg:  rgba(48, 209, 88, 0.1);
  --safety:       #ff453a;  --safety-bg:  rgba(255, 69, 58, 0.1);
  
  /* Semantics */
  --ok:           #30d158;
  --warn:         #ff9f0a;
  --crit:         #ff453a;
  --emergency:    #ff453a;
  --info:         #0a84ff;
  
  /* Text */
  --text:         #f8fafc;
  --text2:        #94a3b8;
  --text3:        #64748b;
  
  /* Fonts */
  --sans:         'Inter', system-ui, sans-serif;
  --mono:         'DM Mono', monospace;
  --display:      'Syne', sans-serif;
  
  /* Radius & Shadows */
  --radius:       16px;
  --radius-sm:    10px;
  --radius-lg:    24px;
  --shadow:       0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-sm:    0 4px 12px rgba(0, 0, 0, 0.25);
  --glow-teal:    0 0 15px rgba(0, 242, 254, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { 
  background: var(--bg); 
  color: var(--text); 
  font-family: var(--sans); 
  font-size: 14px; 
  line-height: 1.5; 
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 80% 20%, rgba(79, 172, 254, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(0, 242, 254, 0.05) 0%, transparent 50%);
}

/* ── Custom Scrollbar ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; position: relative; }

.sidebar { 
  width: 250px; 
  min-width: 250px; 
  background: rgba(10, 15, 30, 0.85); 
  border-right: 1px solid var(--border); 
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  transition: transform 0.3s ease;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.topbar { 
  background: rgba(10, 15, 30, 0.45); 
  border-bottom: 1px solid var(--border); 
  padding: 0 28px; 
  height: 64px; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-logo { 
  padding: 24px 20px; 
  border-bottom: 1px solid var(--border); 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}
.logo-mark { 
  width: 40px; 
  height: 40px; 
  background: linear-gradient(135deg, var(--teal-dark), var(--teal)); 
  border-radius: 12px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-shrink: 0; 
  color: #050b14; 
  box-shadow: var(--glow-teal);
}
.logo-mark svg { width: 22px; height: 22px; stroke: #000; stroke-width: 2.5px; }
.logo-text { 
  font-family: var(--display); 
  font-size: 16px; 
  font-weight: 800; 
  letter-spacing: 0.05em; 
  background: linear-gradient(135deg, #fff 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1; 
}
.logo-sub { 
  font-size: 9px; 
  color: var(--teal); 
  font-family: var(--mono); 
  letter-spacing: 0.15em; 
  text-transform: uppercase; 
  margin-top: 2px;
}

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav::-webkit-scrollbar { display: none; }
.nav-section { 
  font-family: var(--mono); 
  font-size: 9px; 
  letter-spacing: 0.15em; 
  color: var(--text3); 
  text-transform: uppercase; 
  padding: 16px 12px 6px; 
}
.nav-item { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  padding: 10px 14px; 
  border-radius: var(--radius-sm); 
  color: var(--text2); 
  cursor: pointer; 
  font-size: 13.5px; 
  font-weight: 500; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
  text-decoration: none; 
  position: relative; 
}
.nav-item:hover { 
  background: rgba(255, 255, 255, 0.03); 
  color: var(--text); 
  padding-left: 18px;
}
.nav-item.active { 
  background: var(--teal-pale); 
  color: var(--teal); 
  font-weight: 600;
  box-shadow: inset 0 0 12px rgba(0, 242, 254, 0.05);
}
.nav-item.active::before { 
  content: ''; 
  position: absolute; 
  left: 0; 
  top: 6px; 
  bottom: 6px; 
  width: 4px; 
  background: var(--teal); 
  border-radius: 0 4px 4px 0; 
  box-shadow: 0 0 10px var(--teal);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform 0.2s; }
.nav-item:hover svg { transform: scale(1.05); }
.nav-item .nav-badge { margin-left: auto; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); background: rgba(0, 0, 0, 0.15); }
.user-pill { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 10px; 
  border-radius: var(--radius-sm); 
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}
.user-avatar { 
  width: 34px; 
  height: 34px; 
  border-radius: 50%; 
  background: linear-gradient(135deg, var(--teal-dark), var(--teal)); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: 800; 
  font-size: 13px; 
  color: #000; 
  flex-shrink: 0; 
  font-family: var(--display); 
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}
.user-info { min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.user-role { font-size: 9px; color: var(--text2); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 20px; 
  position: relative; 
  overflow: hidden; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
}
.stat-card:hover { 
  border-color: rgba(255, 255, 255, 0.15); 
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}
.stat-card::after { 
  content: ''; 
  position: absolute; 
  top: 0; 
  left: 0; 
  right: 0; 
  height: 3px; 
  background: linear-gradient(90deg, var(--c, var(--teal)), transparent); 
}
.stat-icon { 
  position: absolute; 
  top: 20px; 
  right: 20px; 
  width: 36px; 
  height: 36px; 
  border-radius: 10px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: rgba(255, 255, 255, 0.02); 
  border: 1px solid var(--border);
  color: var(--c, var(--teal)); 
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-label { font-family: var(--mono); font-size: 9.5px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 10px; }
.stat-value { font-family: var(--display); font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-sub   { font-size: 11px; color: var(--text3); }

/* ── Category cards (overview) ───────────────────────────────────────────── */
.cat-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 28px; }
.cat-card { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  overflow: hidden; 
  cursor: pointer; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
}
.cat-card:hover { 
  border-color: var(--c, var(--border2)); 
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}
.cat-hdr { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.01); }
.cat-icon-wrap { 
  width: 36px; 
  height: 36px; 
  border-radius: 10px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: var(--cat-bg, rgba(0, 242, 254, 0.1)); 
  color: var(--c, var(--teal)); 
  flex-shrink: 0; 
  box-shadow: inset 0 0 8px var(--cat-bg);
}
.cat-icon-wrap svg { width: 18px; height: 18px; }
.cat-hdr-title { font-family: var(--display); font-size: 14px; font-weight: 700; flex: 1; color: var(--text); }
.cat-hdr-count { font-family: var(--mono); font-size: 11px; color: var(--text2); background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 10px; }
.cat-bdy { padding: 14px 20px; }
.cat-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.cat-row:last-child { border-bottom: none; }
.cat-row-label { font-size: 12px; color: var(--text2); }
.cat-row-val { font-size: 12.5px; font-weight: 600; font-family: var(--mono); color: var(--text); }
.cat-row-val.warn { color: var(--warn); text-shadow: 0 0 8px rgba(255, 159, 10, 0.2); }
.cat-row-val.crit { color: var(--crit); text-shadow: 0 0 8px rgba(255, 69, 58, 0.2); }
.cat-row-val.ok   { color: var(--ok); text-shadow: 0 0 8px rgba(48, 209, 88, 0.2); }

/* ── Device cards ─────────────────────────────────────────────────────────── */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.device-card { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 20px; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); 
  border-left: 4px solid var(--cat-color, var(--border)); 
  box-shadow: var(--shadow-sm);
}
.device-card:hover { 
  border-color: rgba(255,255,255,0.15); 
  border-left-color: var(--cat-color, var(--teal));
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.3);
}
.device-card.offline { opacity: 0.45; }
.device-card.offline:hover { opacity: 0.75; }
.device-header { display: flex; align-items: start; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.device-name  { font-weight: 700; font-size: 14px; margin-bottom: 4px; line-height: 1.3; color: var(--text); }
.device-room  { font-size: 11px; color: var(--text2); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em; }
.device-badge { 
  padding: 3px 10px; 
  border-radius: 20px; 
  font-size: 9px; 
  font-family: var(--mono); 
  font-weight: 700; 
  letter-spacing: 0.06em; 
  flex-shrink: 0; 
  text-transform: uppercase;
}
.online   { background: rgba(48, 209, 88, 0.12); color: var(--ok); border: 1px solid rgba(48, 209, 88, 0.25); box-shadow: 0 0 8px rgba(48, 209, 88, 0.1); }
.offline-b{ background: rgba(255, 69, 58, 0.08); color: var(--crit); border: 1px solid rgba(255, 69, 58, 0.25); }

.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.metric { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.metric-label { font-family: var(--mono); font-size: 8.5px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.metric-value { font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--text); }
.metric-value.warn { color: var(--warn); }
.metric-value.crit { color: var(--crit); }
.metric-value.ok   { color: var(--ok); }

.device-footer { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding-top: 12px; 
  border-top: 1px solid rgba(255,255,255,0.04); 
  font-size: 11px; 
  color: var(--text3); 
  font-family: var(--mono); 
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  padding: 10px 18px; 
  border-radius: var(--radius-sm); 
  border: 1px solid transparent; 
  cursor: pointer; 
  font-family: var(--sans); 
  font-size: 13px; 
  font-weight: 600; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
  text-decoration: none; 
  outline: none; 
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { 
  background: linear-gradient(135deg, var(--teal-dark), var(--teal)); 
  color: #050b14; 
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.25);
}
.btn-primary:hover { 
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}
.btn-ghost { 
  background: rgba(255,255,255,0.02); 
  color: var(--text2); 
  border: 1px solid var(--border); 
}
.btn-ghost:hover { 
  border-color: rgba(255,255,255,0.18); 
  color: var(--text); 
  background: rgba(255,255,255,0.05);
}
.btn-danger { 
  background: rgba(255, 69, 58, 0.1); 
  color: var(--crit); 
  border: 1px solid rgba(255, 69, 58, 0.2); 
}
.btn-danger:hover { 
  background: var(--crit); 
  color: #fff; 
  box-shadow: 0 4px 12px rgba(255, 69, 58, 0.3);
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { 
  display: block; 
  font-size: 10px; 
  font-weight: 600; 
  color: var(--text2); 
  margin-bottom: 6px; 
  text-transform: uppercase; 
  letter-spacing: 0.1em; 
  font-family: var(--mono); 
}
.form-input, .form-select { 
  width: 100%; 
  background: rgba(15, 23, 42, 0.4); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm); 
  padding: 10px 14px; 
  color: var(--text); 
  font-family: var(--sans); 
  font-size: 13.5px; 
  outline: none; 
  transition: all 0.2s; 
}
.form-input:focus, .form-select:focus { 
  border-color: var(--teal); 
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.15), inset 0 0 8px rgba(0, 242, 254, 0.05); 
  background: rgba(15, 23, 42, 0.6);
}
.form-select option { background: #0f172a; color: var(--text); }
.form-input::placeholder { color: var(--text3); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { 
  background: rgba(255,255,255,0.01); 
  padding: 14px 18px; 
  font-family: var(--mono); 
  font-size: 9.5px; 
  text-transform: uppercase; 
  letter-spacing: 0.12em; 
  color: var(--text2); 
  border-bottom: 1px solid var(--border); 
  white-space: nowrap; 
}
td { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0, 242, 254, 0.02); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert-item { 
  display: flex; 
  align-items: start; 
  gap: 12px; 
  padding: 14px 18px; 
  border-radius: var(--radius-sm); 
  margin-bottom: 10px; 
  border-left: 4px solid; 
  border-top: 1px solid rgba(255,255,255,0.02);
  border-right: 1px solid rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.alert-item svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-emergency { background: rgba(255, 69, 58, 0.07); border-color: var(--emergency); box-shadow: 0 4px 15px rgba(255, 69, 58, 0.05); }
.alert-critical  { background: rgba(255, 69, 58, 0.05); border-color: var(--crit); }
.alert-warning   { background: rgba(255, 159, 10, 0.05); border-color: var(--warn); }
.alert-info      { background: rgba(10, 132, 255, 0.05); border-color: var(--info); }
.alert-msg  { font-size: 13px; flex: 1; line-height: 1.5; color: var(--text); }
.alert-time { font-size: 11px; color: var(--text3); margin-top: 4px; font-family: var(--mono); }

/* ── AI ──────────────────────────────────────────────────────────────────── */
.ai-box { 
  background: linear-gradient(135deg, rgba(191, 90, 242, 0.07), rgba(0, 242, 254, 0.03)); 
  border: 1px solid rgba(191, 90, 242, 0.2); 
  border-radius: var(--radius); 
  padding: 20px; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(191, 90, 242, 0.05);
}
.ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ai-badge { 
  background: rgba(191, 90, 242, 0.15); 
  color: #d8b4fe; 
  border: 1px solid rgba(191, 90, 242, 0.3); 
  padding: 4px 12px; 
  border-radius: 20px; 
  font-family: var(--mono); 
  font-size: 9.5px; 
  font-weight: 600;
  letter-spacing: 0.08em; 
}
.ai-text { font-size: 13.5px; line-height: 1.75; color: #f1f5f9; }
.ai-provider { font-family: var(--mono); font-size: 10px; color: var(--text3); margin-top: 10px; }

.ai-chat-wrap { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  border-radius: var(--radius); 
  padding: 20px; 
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.chat-messages { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding-right: 6px; }
.chat-bubble { padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; line-height: 1.6; max-width: 85%; }
.chat-user { 
  background: rgba(0, 242, 254, 0.06); 
  border: 1px solid rgba(0, 242, 254, 0.2); 
  color: var(--text);
  align-self: flex-end; 
  border-bottom-right-radius: 4px;
}
.chat-ai { 
  background: rgba(255, 255, 255, 0.02); 
  border: 1px solid var(--border); 
  color: var(--text);
  align-self: flex-start; 
  border-bottom-left-radius: 4px;
}
.chat-row { display: flex; gap: 10px; }
.chat-input { 
  flex: 1; 
  background: rgba(15, 23, 42, 0.4); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm); 
  padding: 10px 14px; 
  color: var(--text); 
  font-family: var(--sans); 
  font-size: 13.5px; 
  outline: none; 
  transition: all 0.2s; 
}
.chat-input:focus { border-color: var(--teal); background: rgba(15, 23, 42, 0.6); }

.provider-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.prov-btn { 
  padding: 6px 14px; 
  border-radius: 20px; 
  border: 1px solid var(--border); 
  background: transparent; 
  color: var(--text2); 
  font-family: var(--mono); 
  font-size: 10px; 
  cursor: pointer; 
  transition: all 0.2s; 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
}
.prov-btn svg { width: 12px; height: 12px; }
.prov-btn:hover { border-color: rgba(255,255,255,0.18); color: var(--text); }
.prov-btn.active { border-color: var(--teal); color: var(--teal); background: var(--teal-pale); box-shadow: 0 0 10px rgba(0, 242, 254, 0.1); }

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 10px; font-family: var(--mono); font-weight: 600; text-transform: uppercase; }
.tag svg { width: 12px; height: 12px; }
.tag-teal   { background: rgba(0, 242, 254, 0.1); color: var(--teal); border: 1px solid rgba(0, 242, 254, 0.25); }
.tag-blue   { background: rgba(10, 132, 255, 0.1); color: var(--info); border: 1px solid rgba(10, 132, 255, 0.2); }
.tag-orange { background: rgba(255, 159, 10, 0.1); color: var(--warn); border: 1px solid rgba(255, 159, 10, 0.2); }
.tag-red    { background: rgba(255, 69, 58, 0.1); color: var(--crit); border: 1px solid rgba(255, 69, 58, 0.2); }
.tag-grey   { background: rgba(255, 255, 255, 0.05); color: var(--text2); border: 1px solid var(--border); }
.tag-green  { background: rgba(48, 209, 88, 0.1); color: var(--ok); border: 1px solid rgba(48, 209, 88, 0.2); }
.tag-purple { background: rgba(191, 90, 242, 0.1); color: #d8b4fe; border: 1px solid rgba(191, 90, 242, 0.2); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(3, 5, 11, 0.8); 
  backdrop-filter: blur(8px); 
  -webkit-backdrop-filter: blur(8px);
  z-index: 100; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  opacity: 0; 
  pointer-events: none; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { 
  background: rgba(15, 23, 42, 0.9); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  width: 90%; 
  max-width: 480px; 
  max-height: 90vh; 
  overflow-y: auto; 
  padding: 28px; 
  transform: scale(0.9) translateY(20px); 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  box-shadow: 0 24px 50px rgba(0,0,0,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title  { font-family: var(--display); font-size: 18px; font-weight: 800; color: var(--text); }

/* ── Emergency banner ────────────────────────────────────────────────────── */
.emergency-banner { 
  background: rgba(255, 69, 58, 0.1); 
  border: 1px solid rgba(255, 69, 58, 0.3); 
  border-radius: var(--radius-sm); 
  padding: 14px 18px; 
  margin-bottom: 16px; 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 13.5px; 
  color: var(--emergency); 
  box-shadow: 0 4px 15px rgba(255, 69, 58, 0.1);
}
.emergency-banner svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Usage bar ───────────────────────────────────────────────────────────── */
.usage-bar { height: 6px; background: rgba(255, 255, 255, 0.05); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* ── Live indicator ──────────────────────────────────────────────────────── */
.dot-live { 
  width: 8px; 
  height: 8px; 
  border-radius: 50%; 
  background: var(--ok); 
  animation: pulse 2s infinite; 
  display: inline-block; 
  flex-shrink: 0; 
  box-shadow: 0 0 8px var(--ok);
}
@keyframes pulse { 
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 0 6px rgba(48, 209, 88, 0); }
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast { 
  position: fixed; 
  bottom: 28px; 
  right: 28px; 
  background: rgba(15, 23, 42, 0.9); 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm); 
  padding: 12px 20px; 
  font-size: 13.5px; 
  z-index: 200; 
  box-shadow: var(--shadow); 
  transform: translateY(100px); 
  opacity: 0; 
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
  pointer-events: none; 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.toast svg { width: 16px; height: 16px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--ok); color: var(--ok); box-shadow: 0 8px 24px rgba(48, 209, 88, 0.15); }
.toast.error   { border-color: var(--crit); color: var(--crit); box-shadow: 0 8px 24px rgba(255, 69, 58, 0.15); }

/* ── Section ─────────────────────────────────────────────────────────────── */
.section-title { font-family: var(--display); font-size: 16px; font-weight: 800; margin-top: 12px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.section-title svg { width: 20px; height: 20px; color: var(--teal); }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text2); }
.empty-icon { display: flex; justify-content: center; margin-bottom: 16px; color: var(--text3); }
.empty-icon svg { width: 44px; height: 44px; }

/* ── Lucide icon base ─────────────────────────────────────────────────────── */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Mobile Responsive Overrides ─────────────────────────────────────────── */
.hamburger { 
  display: none; 
  background: transparent; 
  border: none; 
  color: var(--text); 
  cursor: pointer; 
  padding: 8px; 
  margin-right: 12px;
}
.hamburger svg { width: 22px; height: 22px; }

.sidebar-overlay { 
  display: none; 
  position: fixed; 
  inset: 0; 
  background: rgba(0, 0, 0, 0.6); 
  z-index: 8; 
  backdrop-filter: blur(4px); 
}

@media (max-width: 850px) {
  .hamburger { display: block; }
  .sidebar { 
    position: fixed; 
    left: 0; 
    top: 0; 
    bottom: 0; 
    transform: translateX(-100%); 
    z-index: 15;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .nav-item:hover { padding-left: 14px; } /* Disable shifting hover effect on mobile tap */
}

/* ── Misc utils ──────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.flex { display: flex; } .flex-1 { flex: 1; } .items-center { align-items: center; } .items-start { align-items: flex-start; }
.gap-1{gap: 4px}.gap-2{gap: 8px}.gap-3{gap: 12px}.gap-4{gap: 16px}
.mb-1{margin-bottom: 4px}.mb-2{margin-bottom: 8px}.mb-3{margin-bottom: 12px}.mb-4{margin-bottom: 16px}.mb-6{margin-bottom: 24px}
.mt-2{margin-top: 8px}.mt-3{margin-top: 12px}
.text-xs{font-size: 11px}.text-sm{font-size: 12px}.text-base{font-size: 14px}
.text-muted{color: var(--text2)}.text-dim{color: var(--text3)}
.fw-500{font-weight: 500}.fw-600{font-weight: 600}.fw-700{font-weight: 700}
.font-mono{font-family: var(--mono)}
.text-ok{color: var(--ok)}.text-warn{color: var(--warn)}.text-crit{color: var(--crit)}.text-teal{color: var(--teal-light)}
.truncate{white-space: nowrap; overflow: hidden; text-overflow: ellipsis}
.w-full{width: 100%}

@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 12px; }
  .stat-grid { grid-template-columns: 1fr; }
  .cat-strip { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: 1fr; }
}
