/* ====================================================================
   eero Custom Dashboard - Windows 11 Fluent Design System
   Dual Theme Engine (Dark & Light Mode) with Acrylic & Mica Materials
   ==================================================================== */

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

/* ====================================================================
   1. DESIGN TOKENS (LIGHT MODE DEFAULT)
   ==================================================================== */
:root {
  --font-sans: 'Segoe UI Variable', 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
  
  /* Windows 11 Light Materials & Palette */
  --bg-canvas: #f3f3f3;
  --bg-surface: #ffffff;
  --bg-acrylic: rgba(255, 255, 255, 0.85);
  --bg-card: rgba(255, 255, 255, 0.90);
  --bg-elevated: #ffffff;
  --bg-subtle: rgba(0, 0, 0, 0.03);
  --bg-hover: rgba(0, 0, 0, 0.05);

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-card: rgba(0, 0, 0, 0.08);
  --border-divider: rgba(0, 0, 0, 0.06);

  --text-primary: #1c1c1c;
  --text-secondary: #5c5c5c;
  --text-tertiary: #767676;
  --text-muted: #8c8c8c;

  /* Windows 11 Accent Blue */
  --win-accent: #0067c0;
  --win-accent-hover: #1975c5;
  --win-accent-active: #005a9e;
  --win-accent-subtle: rgba(0, 103, 192, 0.08);
  --win-accent-border: rgba(0, 103, 192, 0.25);
  --win-accent-text: #0067c0;

  /* Status Colors (Light Fluent) */
  --accent-cyan: #0067c0;
  --accent-indigo: #5c2d91;
  --accent-emerald: #0f7b0f;
  --accent-amber: #9d5d00;
  --accent-rose: #c42b1c;

  /* Shadows */
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);
  --card-shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --popover-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);

  /* Inputs */
  --input-bg: rgba(255, 255, 255, 0.95);
  --input-border: rgba(0, 0, 0, 0.15);
  --input-text: #1c1c1c;
  --input-placeholder: #8c8c8c;

  /* Glass/Card legacy aliases */
  --bg-primary: var(--bg-canvas);
  --glass-bg: var(--bg-card);
  --glass-border: var(--border-card);
}

/* ====================================================================
   2. DESIGN TOKENS (DARK MODE FLUENT)
   ==================================================================== */
html.dark {
  /* Windows 11 Dark Materials & Palette */
  --bg-canvas: #202020;
  --bg-surface: #2b2b2b;
  --bg-acrylic: rgba(43, 43, 43, 0.85);
  --bg-card: rgba(43, 43, 43, 0.90);
  --bg-elevated: #323232;
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --bg-hover: rgba(255, 255, 255, 0.07);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-divider: rgba(255, 255, 255, 0.06);

  --text-primary: #ffffff;
  --text-secondary: #d1d1d1;
  --text-tertiary: #9e9e9e;
  --text-muted: #767676;

  /* Windows 11 Dark Accent Blue */
  --win-accent: #60cdff;
  --win-accent-hover: #72d4ff;
  --win-accent-active: #4cc2ff;
  --win-accent-subtle: rgba(96, 205, 255, 0.12);
  --win-accent-border: rgba(96, 205, 255, 0.3);
  --win-accent-text: #60cdff;

  /* Status Colors (Dark Fluent) */
  --accent-cyan: #60cdff;
  --accent-indigo: #a78bfa;
  --accent-emerald: #6ccb5f;
  --accent-amber: #fce100;
  --accent-rose: #ff99a4;

  /* Shadows */
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
  --card-shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.25);
  --popover-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Inputs */
  --input-bg: rgba(32, 32, 32, 0.85);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-text: #ffffff;
  --input-placeholder: #767676;

  /* Glass/Card legacy aliases */
  --bg-primary: var(--bg-canvas);
  --glass-bg: var(--bg-card);
  --glass-border: var(--border-card);
}

/* ====================================================================
   3. BASE STYLING
   ==================================================================== */
body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
  letter-spacing: -0.01em;
}

/* Windows 11 Fluent Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 140, 0.3);
  border-radius: 9999px;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 140, 140, 0.6);
}
html.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ====================================================================
   4. FLUENT CARD & MATERIAL CLASSES
   ==================================================================== */
.fluent-card,
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.fluent-elevated,
.glass-panel-elevated {
  background: var(--bg-elevated);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-card);
  box-shadow: var(--card-shadow-elevated);
  border-radius: 12px;
}

/* Windows 11 Fluent Inputs */
.fluent-input,
.glass-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-text);
  border-radius: 6px;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.fluent-input::placeholder,
.glass-input::placeholder {
  color: var(--input-placeholder);
}

.fluent-input:focus,
.glass-input:focus {
  border-color: var(--win-accent);
  box-shadow: 0 0 0 2px var(--win-accent-subtle);
  outline: none;
}

/* Card hover glow / lift (Windows 11 Subtle) */
.hover-glow:hover {
  border-color: var(--win-accent-border);
  box-shadow: var(--card-shadow-elevated);
  transform: translateY(-1px);
}

/* ====================================================================
   5. NAVIGATION SEGMENTED TABS (WINDOWS 11 STYLE)
   ==================================================================== */
.win11-tab-btn {
  position: relative;
  transition: all 0.15s ease;
}
.win11-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 25%;
  right: 25%;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background-color: var(--win-accent);
  box-shadow: 0 0 8px var(--win-accent);
}

/* ====================================================================
   6. PULSES & INDICATORS
   ==================================================================== */
.status-dot-pulse {
  position: relative;
}
.status-dot-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 9999px;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* Signal Bars */
.rssi-bar {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.rssi-bar span {
  width: 3px;
  background-color: var(--border-divider);
  border-radius: 1px;
  transition: height 0.3s ease, background-color 0.3s ease;
}

/* Speed Gauge Radial Animation */
.gauge-svg {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.gauge-circle-bg {
  stroke: var(--border-subtle);
}
.gauge-circle-progress {
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-in-out;
}

/* ====================================================================
   7. ANIMATIONS
   ==================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ====================================================================
   8. MANUAL CONTENT & MARKDOWN (ADAPTIVE LIGHT & DARK)
   ==================================================================== */
.manual-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--win-accent);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.manual-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-indigo);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
.manual-content p {
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1rem;
}
.manual-content ul, .manual-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.manual-content li {
  margin-bottom: 0.4rem;
}
.manual-content strong {
  color: var(--text-primary);
}
.manual-content code {
  font-family: var(--font-mono);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--win-accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

/* ====================================================================
   9. ADAPTIVE LIGHT MODE CONTRAST & TYPOGRAPHY (WINDOWS 11 FLUENT)
   ==================================================================== */
html:not(.dark) {
  color-scheme: light;
}
html.dark {
  color-scheme: dark;
}

html:not(.dark) h1,
html:not(.dark) h2,
html:not(.dark) h3,
html:not(.dark) h4 {
  color: #0f172a;
}

/* Headings and primary text inside glass panels and cards in light mode (excluding buttons & colored chips) */
html:not(.dark) h1.text-white,
html:not(.dark) h2.text-white,
html:not(.dark) h3.text-white,
html:not(.dark) h4.text-white,
html:not(.dark) .glass-panel > div > h1,
html:not(.dark) .glass-panel > div > h2,
html:not(.dark) .glass-panel > div > h3,
html:not(.dark) .glass-panel-elevated h2.text-white,
html:not(.dark) .glass-panel-elevated h3.text-white,
html:not(.dark) p.text-white,
html:not(.dark) span.text-white:not([class*="bg-"]):not(button *),
html:not(.dark) div.text-white:not([class*="bg-"]):not(button *) {
  color: #0f172a;
}

/* High-Contrast Typography Overrides for Light Mode */
html:not(.dark) .text-slate-400 {
  color: #334155 !important; /* Slate 700: high contrast readable label text (9.5:1 ratio) */
}
html:not(.dark) .text-slate-300 {
  color: #1e293b !important; /* Slate 800: crisp body text (13:1 ratio) */
}
html:not(.dark) .text-slate-200 {
  color: #0f172a !important; /* Slate 900: sharp legible primary values/IPs */
}
html:not(.dark) .text-slate-100 {
  color: #0f172a !important;
}
html:not(.dark) .text-slate-500 {
  color: #475569 !important; /* Slate 600: legible secondary text */
}

/* Windows 11 Fluent Light Buttons (replaces dark slate blocks with elegant light buttons) */
html:not(.dark) button.bg-slate-800,
html:not(.dark) button.bg-slate-900,
html:not(.dark) .btn-slate {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
html:not(.dark) button.bg-slate-800:hover,
html:not(.dark) button.bg-slate-900:hover {
  background-color: #f8fafc !important;
  color: #0067c0 !important;
  border-color: #94a3b8 !important;
}

/* Light mode hover for restart/danger action buttons */
html:not(.dark) button.hover\:bg-rose-950\/40:hover {
  background-color: #fef2f2 !important;
  color: #e11d48 !important;
  border-color: #fca5a5 !important;
}

/* Restart Network Button in Light Mode */
html:not(.dark) .bg-rose-600\/20 {
  background-color: #fff1f2 !important;
  color: #be123c !important;
  border-color: #fecdd3 !important;
}
html:not(.dark) .bg-rose-600\/20:hover {
  background-color: #ffe4e6 !important;
  color: #9f1239 !important;
}

/* Test Notification Button & Soft Accent Badges */
html:not(.dark) .bg-indigo-500\/20 {
  background-color: #eef2ff !important;
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}
html:not(.dark) .bg-indigo-500\/20:hover {
  background-color: #e0e7ff !important;
  color: #3730a3 !important;
}
html:not(.dark) .bg-sky-500\/10,
html:not(.dark) .bg-sky-500\/20 {
  background-color: #f0f9ff !important;
  color: #0284c7 !important;
  border-color: #bae6fd !important;
}
html:not(.dark) .bg-emerald-500\/20 {
  background-color: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}
html:not(.dark) .bg-amber-500\/15,
html:not(.dark) .bg-amber-500\/20 {
  background-color: #fffbeb !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}
html:not(.dark) .bg-purple-500\/20 {
  background-color: #faf5ff !important;
  color: #7e22ce !important;
  border-color: #e9d5ff !important;
}

/* Inner Panels & Dark Metric Boxes in Light Mode */
html:not(.dark) .bg-slate-900\/95,
html:not(.dark) .bg-slate-900\/90,
html:not(.dark) .bg-slate-900\/80,
html:not(.dark) .bg-slate-900\/60,
html:not(.dark) .bg-slate-900\/40,
html:not(.dark) .bg-slate-800\/90,
html:not(.dark) .bg-slate-800\/80,
html:not(.dark) .bg-slate-800\/60 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* High-Contrast Typography Overrides for Light Mode */
html:not(.dark) .text-slate-400 {
  color: #334155 !important; /* Slate 700: high contrast readable label text (9.5:1 ratio) */
}
html:not(.dark) .text-slate-300 {
  color: #1e293b !important; /* Slate 800: crisp body text (13:1 ratio) */
}
html:not(.dark) .text-slate-200 {
  color: #0f172a !important; /* Slate 900: sharp legible primary values/IPs */
}
html:not(.dark) .text-slate-100 {
  color: #0f172a !important;
}
html:not(.dark) .text-slate-500 {
  color: #475569 !important; /* Slate 600: legible secondary text */
}

/* Windows 11 Fluent Light Buttons (replaces dark slate blocks with elegant light buttons) */
html:not(.dark) button.bg-slate-800,
html:not(.dark) button.bg-slate-900,
html:not(.dark) .btn-slate {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
html:not(.dark) button.bg-slate-800:hover,
html:not(.dark) button.bg-slate-900:hover {
  background-color: #f8fafc !important;
  color: #0067c0 !important;
  border-color: #94a3b8 !important;
}

/* Light mode hover for restart/danger action buttons */
html:not(.dark) button.hover\:bg-rose-950\/40:hover {
  background-color: #fef2f2 !important;
  color: #e11d48 !important;
  border-color: #fca5a5 !important;
}

/* Restart Network Button in Light Mode */
html:not(.dark) .bg-rose-600\/20 {
  background-color: #fff1f2 !important;
  color: #be123c !important;
  border-color: #fecdd3 !important;
}
html:not(.dark) .bg-rose-600\/20:hover {
  background-color: #ffe4e6 !important;
  color: #9f1239 !important;
}

/* Test Notification Button & Soft Accent Badges */
html:not(.dark) .bg-indigo-500\/20 {
  background-color: #eef2ff !important;
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}
html:not(.dark) .bg-indigo-500\/20:hover {
  background-color: #e0e7ff !important;
  color: #3730a3 !important;
}
html:not(.dark) .bg-sky-500\/10,
html:not(.dark) .bg-sky-500\/20 {
  background-color: #f0f9ff !important;
  color: #0284c7 !important;
  border-color: #bae6fd !important;
}
html:not(.dark) .bg-emerald-500\/20 {
  background-color: #f0fdf4 !important;
  color: #15803d !important;
  border-color: #bbf7d0 !important;
}
html:not(.dark) .bg-amber-500\/15,
html:not(.dark) .bg-amber-500\/20 {
  background-color: #fffbeb !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}
html:not(.dark) .bg-purple-500\/20 {
  background-color: #faf5ff !important;
  color: #7e22ce !important;
  border-color: #e9d5ff !important;
}

/* Inner Panels & Dark Metric Boxes in Light Mode */
html:not(.dark) .bg-slate-900\/95,
html:not(.dark) .bg-slate-900\/90,
html:not(.dark) .bg-slate-900\/80,
html:not(.dark) .bg-slate-900\/60,
html:not(.dark) .bg-slate-900\/40,
html:not(.dark) .bg-slate-800\/90,
html:not(.dark) .bg-slate-800\/80,
html:not(.dark) .bg-slate-800\/60 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

/* Sticky Table Header in Light Mode (removes harsh black header bar) */
html:not(.dark) table thead,
html:not(.dark) table thead tr,
html:not(.dark) table thead th {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}
html:not(.dark) table thead th:hover {
  color: #0f172a !important;
}

/* Table Row and Borders in Light Mode */
html:not(.dark) tbody tr:hover,
html:not(.dark) tr.hover\:bg-slate-800\/30:hover {
  background-color: rgba(0, 103, 192, 0.04) !important;
}
html:not(.dark) .border-slate-800,
html:not(.dark) .border-slate-800\/80,
html:not(.dark) .border-slate-800\/60,
html:not(.dark) .border-slate-700,
html:not(.dark) .border-slate-700\/80,
html:not(.dark) .border-slate-700\/60,
html:not(.dark) .divide-slate-800\/60 > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}

/* Inputs, Selects & Forms in Light Mode */
html:not(.dark) .glass-input,
html:not(.dark) select,
html:not(.dark) input:not([type="checkbox"]):not([type="radio"]) {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
html:not(.dark) input::placeholder,
html:not(.dark) .glass-input::placeholder {
  color: #64748b !important;
}
html:not(.dark) input[type="checkbox"] {
  background-color: #ffffff !important;
  border-color: #94a3b8 !important;
}

/* Docker Maintenance Card in Light Mode */
html:not(.dark) .from-slate-900\/90.to-amber-950\/20 {
  background: linear-gradient(to right, #fffdf8, #fffbeb) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}

/* Preserve bright white text for solid badges and action buttons */
html:not(.dark) button.bg-rose-500,
html:not(.dark) button.bg-rose-600,
html:not(.dark) button.bg-sky-500,
html:not(.dark) button.bg-sky-600,
html:not(.dark) button.bg-indigo-600,
html:not(.dark) button.bg-emerald-600,
html:not(.dark) button[class*="bg-gradient-"],
html:not(.dark) button[class*="from-"],
html:not(.dark) button[class*="bg-gradient-"] *,
html:not(.dark) button[class*="from-"] *,
html:not(.dark) .bg-rose-500 .text-white,
html:not(.dark) .bg-rose-600 .text-white,
html:not(.dark) .bg-sky-500 .text-white,
html:not(.dark) .bg-sky-600 .text-white,
html:not(.dark) .bg-indigo-600 .text-white,
html:not(.dark) .bg-emerald-600 .text-white,
html:not(.dark) [class*="bg-gradient-"] .text-white,
html:not(.dark) .btn-primary,
html:not(.dark) .btn-accent,
html:not(.dark) .btn-primary *,
html:not(.dark) .btn-accent * {
  color: #ffffff !important;
}

/* Header Pills Contrast (Version & About) */
html:not(.dark) .header-pill-version {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
}
html:not(.dark) .header-pill-version:hover {
  background-color: #bae6fd !important;
  color: #075985 !important;
  border-color: #38bdf8 !important;
}
html:not(.dark) .header-pill-version * {
  color: #0369a1 !important;
}
html:not(.dark) .header-pill-about {
  background-color: #ede9fe !important;
  color: #5b21b6 !important;
  border: 1px solid #c4b5fd !important;
}
html:not(.dark) .header-pill-about:hover {
  background-color: #ddd6fe !important;
  color: #4c1d95 !important;
  border-color: #a78bfa !important;
}
html:not(.dark) .header-pill-about * {
  color: #5b21b6 !important;
}

/* ====================================================================
   15. SIDEBAR & LAYOUT UTILITIES
   ==================================================================== */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Sidebar Sizing & Transitions */
aside.sidebar-container {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

aside.sidebar-expanded {
  width: 256px !important;
  min-width: 256px !important;
  max-width: 256px !important;
}

aside.sidebar-collapsed {
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
}

.sidebar-nav-group {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}

/* Sidebar Buttons & Centering */
.sidebar-btn {
  display: flex !important;
  align-items: center !important;
  border-radius: 0.75rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
  transition: all 0.15s ease-in-out !important;
  cursor: pointer !important;
  position: relative !important;
}

.sidebar-btn-expanded {
  width: 100% !important;
  padding: 0.625rem 0.875rem !important;
  justify-content: flex-start !important;
}

.sidebar-btn-collapsed {
  width: 44px !important;
  height: 44px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0.75rem !important;
  position: relative !important;
}

.sidebar-btn-active {
  background-color: rgba(0, 103, 192, 0.12) !important;
  color: #0067c0 !important;
  border-color: rgba(0, 103, 192, 0.35) !important;
  box-shadow: 0 1px 3px rgba(0, 103, 192, 0.12) !important;
}

html.dark .sidebar-btn-active {
  background-color: rgba(56, 189, 248, 0.18) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
}

.sidebar-btn-inactive {
  color: #475569 !important;
  border-color: transparent !important;
  background-color: transparent !important;
}

.sidebar-btn-inactive:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  color: #0f172a !important;
}

html.dark .sidebar-btn-inactive {
  color: #94a3b8 !important;
}

html.dark .sidebar-btn-inactive:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #f8fafc !important;
}

/* ====================================================================
   16. RESPONSIVE APP SHELL & MOBILE LAYOUT (PR #29 / Issue #46)
   ==================================================================== */
.header-settings > summary {
  list-style: none;
}

.header-settings > summary::-webkit-details-marker {
  display: none;
}

.header-settings-toggle {
  width: 2.75rem;
  height: 2.75rem;
}

.header-settings-panel {
  z-index: 60;
  background: var(--bg-surface) !important;
}

.header-settings-panel > button {
  width: 100%;
  min-height: 2.25rem;
  justify-content: flex-start;
}

.header-settings-panel > div {
  justify-content: space-between;
}

.header-settings-panel > div button,
.header-settings-panel select {
  min-height: 2.5rem;
}

.header-settings-divider {
  height: 1px;
  background: var(--border-divider);
}

.header-menu-item {
  min-height: 2.5rem !important;
}

.device-filter-panel {
  position: relative;
  z-index: 40;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-filter-primary {
  min-height: 2.75rem;
}

.device-search input {
  min-height: 2.75rem;
  font-size: 0.875rem;
}

.device-toggle-pill,
.device-refresh-btn {
  min-height: 2.5rem;
}

.device-refresh-btn,
.device-edit-button {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
}

.device-filter-grid {
  align-items: center;
  width: 100%;
}

.device-filter-btn,
.device-filter-select {
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  cursor: pointer;
  user-select: none;
}

.device-filter-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 0.85rem;
  padding-right: 2rem !important;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.75rem;
  transition: all 0.15s ease;
  color: var(--input-text, #1e293b);
  border: 1px solid var(--border-card, #e2e8f0);
}

.dark .device-filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

.device-filter-select.is-active {
  border-color: #0067c0;
  color: #0067c0;
  font-weight: 600;
}

.dark .device-filter-select.is-active {
  border-color: #38bdf8;
  color: #38bdf8;
}

.device-filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  width: 100%;
  min-width: 12.5rem;
  z-index: 50;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.75rem;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 15rem;
  overflow-y: auto;
  padding: 0.25rem;
}

.dark .device-filter-dropdown-menu {
  background: rgba(36, 36, 36, 0.98);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6), 0 6px 12px -2px rgba(0, 0, 0, 0.4);
}

.device-filter-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  color: var(--input-text, #1e293b);
  transition: all 0.12s ease;
  cursor: pointer;
  user-select: none;
  text-align: left;
}

.dark .device-filter-option {
  color: #f1f5f9;
}

.device-filter-option:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.dark .device-filter-option:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.device-filter-option.is-selected {
  font-weight: 600;
  color: #0067c0;
  background-color: rgba(0, 103, 192, 0.08);
}

.dark .device-filter-option.is-selected {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
}

.device-table-scroll {
  scrollbar-gutter: stable;
  /* Column widths below are expressed in container-query units so the table
     re-flows to the panel width (sidebar open/closed, hidden columns, window size). */
  container-type: inline-size;
  container-name: device-table;
}

.device-table {
  width: 100%;
  /* Below this width the columns can no longer shrink legibly; the panel scrolls
     horizontally instead and the Status + Actions columns stay pinned on the right. */
  min-width: 64rem;
  table-layout: fixed;
  --device-col-actions-w: 3.25rem;
}

/* The Name and Profile columns are sized by fitDeviceNameColumn() (app.js) to the widest
   device name + details and profile name currently listed (--device-col-name-w,
   --device-col-profile-w). When that would not fit the panel, the
   other flexible columns are scaled down together (--device-col-squeeze, >= 0.85) so the
   table still renders without horizontal scrolling. Without the variables (no JS yet) the
   Name column simply absorbs whatever the other columns leave over. */
.device-table .device-col-name { width: var(--device-col-name-w, auto); }
.device-table .device-col-address { width: calc(clamp(9rem, 14cqw, 12rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-profile { width: var(--device-col-profile-w, calc(clamp(7.5rem, 10cqw, 11rem) * var(--device-col-squeeze, 1))); }
.device-table .device-col-node { width: calc(clamp(6.5rem, 8.5cqw, 10rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-band { width: calc(clamp(6.25rem, 7.5cqw, 7.5rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-signal { width: calc(clamp(6rem, 7cqw, 7.5rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-traffic { width: calc(clamp(9.5rem, 11cqw, 12rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-first-seen { width: calc(clamp(7rem, 9cqw, 9.5rem) * var(--device-col-squeeze, 1)); }
.device-table .device-col-status { width: clamp(5.5rem, 6.5cqw, 6.5rem); }
.device-table .device-col-actions { width: var(--device-col-actions-w); }

.device-table th,
.device-table td {
  padding: 0.75rem 0.75rem;
  vertical-align: middle;
  min-width: 0;
}

/* Free-text cells (name, profile, node) wrap inside their column instead of forcing the
   table wider; badge/number cells keep their own white-space rules. */
.device-table td.device-name-cell,
.device-table td.device-profile-cell,
.device-table td.device-node-cell {
  overflow-wrap: break-word;
}

.device-table td.device-band-cell {
  white-space: nowrap;
}

/* Band sits above the channel in the cell, so the "Band / Channel" header may wrap too. */
.device-table th.device-col-band {
  white-space: normal;
}

.device-table td.device-address-cell {
  padding-left: 0.625rem;
  padding-right: 0.625rem;
}

/* The Devices page is table-heavy: let it use more of a wide screen than the other pages. */
.app-main.app-main-wide {
  max-width: 100rem;
}

.device-table th.device-th-traffic,
.device-table td.device-traffic-cell {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.device-table td.device-traffic-cell {
  overflow: hidden;
}

.device-table td.device-status-cell {
  white-space: nowrap;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.device-table td.device-first-seen-cell {
  white-space: normal;
}

.device-table th {
  font-size: 0.625rem;
  line-height: 1rem;
  white-space: nowrap;
}

.device-name {
  max-width: 100%;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

@media (min-width: 768px) {
  .device-table th:first-child,
  .device-table td:first-child {
    position: sticky;
    left: 0;
  }

  .device-table th:last-child,
  .device-table td:last-child {
    position: sticky;
    right: 0;
  }

  /* Status is pinned just left of Actions so Online/Offline is always visible,
     even when a narrow panel forces horizontal scrolling. */
  .device-table th.device-col-status,
  .device-table td.device-status-cell {
    position: sticky;
    right: var(--device-col-actions-w);
  }

  .device-table th:first-child,
  .device-table th:last-child,
  .device-table th.device-col-status {
    z-index: 30;
  }

  .device-table td:first-child,
  .device-table td:last-child,
  .device-table td.device-status-cell {
    z-index: 10;
    background: var(--bg-surface);
  }

  .device-table td:first-child {
    box-shadow: 1px 0 var(--border-divider);
  }

  .device-table td:last-child,
  .device-table td.device-status-cell {
    box-shadow: -1px 0 var(--border-divider);
  }

  /* Alpine's x-show hides the Status cell with display:none; when it is visible the
     divider belongs on its left edge, not between Status and Actions. */
  .device-table td.device-status-cell:not([style*="display: none"]) + td:last-child {
    box-shadow: none;
  }
}

.chart-frame {
  position: relative;
  width: 100%;
  height: clamp(14rem, 28vw, 16.25rem);
}

.chart-frame-lg {
  height: clamp(14rem, 30vw, 17.5rem);
}

.mobile-sidebar-scrim {
  display: none;
}

@media (max-width: 1279px) {
  .app-header {
    gap: 1rem;
  }
}

@media (max-width: 1023px) {
  .device-table-scroll {
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .device-table {
    display: block;
    min-width: 0;
    table-layout: auto;
  }

  .device-table colgroup,
  .device-table thead {
    display: none;
  }

  .device-table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .device-table-row {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.875rem 1rem;
    padding: 1rem;
    border: 1px solid var(--border-card);
    border-radius: 0.75rem;
    background: var(--bg-surface);
  }

  .device-table-row > td {
    position: static !important;
    display: block;
    min-width: 0;
    padding: 0;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left;
    white-space: normal;
  }

  .device-table-row > td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1rem;
    text-transform: uppercase;
  }

  .device-table-row > .device-name-cell {
    grid-column: 1 / -1;
    padding-right: 3rem;
  }

  .device-table-row > .device-name-cell::before,
  .device-table-row > td:last-child::before {
    display: none;
  }

  .device-table-row > td:last-child {
    position: absolute !important;
    top: 0.625rem;
    right: 0.625rem;
  }

  .device-empty-row {
    display: block;
    grid-column: 1 / -1;
  }

  .device-empty-row td {
    display: block;
    width: 100%;
  }
}

@media (max-width: 767px) {
  .app-header {
    gap: 0.5rem;
    padding-inline: 0.75rem !important;
  }

  .app-brand {
    gap: 0.5rem;
  }

  .app-brand > * + * {
    margin-left: 0 !important;
  }

  .app-brand-copy > p {
    display: none;
  }

  .app-brand-row {
    gap: 0.5rem;
  }

  .app-brand-row > * + * {
    margin-left: 0 !important;
  }

  .app-header-actions {
    gap: 0.5rem;
  }

  .app-header-actions > * + * {
    margin-left: 0 !important;
  }

  .header-settings-panel {
    position: fixed !important;
    inset: 4.5rem 0.75rem auto !important;
    width: auto !important;
  }

  #btn-sidebar-toggle-header,
  .app-header-actions > button {
    display: flex;
    align-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    justify-content: center;
  }

  #btn-sidebar-toggle-header {
    background: transparent;
    border-color: transparent !important;
    box-shadow: none;
  }

  #btn-sidebar-toggle-header svg,
  .app-header-actions > button svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .app-header-actions > button > span {
    display: none !important;
  }

  .mobile-sidebar-scrim {
    display: none !important;
  }

  aside.sidebar-container {
    display: none !important;
  }

  .app-main {
    padding: 0.75rem 0.75rem 5.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .safe-area-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  .app-main .glass-panel,
  .glass-panel-elevated {
    padding: 1rem !important;
  }

  .app-main select {
    width: 100%;
  }

  .device-filter-controls {
    width: 100%;
    justify-content: space-between;
  }

  .app-main [class*="space-y-6"] {
    row-gap: 1rem;
  }

  .chart-frame,
  .chart-frame-lg {
    height: 14rem;
  }

  .app-main .device-table-panel {
    padding: 0 !important;
  }
}

@media (max-width: 639px) {
  .device-table tbody {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 419px) {
  .app-brand-copy h1 span {
    display: none;
  }

  .app-brand > div:nth-child(2) {
    width: 2.25rem;
    height: 2.25rem;
  }
}

/* Device Modal Tabs: Smooth Horizontal Scroll on Mobile & Touch Devices */
.device-modal-tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.device-modal-tabs::-webkit-scrollbar {
  display: none;
}

.device-modal-tabs > button {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* ====================================================================
   16. LIVE LOG VIEWER TERMINAL CONSOLE (High-Contrast Theme-Immune)
   ==================================================================== */
.log-console-terminal {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
  color: #f1f5f9 !important;
}

.log-console-terminal,
.log-console-terminal * {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
}

html:not(.dark) .log-console-terminal .log-time,
html.dark .log-console-terminal .log-time {
  color: #94a3b8 !important;
}

html:not(.dark) .log-console-terminal .log-logger,
html.dark .log-console-terminal .log-logger {
  color: #38bdf8 !important;
}

html:not(.dark) .log-console-terminal .log-message,
html.dark .log-console-terminal .log-message {
  color: #f8fafc !important;
}

html:not(.dark) .log-console-terminal .log-detail-box,
html.dark .log-console-terminal .log-detail-box {
  background-color: #030712 !important;
  border-color: #1f2937 !important;
  color: #fca5a5 !important;
}

html:not(.dark) .log-console-terminal .log-badge-debug,
html.dark .log-console-terminal .log-badge-debug {
  background-color: rgba(147, 51, 234, 0.3) !important;
  color: #e9d5ff !important;
  border-color: rgba(168, 85, 247, 0.6) !important;
}

html:not(.dark) .log-console-terminal .log-badge-info,
html.dark .log-console-terminal .log-badge-info {
  background-color: rgba(14, 165, 233, 0.3) !important;
  color: #bae6fd !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
}

html:not(.dark) .log-console-terminal .log-badge-warning,
html.dark .log-console-terminal .log-badge-warning {
  background-color: rgba(245, 158, 11, 0.3) !important;
  color: #fef08a !important;
  border-color: rgba(234, 179, 8, 0.6) !important;
}

html:not(.dark) .log-console-terminal .log-badge-error,
html.dark .log-console-terminal .log-badge-error {
  background-color: rgba(239, 68, 68, 0.35) !important;
  color: #fecdd3 !important;
  border-color: rgba(248, 113, 113, 0.7) !important;
}

