/* ==========================================================================
   PulseGrid RMM — Design System
   Distinctive teal/slate enterprise theme with atmospheric depth.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..800;1,9..40,400..700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --pg-font-display: 'DM Sans', 'IBM Plex Sans', system-ui, sans-serif;
  --pg-font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --pg-font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --pg-radius-sm: 6px;
  --pg-radius-md: 10px;
  --pg-radius-lg: 16px;
  --pg-radius-xl: 22px;

  --pg-shadow-sm: 0 1px 2px rgba(9, 22, 33, 0.06), 0 1px 1px rgba(9, 22, 33, 0.04);
  --pg-shadow-md: 0 6px 16px -4px rgba(9, 22, 33, 0.14), 0 2px 6px -2px rgba(9, 22, 33, 0.08);
  --pg-shadow-lg: 0 20px 44px -12px rgba(9, 22, 33, 0.28), 0 8px 16px -8px rgba(9, 22, 33, 0.14);
  --pg-shadow-glow: 0 0 0 1px rgba(45, 212, 191, 0.18), 0 8px 30px -6px rgba(20, 184, 166, 0.35);

  --pg-transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --pg-transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --pg-transition-slow: 360ms cubic-bezier(0.4, 0, 0.2, 1);

  --pg-sidebar-w: 258px;
  --pg-sidebar-w-collapsed: 76px;
  --pg-topbar-h: 64px;

  /* Brand palette (theme-independent) */
  --pg-teal-50: #ecfdf9;
  --pg-teal-100: #cef7ec;
  --pg-teal-200: #99ecdb;
  --pg-teal-300: #5fdcc6;
  --pg-teal-400: #2ec5ac;
  --pg-teal-500: #14a892;
  --pg-teal-600: #0d8778;
  --pg-teal-700: #0d6d63;
  --pg-teal-800: #105850;
  --pg-teal-900: #0f4842;

  --pg-amber-400: #f5a524;
  --pg-amber-500: #ea8c00;
  --pg-red-400: #f16063;
  --pg-red-500: #e33e42;
  --pg-red-600: #c22a30;
  --pg-blue-400: #4fa3e3;
  --pg-blue-500: #2b84cf;
  --pg-violet-400: #8b7ff0;
}

/* ---------------------------------------------------------------------- */
/* Light theme (default)                                                  */
/* ---------------------------------------------------------------------- */
:root,
[data-pg-theme='light'] {
  --pg-bg-canvas: #eef4f4;
  --pg-bg-canvas-grad: radial-gradient(1200px 600px at 12% -8%, rgba(20, 168, 146, 0.14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(43, 132, 207, 0.10), transparent 55%),
    linear-gradient(180deg, #eef4f4 0%, #e7eeee 100%);
  --pg-bg-surface: #ffffff;
  --pg-bg-surface-alt: #f5f8f8;
  --pg-bg-surface-raised: #ffffff;
  --pg-bg-sidebar: linear-gradient(195deg, #0e3a37 0%, #0a2b2c 55%, #0a2230 100%);
  --pg-bg-sidebar-hover: rgba(255, 255, 255, 0.07);
  --pg-bg-sidebar-active: rgba(45, 212, 191, 0.16);
  --pg-bg-topbar: rgba(255, 255, 255, 0.86);
  --pg-bg-input: #ffffff;
  --pg-bg-hover: #eef3f3;
  --pg-bg-code: #0f2b2c;

  --pg-border: #dde6e6;
  --pg-border-soft: #e8eeee;
  --pg-border-strong: #c7d4d4;

  --pg-text-primary: #0f2626;
  --pg-text-secondary: #4a6262;
  --pg-text-tertiary: #7c9190;
  --pg-text-inverse: #f1f8f7;
  --pg-text-sidebar: #cfe7e2;
  --pg-text-sidebar-muted: #85a8a1;

  --pg-accent: var(--pg-teal-500);
  --pg-accent-hover: var(--pg-teal-600);
  --pg-accent-soft: var(--pg-teal-50);
  --pg-accent-contrast: #ffffff;

  --pg-success: #12946a;
  --pg-success-bg: #e4f7ee;
  --pg-warning: var(--pg-amber-500);
  --pg-warning-bg: #fdf1de;
  --pg-danger: var(--pg-red-600);
  --pg-danger-bg: #fdecec;
  --pg-info: var(--pg-blue-500);
  --pg-info-bg: #e8f2fb;
  --pg-offline: #8b98a8;
  --pg-offline-bg: #eef1f4;

  --pg-scrollbar: #c3d1d1;
  color-scheme: light;
}

/* ---------------------------------------------------------------------- */
/* Dark theme                                                              */
/* ---------------------------------------------------------------------- */
[data-pg-theme='dark'] {
  --pg-bg-canvas: #0b1618;
  --pg-bg-canvas-grad: radial-gradient(1100px 620px at 10% -10%, rgba(20, 184, 166, 0.16), transparent 60%),
    radial-gradient(900px 520px at 105% 0%, rgba(43, 132, 207, 0.14), transparent 55%),
    linear-gradient(180deg, #0b1618 0%, #0a1315 100%);
  --pg-bg-surface: #101c1e;
  --pg-bg-surface-alt: #0d1719;
  --pg-bg-surface-raised: #142226;
  --pg-bg-sidebar: linear-gradient(195deg, #0a1c1c 0%, #08161a 55%, #070f18 100%);
  --pg-bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --pg-bg-sidebar-active: rgba(45, 212, 191, 0.18);
  --pg-bg-topbar: rgba(16, 28, 30, 0.82);
  --pg-bg-input: #0d1a1c;
  --pg-bg-hover: #16262a;
  --pg-bg-code: #08131a;

  --pg-border: #1e3236;
  --pg-border-soft: #17282b;
  --pg-border-strong: #2b4448;

  --pg-text-primary: #eaf4f2;
  --pg-text-secondary: #9fb8b6;
  --pg-text-tertiary: #6c8886;
  --pg-text-inverse: #0f2626;
  --pg-text-sidebar: #cfe7e2;
  --pg-text-sidebar-muted: #6f938c;

  --pg-accent: var(--pg-teal-400);
  --pg-accent-hover: var(--pg-teal-300);
  --pg-accent-soft: rgba(45, 212, 191, 0.12);
  --pg-accent-contrast: #06201d;

  --pg-success: #34d399;
  --pg-success-bg: rgba(52, 211, 153, 0.12);
  --pg-warning: #fbbf3f;
  --pg-warning-bg: rgba(251, 191, 63, 0.12);
  --pg-danger: #f2696c;
  --pg-danger-bg: rgba(242, 105, 108, 0.14);
  --pg-info: #59a8e8;
  --pg-info-bg: rgba(89, 168, 232, 0.14);
  --pg-offline: #7c8b9a;
  --pg-offline-bg: rgba(124, 139, 154, 0.14);

  --pg-scrollbar: #23383b;
  color-scheme: dark;
}

/* ---------------------------------------------------------------------- */
/* Base                                                                    */
/* ---------------------------------------------------------------------- */
* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}

body {
  font-family: var(--pg-font-body);
  background: var(--pg-bg-canvas-grad);
  background-attachment: fixed;
  color: var(--pg-text-primary);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--pg-transition-slow), color var(--pg-transition-base);
}

h1, h2, h3, h4, h5, h6, .pg-font-display {
  font-family: var(--pg-font-display);
  letter-spacing: -0.01em;
  color: var(--pg-text-primary);
}

a { color: var(--pg-accent); text-decoration: none; }
a:hover { color: var(--pg-accent-hover); }

code, .pg-mono { font-family: var(--pg-font-mono); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--pg-scrollbar);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.pg-text-secondary { color: var(--pg-text-secondary); }
.pg-text-tertiary { color: var(--pg-text-tertiary); }

/* ---------------------------------------------------------------------- */
/* Auth / Login Page                                                       */
/* ---------------------------------------------------------------------- */
.pg-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background:
    radial-gradient(1400px 900px at 20% 0%, rgba(45, 212, 191, 0.22), transparent 55%),
    radial-gradient(1100px 800px at 90% 100%, rgba(43, 132, 207, 0.18), transparent 55%),
    linear-gradient(160deg, #06181a 0%, #0a2b2c 45%, #0a1f30 100%);
  overflow: hidden;
  position: relative;
}

.pg-auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 30% 30%, black, transparent 70%);
  pointer-events: none;
}

.pg-auth-brand-panel {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 64px;
  position: relative;
  z-index: 1;
  color: #eafaf6;
}

.pg-auth-glow-orb {
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.35), transparent 70%);
  filter: blur(10px);
  top: -140px; left: -120px;
  pointer-events: none;
}

.pg-auth-form-panel {
  flex: 0.85;
  min-width: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 22, 24, 0.35);
  backdrop-filter: blur(18px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.pg-auth-card {
  width: 100%;
  max-width: 400px;
  padding: 8px 8px;
  color: #eafaf6;
}

.pg-auth-card .form-control {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eafaf6;
  padding: 0.72rem 0.9rem;
  border-radius: var(--pg-radius-md);
}
.pg-auth-card .form-control::placeholder { color: rgba(234, 250, 246, 0.4); }
.pg-auth-card .form-control:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--pg-teal-400);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18);
  color: #eafaf6;
}
.pg-auth-card label { color: rgba(234, 250, 246, 0.75); font-weight: 500; font-size: 13px; }

.pg-logo-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pg-teal-300), var(--pg-teal-600));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -6px rgba(20, 184, 166, 0.55);
  flex-shrink: 0;
}
.pg-logo-mark svg { width: 24px; height: 24px; }

.pg-logo-wordmark {
  font-family: var(--pg-font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #f1fbf9;
}
.pg-logo-wordmark span { color: var(--pg-teal-300); }

.pg-auth-feature-list { display: flex; flex-direction: column; gap: 18px; margin-top: 40px; }
.pg-auth-feature {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--pg-radius-lg);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.pg-auth-feature i { color: var(--pg-teal-300); font-size: 18px; margin-top: 2px; }
.pg-auth-feature strong { display: block; font-size: 14px; color: #f1fbf9; }
.pg-auth-feature p { margin: 2px 0 0; font-size: 12.5px; color: rgba(234, 250, 246, 0.6); }

.pg-btn-auth {
  width: 100%;
  background: linear-gradient(135deg, var(--pg-teal-400), var(--pg-teal-600));
  border: none;
  color: #06201d;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: var(--pg-radius-md);
  box-shadow: 0 10px 24px -8px rgba(20, 184, 166, 0.55);
  transition: transform var(--pg-transition-fast), box-shadow var(--pg-transition-fast);
}
.pg-btn-auth:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(20, 184, 166, 0.65); color: #06201d; }
.pg-btn-auth:active { transform: translateY(0); }
.pg-btn-auth:disabled { opacity: 0.6; transform: none; }

/* ---------------------------------------------------------------------- */
/* App Shell Layout                                                        */
/* ---------------------------------------------------------------------- */
.pg-shell { display: flex; min-height: 100vh; }

.pg-sidebar {
  width: var(--pg-sidebar-w);
  flex-shrink: 0;
  background: var(--pg-bg-sidebar);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: width var(--pg-transition-base);
  box-shadow: var(--pg-shadow-lg);
  overflow: hidden;
}
.pg-sidebar.collapsed { width: var(--pg-sidebar-w-collapsed); }

.pg-sidebar-brand {
  height: var(--pg-topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pg-sidebar-brand .pg-logo-wordmark { font-size: 18px; white-space: nowrap; opacity: 1; transition: opacity var(--pg-transition-fast); }
.pg-sidebar.collapsed .pg-logo-wordmark,
.pg-sidebar.collapsed .pg-nav-label,
.pg-sidebar.collapsed .pg-nav-section-title,
.pg-sidebar.collapsed .pg-sidebar-footer-text { opacity: 0; width: 0; }

.pg-sidebar-scroll { flex: 1; overflow-y: auto; padding: 14px 10px 20px; }
.pg-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); }

.pg-nav-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--pg-text-sidebar-muted);
  padding: 16px 12px 6px;
  white-space: nowrap;
  transition: opacity var(--pg-transition-fast);
}
.pg-nav-section-title:first-child { padding-top: 4px; }

.pg-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--pg-radius-md);
  color: var(--pg-text-sidebar);
  font-size: 13.5px; font-weight: 500;
  margin: 2px 0;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background var(--pg-transition-fast), color var(--pg-transition-fast);
}
.pg-nav-item i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; color: var(--pg-text-sidebar-muted); transition: color var(--pg-transition-fast); }
.pg-nav-item:hover { background: var(--pg-bg-sidebar-hover); color: #fff; }
.pg-nav-item:hover i { color: var(--pg-teal-300); }
.pg-nav-item.active { background: var(--pg-bg-sidebar-active); color: #fff; }
.pg-nav-item.active i { color: var(--pg-teal-300); }
.pg-nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 3px; background: var(--pg-teal-300);
}
.pg-nav-label { flex: 1; transition: opacity var(--pg-transition-fast); }
.pg-nav-badge {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  background: var(--pg-red-500); color: #fff;
}

.pg-sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}
.pg-sidebar-toggle {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px; border-radius: var(--pg-radius-md);
  color: var(--pg-text-sidebar-muted); background: transparent; border: none; cursor: pointer;
  transition: background var(--pg-transition-fast), color var(--pg-transition-fast);
}
.pg-sidebar-toggle:hover { background: var(--pg-bg-sidebar-hover); color: #fff; }

.pg-main {
  flex: 1;
  margin-left: var(--pg-sidebar-w);
  min-width: 0;
  transition: margin-left var(--pg-transition-base);
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.pg-main.sidebar-collapsed { margin-left: var(--pg-sidebar-w-collapsed); }

.pg-topbar {
  height: var(--pg-topbar-h);
  position: sticky; top: 0; z-index: 30;
  background: var(--pg-bg-topbar);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--pg-border-soft);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
}

.pg-topbar-icon-btn {
  width: 38px; height: 38px; border-radius: var(--pg-radius-md);
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--pg-text-secondary);
  cursor: pointer; transition: background var(--pg-transition-fast), color var(--pg-transition-fast);
  position: relative;
}
.pg-topbar-icon-btn:hover { background: var(--pg-bg-hover); color: var(--pg-text-primary); }

.pg-global-search {
  flex: 1; max-width: 460px; position: relative;
}
.pg-global-search input {
  width: 100%; padding: 9px 14px 9px 38px; border-radius: var(--pg-radius-md);
  border: 1px solid var(--pg-border); background: var(--pg-bg-surface-alt);
  color: var(--pg-text-primary); font-size: 13.5px;
  transition: border-color var(--pg-transition-fast), box-shadow var(--pg-transition-fast);
}
.pg-global-search input:focus { outline: none; border-color: var(--pg-accent); box-shadow: 0 0 0 3px var(--pg-accent-soft); background: var(--pg-bg-surface); }
.pg-global-search i.pg-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--pg-text-tertiary); font-size: 13px; }
.pg-global-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10.5px; padding: 2px 6px; border-radius: 5px; background: var(--pg-border-soft); color: var(--pg-text-tertiary);
}

.pg-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--pg-bg-surface-raised); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-lg);
  box-shadow: var(--pg-shadow-lg); max-height: 400px; overflow-y: auto; z-index: 60; display: none;
}
.pg-search-results.show { display: block; }
.pg-search-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.pg-search-result-item:hover { background: var(--pg-bg-hover); }
.pg-search-result-item .grp { font-size: 10.5px; text-transform: uppercase; color: var(--pg-text-tertiary); letter-spacing: 0.06em; }

.pg-client-selector {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--pg-radius-md);
  border: 1px solid var(--pg-border); background: var(--pg-bg-surface-alt); cursor: pointer; font-size: 13px; font-weight: 500;
  white-space: nowrap; color: var(--pg-text-primary);
  transition: border-color var(--pg-transition-fast);
}
.pg-client-selector:hover { border-color: var(--pg-border-strong); }
.pg-client-selector i.chev { font-size: 10px; color: var(--pg-text-tertiary); }

.pg-topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.pg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pg-teal-400), var(--pg-blue-500));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.pg-content {
  padding: 24px 28px 60px;
  flex: 1;
  width: 100%;
  max-width: 1600px;
}

/* ---------------------------------------------------------------------- */
/* Cards / Surfaces                                                        */
/* ---------------------------------------------------------------------- */
.pg-card {
  background: var(--pg-bg-surface);
  border: 1px solid var(--pg-border-soft);
  border-radius: var(--pg-radius-lg);
  box-shadow: var(--pg-shadow-sm);
  transition: box-shadow var(--pg-transition-base), border-color var(--pg-transition-base);
}
.pg-card.pg-card-hover:hover { box-shadow: var(--pg-shadow-md); border-color: var(--pg-border-strong); }
.pg-card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--pg-border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pg-card-header h3, .pg-card-header h6 { margin: 0; font-size: 15px; font-weight: 700; }
.pg-card-body { padding: 20px; }
.pg-card-body.pg-p-0 { padding: 0; }

.pg-page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.pg-page-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.pg-page-subtitle { color: var(--pg-text-secondary); font-size: 13.5px; margin-top: 3px; }
.pg-breadcrumb { font-size: 12.5px; color: var(--pg-text-tertiary); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.pg-breadcrumb a { color: var(--pg-text-tertiary); }
.pg-breadcrumb a:hover { color: var(--pg-accent); }

/* Metric / KPI Cards */
.pg-metric-card {
  background: var(--pg-bg-surface);
  border: 1px solid var(--pg-border-soft);
  border-radius: var(--pg-radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--pg-shadow-sm);
  transition: transform var(--pg-transition-fast), box-shadow var(--pg-transition-fast);
}
.pg-metric-card:hover { transform: translateY(-2px); box-shadow: var(--pg-shadow-md); }
.pg-metric-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--mc-glow, rgba(20,168,146,0.16)), transparent 70%);
}
.pg-metric-icon {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--mc-bg, var(--pg-accent-soft)); color: var(--mc-fg, var(--pg-accent)); font-size: 17px; margin-bottom: 12px;
}
.pg-metric-label { font-size: 12.5px; color: var(--pg-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pg-metric-value { font-size: 28px; font-weight: 800; font-family: var(--pg-font-display); line-height: 1.15; margin-top: 2px; }
.pg-metric-delta { font-size: 12px; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.pg-metric-delta.up { color: var(--pg-success); }
.pg-metric-delta.down { color: var(--pg-danger); }

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn { font-family: var(--pg-font-body); font-weight: 600; font-size: 13.5px; border-radius: var(--pg-radius-md); }
.btn-sm { font-size: 12.5px; }
.pg-btn-primary, .btn.pg-btn-primary {
  background: linear-gradient(135deg, var(--pg-teal-500), var(--pg-teal-700));
  border: 1px solid var(--pg-teal-700);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(20, 168, 146, 0.5);
}
.pg-btn-primary:hover, .btn.pg-btn-primary:hover { background: linear-gradient(135deg, var(--pg-teal-400), var(--pg-teal-600)); color: #fff; }
.pg-btn-secondary, .btn.pg-btn-secondary {
  background: var(--pg-bg-surface-alt); border: 1px solid var(--pg-border); color: var(--pg-text-primary);
}
.pg-btn-secondary:hover, .btn.pg-btn-secondary:hover { background: var(--pg-bg-hover); border-color: var(--pg-border-strong); }
.pg-btn-danger, .btn.pg-btn-danger { background: var(--pg-danger-bg); border: 1px solid var(--pg-danger); color: var(--pg-danger); }
.pg-btn-danger:hover, .btn.pg-btn-danger:hover { background: var(--pg-danger); color: #fff; }
.pg-btn-ghost, .btn.pg-btn-ghost { background: transparent; border: 1px solid transparent; color: var(--pg-text-secondary); }
.pg-btn-ghost:hover, .btn.pg-btn-ghost:hover { background: var(--pg-bg-hover); color: var(--pg-text-primary); }
.pg-icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--pg-radius-sm); border: 1px solid var(--pg-border); background: var(--pg-bg-surface-alt); color: var(--pg-text-secondary);
  cursor: pointer; transition: all var(--pg-transition-fast);
}
.pg-icon-btn:hover { background: var(--pg-bg-hover); color: var(--pg-text-primary); border-color: var(--pg-border-strong); }

/* ---------------------------------------------------------------------- */
/* Badges / Status                                                        */
/* ---------------------------------------------------------------------- */
.pg-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; text-transform: capitalize; line-height: 1.5;
}
.pg-badge.online, .pg-badge.success, .pg-badge.healthy, .pg-badge.resolved { background: var(--pg-success-bg); color: var(--pg-success); }
.pg-badge.warning, .pg-badge.degraded, .pg-badge.pending { background: var(--pg-warning-bg); color: var(--pg-warning); }
.pg-badge.critical, .pg-badge.danger, .pg-badge.offline-crit { background: var(--pg-danger-bg); color: var(--pg-danger); }
.pg-badge.offline, .pg-badge.neutral, .pg-badge.disabled { background: var(--pg-offline-bg); color: var(--pg-offline); }
.pg-badge.info { background: var(--pg-info-bg); color: var(--pg-info); }

.pg-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pg-status-dot.online { background: var(--pg-success); box-shadow: 0 0 0 3px var(--pg-success-bg); }
.pg-status-dot.offline { background: var(--pg-offline); box-shadow: 0 0 0 3px var(--pg-offline-bg); }
.pg-status-dot.warning { background: var(--pg-warning); box-shadow: 0 0 0 3px var(--pg-warning-bg); }
.pg-status-dot.critical { background: var(--pg-danger); box-shadow: 0 0 0 3px var(--pg-danger-bg); animation: pg-pulse-dot 1.6s infinite; }
@keyframes pg-pulse-dot { 0%, 100% { box-shadow: 0 0 0 3px var(--pg-danger-bg); } 50% { box-shadow: 0 0 0 6px transparent; } }

.pg-severity-bar { width: 4px; border-radius: 4px; align-self: stretch; flex-shrink: 0; }
.pg-severity-bar.critical { background: var(--pg-danger); }
.pg-severity-bar.warning { background: var(--pg-warning); }
.pg-severity-bar.info { background: var(--pg-info); }

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */
.pg-table-wrap { overflow-x: auto; }
table.pg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.pg-table thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--pg-text-tertiary); font-weight: 700; padding: 11px 16px; background: var(--pg-bg-surface-alt);
  border-bottom: 1px solid var(--pg-border); white-space: nowrap; position: sticky; top: 0; z-index: 2;
  cursor: default; user-select: none;
}
table.pg-table thead th.sortable { cursor: pointer; }
table.pg-table thead th.sortable:hover { color: var(--pg-text-primary); }
table.pg-table thead th .sort-ic { margin-left: 4px; font-size: 10px; opacity: 0.5; }
table.pg-table thead th.sorted .sort-ic { opacity: 1; color: var(--pg-accent); }
table.pg-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--pg-border-soft); color: var(--pg-text-primary); vertical-align: middle; }
table.pg-table tbody tr { transition: background var(--pg-transition-fast); }
table.pg-table tbody tr:hover { background: var(--pg-bg-hover); }
table.pg-table tbody tr.selected { background: var(--pg-accent-soft); }
table.pg-table tbody tr:last-child td { border-bottom: none; }
.pg-cell-primary { font-weight: 600; color: var(--pg-text-primary); }
.pg-cell-sub { font-size: 12px; color: var(--pg-text-tertiary); }

.pg-table-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--pg-border-soft); }
.pg-table-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--pg-border-soft); flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */
.form-control, .form-select {
  background: var(--pg-bg-input); border: 1px solid var(--pg-border); color: var(--pg-text-primary);
  border-radius: var(--pg-radius-md); font-size: 13.5px; padding: 8px 12px;
}
.form-control:focus, .form-select:focus { border-color: var(--pg-accent); box-shadow: 0 0 0 3px var(--pg-accent-soft); background: var(--pg-bg-input); color: var(--pg-text-primary); }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--pg-text-secondary); margin-bottom: 5px; }
.form-check-input:checked { background-color: var(--pg-accent); border-color: var(--pg-accent); }
.form-switch .form-check-input:checked { background-color: var(--pg-accent); border-color: var(--pg-accent); }

/* ---------------------------------------------------------------------- */
/* Modals / Dialogs                                                        */
/* ---------------------------------------------------------------------- */
.modal-content { background: var(--pg-bg-surface-raised); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-lg); color: var(--pg-text-primary); }
.modal-header, .modal-footer { border-color: var(--pg-border-soft); }
.modal-backdrop.show { opacity: 0.55; }

.pg-confirm-icon {
  width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px;
}
.pg-confirm-icon.danger { background: var(--pg-danger-bg); color: var(--pg-danger); }
.pg-confirm-icon.warning { background: var(--pg-warning-bg); color: var(--pg-warning); }
.pg-confirm-icon.info { background: var(--pg-info-bg); color: var(--pg-info); }

/* ---------------------------------------------------------------------- */
/* Toasts                                                                  */
/* ---------------------------------------------------------------------- */
.pg-toast-stack { position: fixed; top: 78px; right: 22px; z-index: 1080; display: flex; flex-direction: column; gap: 10px; width: 360px; }
.pg-toast {
  background: var(--pg-bg-surface-raised); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md);
  box-shadow: var(--pg-shadow-lg); padding: 13px 14px; display: flex; gap: 11px; align-items: flex-start;
  animation: pg-toast-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  border-left: 3px solid var(--pg-accent);
}
.pg-toast.success { border-left-color: var(--pg-success); }
.pg-toast.danger { border-left-color: var(--pg-danger); }
.pg-toast.warning { border-left-color: var(--pg-warning); }
.pg-toast.info { border-left-color: var(--pg-info); }
.pg-toast.hide { animation: pg-toast-out 180ms ease forwards; }
@keyframes pg-toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pg-toast-out { to { opacity: 0; transform: translateX(24px); } }
.pg-toast-icon { font-size: 16px; margin-top: 1px; }
.pg-toast.success .pg-toast-icon { color: var(--pg-success); }
.pg-toast.danger .pg-toast-icon { color: var(--pg-danger); }
.pg-toast.warning .pg-toast-icon { color: var(--pg-warning); }
.pg-toast.info .pg-toast-icon { color: var(--pg-info); }
.pg-toast-title { font-weight: 700; font-size: 13px; }
.pg-toast-msg { font-size: 12.5px; color: var(--pg-text-secondary); margin-top: 1px; }
.pg-toast-close { margin-left: auto; cursor: pointer; color: var(--pg-text-tertiary); background: none; border: none; font-size: 13px; }

/* ---------------------------------------------------------------------- */
/* Skeletons / Empty / Error states                                        */
/* ---------------------------------------------------------------------- */
.pg-skel {
  background: linear-gradient(90deg, var(--pg-bg-surface-alt) 25%, var(--pg-bg-hover) 37%, var(--pg-bg-surface-alt) 63%);
  background-size: 400% 100%; animation: pg-skel-shimmer 1.4s ease infinite; border-radius: var(--pg-radius-sm);
}
@keyframes pg-skel-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.pg-skel-text { height: 12px; margin: 6px 0; }
.pg-skel-title { height: 18px; width: 40%; margin-bottom: 12px; }
.pg-skel-card { height: 96px; border-radius: var(--pg-radius-lg); }
.pg-skel-row td { padding: 12px 16px; }

.pg-state-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 24px; color: var(--pg-text-secondary); }
.pg-state-icon { width: 62px; height: 62px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 16px; background: var(--pg-bg-surface-alt); color: var(--pg-text-tertiary); }
.pg-state-panel.error .pg-state-icon { background: var(--pg-danger-bg); color: var(--pg-danger); }
.pg-state-title { font-weight: 700; color: var(--pg-text-primary); font-size: 15px; margin-bottom: 4px; }
.pg-state-desc { font-size: 13px; max-width: 420px; }

/* ---------------------------------------------------------------------- */
/* Timeline                                                                */
/* ---------------------------------------------------------------------- */
.pg-timeline { position: relative; padding-left: 26px; }
.pg-timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--pg-border); }
.pg-timeline-item { position: relative; padding-bottom: 20px; }
.pg-timeline-item:last-child { padding-bottom: 0; }
.pg-timeline-dot { position: absolute; left: -26px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--pg-bg-surface); border: 2px solid var(--pg-accent); display: flex; align-items: center; justify-content: center; }
.pg-timeline-dot.success { border-color: var(--pg-success); }
.pg-timeline-dot.danger { border-color: var(--pg-danger); }
.pg-timeline-dot.warning { border-color: var(--pg-warning); }
.pg-timeline-time { font-size: 11.5px; color: var(--pg-text-tertiary); }
.pg-timeline-title { font-size: 13.5px; font-weight: 600; margin-top: 1px; }
.pg-timeline-desc { font-size: 12.5px; color: var(--pg-text-secondary); margin-top: 2px; }

/* ---------------------------------------------------------------------- */
/* Tabs                                                                    */
/* ---------------------------------------------------------------------- */
.pg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pg-border); overflow-x: auto; }
.pg-tab {
  padding: 11px 16px; font-size: 13px; font-weight: 600; color: var(--pg-text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; transition: color var(--pg-transition-fast);
}
.pg-tab:hover { color: var(--pg-text-primary); }
.pg-tab.active { color: var(--pg-accent); border-bottom-color: var(--pg-accent); }

/* ---------------------------------------------------------------------- */
/* Dropdown menus                                                          */
/* ---------------------------------------------------------------------- */
.pg-dropdown-menu {
  background: var(--pg-bg-surface-raised); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md);
  box-shadow: var(--pg-shadow-lg); padding: 6px; min-width: 200px;
}
.pg-dropdown-menu .dropdown-item { border-radius: var(--pg-radius-sm); font-size: 13px; padding: 8px 10px; color: var(--pg-text-primary); display: flex; align-items: center; gap: 10px; }
.pg-dropdown-menu .dropdown-item:hover { background: var(--pg-bg-hover); color: var(--pg-text-primary); }
.pg-dropdown-menu .dropdown-item.danger { color: var(--pg-danger); }
.pg-dropdown-menu .dropdown-item.danger:hover { background: var(--pg-danger-bg); }
.pg-dropdown-menu .dropdown-divider { border-color: var(--pg-border-soft); margin: 6px 0; }

/* ---------------------------------------------------------------------- */
/* Notification panel                                                      */
/* ---------------------------------------------------------------------- */
.pg-notif-panel { width: 380px; max-height: 480px; overflow-y: auto; padding: 0; }
.pg-notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--pg-border-soft); cursor: pointer; }
.pg-notif-item:hover { background: var(--pg-bg-hover); }
.pg-notif-item.unread { background: var(--pg-accent-soft); }
.pg-notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pg-accent); margin-top: 5px; flex-shrink: 0; }

/* ---------------------------------------------------------------------- */
/* Theme toggle switch                                                     */
/* ---------------------------------------------------------------------- */
.pg-theme-toggle { position: relative; width: 52px; height: 28px; border-radius: 20px; background: var(--pg-bg-surface-alt); border: 1px solid var(--pg-border); cursor: pointer; }
.pg-theme-toggle .knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--pg-accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; transition: left var(--pg-transition-base); }
[data-pg-theme='dark'] .pg-theme-toggle .knob { left: 26px; }

/* ---------------------------------------------------------------------- */
/* Login flourish, brand chip, misc utility                               */
/* ---------------------------------------------------------------------- */
.pg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--pg-bg-surface-alt); border: 1px solid var(--pg-border); font-size: 12px; font-weight: 600; }
.pg-divider { height: 1px; background: var(--pg-border-soft); margin: 16px 0; border: none; }
.pg-progress-track { height: 6px; border-radius: 6px; background: var(--pg-border-soft); overflow: hidden; }
.pg-progress-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--pg-teal-400), var(--pg-teal-600)); transition: width var(--pg-transition-slow); }
.pg-progress-fill.warning { background: linear-gradient(90deg, #ffd166, var(--pg-warning)); }
.pg-progress-fill.danger { background: linear-gradient(90deg, #ff8a8a, var(--pg-danger)); }

.pg-kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pg-kv-item { padding: 12px 14px; border-radius: var(--pg-radius-md); background: var(--pg-bg-surface-alt); border: 1px solid var(--pg-border-soft); }
.pg-kv-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pg-text-tertiary); font-weight: 700; }
.pg-kv-value { font-size: 14px; font-weight: 600; margin-top: 3px; word-break: break-word; }

.pg-console {
  background: var(--pg-bg-code); border-radius: var(--pg-radius-md); color: #cdebe4; font-family: var(--pg-font-mono);
  font-size: 12.8px; padding: 14px 16px; overflow-y: auto; line-height: 1.6; border: 1px solid rgba(255,255,255,0.06);
}
.pg-console .line-err { color: #ff8a8a; }
.pg-console .line-ok { color: #7fe3c4; }
.pg-console .line-cmd { color: #79c6ff; }
.pg-console::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

.pg-device-glyph {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--pg-accent-soft); color: var(--pg-accent); font-size: 16px; flex-shrink: 0;
}

.pg-loading-overlay {
  position: fixed; inset: 0; background: rgba(10, 20, 22, 0.35); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 1090;
}
.pg-spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.25); border-top-color: var(--pg-teal-300); animation: pg-spin 0.8s linear infinite; }
@keyframes pg-spin { to { transform: rotate(360deg); } }

.pg-remote-canvas-wrap { background: #000; border-radius: var(--pg-radius-lg); overflow: hidden; position: relative; border: 1px solid var(--pg-border); }
.pg-remote-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--pg-bg-surface); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-lg) var(--pg-radius-lg) 0 0; flex-wrap: wrap; }
.pg-remote-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--pg-text-secondary); }

@media (max-width: 1024px) {
  .pg-sidebar { transform: translateX(-100%); }
  .pg-sidebar.mobile-open { transform: translateX(0); }
  .pg-main, .pg-main.sidebar-collapsed { margin-left: 0; }
  .pg-global-search { display: none; }
}

.pg-fade-in { animation: pg-fade-in 220ms ease; }
@keyframes pg-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
