/* ==========================================================
 * PowerNet Core Design System
 * Modern Rounded SaaS Aesthetic inspired by reference interface
 * ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --bg-canvas: #F4F5F9;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFBFC;
  --bg-sidebar: #FFFFFF;
  --bg-input: #F8FAFC;
  --bg-track: #EEF2F6;

  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-light: #CBD5E1;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --accent-purple: #8B5CF6;
  --accent-purple-light: #F5F3FF;
  --accent-pink: #EC4899;
  --accent-amber: #F59E0B;
  --accent-amber-light: #FEF3C7;
  --accent-teal: #0D9488;

  --success: #16A34A;
  --success-light: #DCFCE7;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;

  --border-subtle: #E2E8F0;
  --border-card: rgba(226, 232, 240, 0.8);

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-card-hover: 0 8px 30px -4px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 45px -10px rgba(15, 23, 42, 0.15);

  /* Radii */
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

/* Layout App Shell */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-canvas);
}

/* Sidebar Styling */
.sidebar {
  width: 240px;
  min-width: 240px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 24px 8px;
}

.brand-logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0F172A;
  font-size: 24px;
  box-shadow: none;
  flex-shrink: 0;
}

.brand-icon i {
  color: #0F172A !important;
  font-size: 24px;
}

/* Brand Text: Bold Black, zero gradient or AI slop look */
.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0F172A;
}

.brand-text span {
  color: #0F172A;
}

/* Sidebar Toggle Buttons (ChatGPT & Gemini style) */
.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: #64748B;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background-color: #F1F5F9;
  color: #0F172A;
}

.topbar-toggle-btn {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  color: #334155;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.topbar-toggle-btn:hover {
  background-color: #F8FAFC;
  color: #0F172A;
  border-color: #CBD5E1;
}

/* Collapsed Sidebar Mode (ChatGPT & Gemini style) */
.app-container.sidebar-collapsed .sidebar {
  width: 76px;
  min-width: 76px;
  padding: 20px 10px;
}

.app-container.sidebar-collapsed .brand-text,
.app-container.sidebar-collapsed .nav-text,
.app-container.sidebar-collapsed .sidebar-widget .widget-title,
.app-container.sidebar-collapsed .sidebar-widget .widget-sub,
.app-container.sidebar-collapsed .sidebar-widget .btn-label-connected,
.app-container.sidebar-collapsed .sidebar-widget .btn-label-disconnect,
.app-container.sidebar-collapsed .sidebar-widget .widget-btn-text,
.app-container.sidebar-collapsed .sidebar-widget .widget-skeleton-title,
.app-container.sidebar-collapsed .sidebar-widget .widget-skeleton-sub,
.app-container.sidebar-collapsed .sidebar-widget .widget-skeleton-btn,
.app-container.sidebar-collapsed .sidebar-divider {
  display: none !important;
}

.app-container.sidebar-collapsed .brand-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 0 20px 0;
}

.app-container.sidebar-collapsed .sidebar-toggle-btn {
  display: flex !important;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  color: #334155;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  position: relative;
}

.app-container.sidebar-collapsed .sidebar-toggle-btn:hover {
  background-color: #F8FAFC;
  color: var(--primary);
  border-color: #CBD5E1;
}

.app-container.sidebar-collapsed .sidebar-toggle-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #0F172A;
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.app-container.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 12px;
  position: relative;
}

.app-container.sidebar-collapsed .sidebar-widget {
  padding: 10px 4px;
  background: transparent;
  border: none;
}

.app-container.sidebar-collapsed .sidebar-widget .widget-btn,
.app-container.sidebar-collapsed .sidebar-widget .widget-btn.connected {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #0F172A !important;
  padding: 6px !important;
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  border-radius: 10px !important;
  margin: 4px auto 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.app-container.sidebar-collapsed .sidebar-widget .widget-btn:hover,
.app-container.sidebar-collapsed .sidebar-widget .widget-btn.connected:hover {
  background: #F1F5F9 !important;
  color: var(--color-primary, #1A5AF0) !important;
  transform: scale(1.08);
}

.app-container.sidebar-collapsed .sidebar-widget .widget-btn i {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 22px !important;
  margin: 0 !important;
  line-height: 1;
}

/* Hover tooltips when sidebar is collapsed */
@media (min-width: 769px) {
  .app-container.sidebar-collapsed .nav-link[data-tooltip]:hover::after,
  .app-container.sidebar-collapsed .sidebar-widget .widget-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #0F172A;
    color: #FFFFFF;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    pointer-events: none;
  }
}

/* Mobile drawer backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  flex: 1;
}

.nav-item {
  display: block;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 12px;
  color: #475569;
  font-size: 14.5px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: #0F172A;
  background-color: #F8FAFC;
}

.nav-link.active {
  background-color: #EEF2F6;
  color: #0F172A;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  display: block;
  stroke: currentColor;
  transition: stroke var(--transition-fast);
}

.nav-link.active .nav-icon svg {
  stroke: #0F172A;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 16px 12px;
}

/* Sidebar Support / Device Widget (Premium Black & White Monochrome Style) */
.sidebar-widget {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-xl, 16px);
  padding: 20px 16px;
  text-align: center;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: all 0.2s ease;
}

.sidebar-widget:hover {
  border-color: #CBD5E1;
  box-shadow: 0 6px 20px -2px rgba(15, 23, 42, 0.08);
}

.widget-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: #0F172A;
  transition: all 0.2s ease;
}

.widget-icon-box svg {
  stroke: #0F172A;
}

.widget-title {
  font-size: 14px;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.widget-sub {
  font-size: 12px;
  color: #64748B;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}

.widget-sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #0F172A;
  font-weight: 700;
}

.widget-sub-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0F172A;
  display: inline-block;
}

.widget-sub-id {
  color: #64748B;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 600;
}

.widget-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 18px;
  background-color: #0F172A;
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border: 1px solid #0F172A;
  cursor: pointer;
}

.widget-btn:hover {
  background-color: #000000;
  border-color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
}

.widget-btn.connected {
  background: #0F172A !important;
  color: #FFFFFF !important;
  border: 1px solid #0F172A !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16) !important;
  cursor: pointer;
}

.widget-btn.connected:hover {
  background: #000000 !important;
  color: #FFFFFF !important;
  border-color: #000000 !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24) !important;
}

/* Main Content Area — fills 100% width cleanly so right side is never empty */
.main-content {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 28px 36px;
  overflow-y: auto;
  animation: pageFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageFadeIn {
  from {
    opacity: 0.88;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title-group {
  display: flex;
  align-items: center;
  gap: 20px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

/* Pill Date Selector / Status Pill */
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  height: 38px;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.date-pill:hover {
  border-color: #CBD5E1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Live Telemetry Pulse Badge - Same rounded border size as date-pill */
.live-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  height: 38px;
  box-sizing: border-box;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

/* Desktop Theme Toggle - Same rounded border size as date-pill */
.desktop-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  height: 38px;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.desktop-theme-toggle:hover {
  border-color: #CBD5E1;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  animation: pulse-ring 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

.pulse-dot.offline {
  background-color: var(--danger);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

/* User Profile Badge */
.user-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.user-profile:hover {
  background-color: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.10);
  transform: translateY(-1px);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #DBEAFE;
  border: 1px solid #BFDBFE;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1D4ED8;
  font-size: 13.5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-profile:hover .avatar {
  background-color: #BFDBFE;
  color: #1E40AF;
  border-color: #93C5FD;
}

.btn-device-analytics:hover {
  background-color: #000000 !important;
  border-color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24) !important;
}

.btn-device-disconnect:hover {
  background-color: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}

.user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Utility UI Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-danger {
  background-color: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background-color: var(--warning-light);
  color: var(--warning);
}

.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

.badge-secondary {
  background-color: #F1F5F9;
  color: var(--text-secondary);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
  width: 100%;
  max-width: 480px;
  padding: 32px;
  transform: translateY(16px) scale(0.98);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F1F5F9;
  border: none;
  color: #64748B;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #E2E8F0;
  color: var(--text-primary);
  transform: scale(1.05);
}

/* Global Form Controls & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.form-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.input-control {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1.5px solid #E2E8F0;
  background-color: #F8FAFC;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.input-control:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-control::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 16px;
  color: #94A3B8;
  font-size: 15px;
  pointer-events: none;
}

.input-with-icon .input-control {
  padding-left: 44px;
}

/* Action Buttons */
.btn-primary-block {
  width: 100%;
  height: 48px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid #0F172A;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-block:hover {
  background: #000000;
  border-color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
}

.btn-primary-block:active {
  transform: translateY(0);
}

.btn-primary-inline {
  height: 48px;
  padding: 0 26px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid #0F172A;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-primary-inline:hover {
  background: #000000;
  border-color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.24);
}

/* Toast Notifications (Minimal, sleek, compact, bottom-right side) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  transform: none;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  max-width: 90vw;
}

@media (max-width: 480px) {
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    top: auto;
    transform: none;
    align-items: center;
    max-width: calc(100vw - 32px);
  }
}

.toast {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 9999px;
  padding: 10px 20px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  font-size: 13.5px;
  font-weight: 600;
  color: #0F172A;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  max-width: min(520px, 92vw);
  animation: slideInToast 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.toast-error {
  background: #FFFFFF;
  border-color: #FECACA;
  color: #0F172A;
}

.toast.toast-success {
  background: #FFFFFF;
  border-color: #BBF7D0;
  color: #0F172A;
}

.toast.toast-info {
  background: #FFFFFF;
  border-color: #BFDBFE;
  color: #0F172A;
}

.toast-icon {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  color: #0F172A;
}

.toast-success .toast-icon {
  background: #DCFCE7;
  border: 1px solid #86EFAC;
  color: #15803D;
}

.toast-error .toast-icon {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #B91C1C;
}

.toast-info .toast-icon {
  background: #DBEAFE;
  border: 1px solid #93C5FD;
  color: #1D4ED8;
}

@keyframes slideInToast {
  from {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Universal Skeleton Loading Shimmer */
.skeleton-shimmer {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeletonShimmerAnim 1.4s ease-in-out infinite;
  border-radius: 12px;
}

@keyframes skeletonShimmerAnim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-device-card {
  height: 94px;
  width: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, #F8FAFC 25%, #EDF2F7 50%, #F8FAFC 75%);
  background-size: 200% 100%;
  animation: skeletonShimmerAnim 1.4s ease-in-out infinite;
  margin-bottom: 18px;
  border: 1px solid #E2E8F0;
}

/* YouTube-style Top Progress Bar */
#yt-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #2563EB 0%, #38BDF8 60%, #1D4ED8 100%);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.8), 0 0 5px rgba(56, 189, 248, 0.5);
  z-index: 100000;
  pointer-events: none;
  opacity: 0;
  transition: width 0.35s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.2s ease;
}

#yt-progress-bar.active {
  opacity: 1;
}

/* Sidebar Widget Skeleton Shimmer */
.widget-skeleton-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: pageFadeIn 0.15s ease-out;
}

.widget-skeleton-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin: 0 auto 10px auto;
}

.widget-skeleton-title {
  height: 14px;
  width: 72%;
  margin: 0 auto 8px auto;
  border-radius: 4px;
}

.widget-skeleton-sub {
  height: 11px;
  width: 52%;
  margin: 0 auto 12px auto;
  border-radius: 4px;
}

.widget-skeleton-btn {
  height: 36px;
  width: 100%;
  border-radius: 9999px;
}

/* ==========================================================
 * Right Slide-Out Drawer (Profile & Settings)
 * ========================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.right-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 88vw;
  background: #FFFFFF;
  z-index: 201;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.14);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.right-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #94A3B8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.drawer-close-btn:hover {
  color: var(--text-primary);
  background: #F1F5F9;
}

.drawer-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  flex: 1;
}

.drawer-card {
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

.drawer-avatar-wrap {
  margin-bottom: 14px;
}

.drawer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0F172A;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
}

.drawer-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.drawer-user-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.icon-btn-edit {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: var(--primary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s;
}

.icon-btn-edit:hover {
  background: var(--primary);
  color: #FFFFFF;
}

.drawer-name-edit-form {
  margin-top: 8px;
  width: 100%;
}

.drawer-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.drawer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.edit-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.btn-edit-save {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-edit-save:hover {
  background: var(--primary-hover);
}

.btn-edit-cancel {
  background: #E2E8F0;
  color: #475569;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-edit-cancel:hover {
  background: #CBD5E1;
}

.drawer-user-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.drawer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.drawer-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-device-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: #F1F5F9;
  color: #64748B;
}

.drawer-device-badge.connected {
  background: #DCFCE7;
  color: #15803D;
}

.drawer-device-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.drawer-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-label {
  color: var(--text-muted);
}

.detail-val {
  color: var(--text-primary);
  font-weight: 600;
}

.drawer-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s;
}

.drawer-card-action:hover {
  background: #EFF6FF;
  border-color: #BFDBFE;
}

button.drawer-card-action {
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}

/* Manage Dashboard drawer: iPhone-style phase switches */
.dash-prefs-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.phase-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.drawer-card-header + .phase-switch-row {
  border-top: none;
  padding-top: 0;
}

.phase-switch-sub {
  margin-left: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.ios-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--text-light);
  cursor: pointer;
  transition: background 0.2s ease;
}

.ios-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-switch:checked {
  background: var(--success);
}

.ios-switch:checked::before {
  transform: translateX(18px);
}

.ios-switch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Dashboard box title suffix, e.g. "Voltage (V2)" */
.phase-tag {
  margin-left: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .ios-switch,
  .ios-switch::before {
    transition: none;
  }
}

.drawer-btn-logout {
  width: 100%;
  padding: 11px 16px;
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  color: #E11D48;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.drawer-btn-logout:hover {
  background: #FFE4E6;
  border-color: #FDA4AF;
}
