:root {
  /* Background */
  --bg-primary: #030712;
  --bg-secondary: #0b0f19;
  --bg-tertiary: #111827;
  --bg-elevated: #151b2b;
  --bg-hover: #1a2133;
  --bg-active: #1e293b;

  /* Borders */
  --border-subtle: rgba(148, 163, 184, 0.08);
  --border-default: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.18);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;
  --text-inverse: #020617;

  /* Brand */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  /* Status */
  --status-online: #10b981;
  --status-online-soft: rgba(16, 185, 129, 0.12);
  --status-warning: #f59e0b;
  --status-warning-soft: rgba(245, 158, 11, 0.12);
  --status-critical: #ef4444;
  --status-critical-soft: rgba(239, 68, 68, 0.12);
  --status-offline: #64748b;
  --status-offline-soft: rgba(100, 116, 139, 0.12);
  --status-maintenance: #8b5cf6;
  --status-maintenance-soft: rgba(139, 92, 246, 0.12);

  /* Charts */
  --chart-latency: #6366f1;
  --chart-download: #10b981;
  --chart-upload: #f59e0b;
  --chart-packetloss: #ef4444;
  --chart-p50: #22d3ee;
  --chart-p95: #f59e0b;
  --chart-p99: #ef4444;
  --chart-cpu: #6366f1;
  --chart-ram: #f59e0b;
  --chart-disk: #ec4899;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-glow-online: 0 0 12px rgba(16, 185, 129, 0.25);
  --shadow-glow-warning: 0 0 12px rgba(245, 158, 11, 0.25);
  --shadow-glow-critical: 0 0 12px rgba(239, 68, 68, 0.25);

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 180ms ease;
  --transition-slow: 260ms ease;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* Layout shell */
.monitoring-app {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Sidebar */
.monitoring-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width var(--transition-slow), transform var(--transition-slow);
}

.monitoring-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border-default);
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.monitoring-sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: var(--space-6);
}

.sidebar-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.monitoring-sidebar.collapsed .sidebar-section-title {
  opacity: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all var(--transition-fast);
  margin-bottom: var(--space-1);
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--bg-active);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  background: var(--brand-500);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar-link {
  position: relative;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-link.active .sidebar-icon {
  opacity: 1;
  color: var(--brand-400);
}

.sidebar-label {
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.monitoring-sidebar.collapsed .sidebar-label {
  opacity: 0;
  pointer-events: none;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border-default);
}

.sidebar-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Main content */
.monitoring-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

.monitoring-sidebar.collapsed ~ .monitoring-main {
  margin-left: var(--sidebar-collapsed);
}

/* Topbar */
.monitoring-topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  color: var(--text-primary);
}

.topbar-btn .badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--status-critical);
  box-shadow: 0 0 0 2px var(--bg-secondary);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--status-online-soft);
  color: var(--status-online);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--status-online);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Content area */
.monitoring-content {
  flex: 1;
  padding: var(--space-6);
  overflow-x: hidden;
}

/* Page header */
.page-header {
  margin-bottom: var(--space-4);
}

.page-header h1 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.page-header p {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  min-height: 48px;
}

.card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.card-body {
  padding: var(--space-4);
}

.card.compact .card-header {
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
}

.card.compact .card-body {
  padding: var(--space-3);
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition-fast);
}

.kpi-card:hover {
  border-color: var(--border-strong);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.kpi-icon {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.kpi-change {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
}

.kpi-change.positive {
  color: var(--status-online);
  background: var(--status-online-soft);
}

.kpi-change.negative {
  color: var(--status-critical);
  background: var(--status-critical-soft);
}

.kpi-change.neutral {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.kpi-sparkline {
  width: 60px;
  height: 24px;
}

/* Charts */
.chart-container {
  position: relative;
  width: 100%;
  height: 200px;
}

.chart-container.small {
  height: 150px;
}

.chart-grid {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.chart-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.chart-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 1600px) {
  .chart-container {
    height: 240px;
  }
  .chart-container.small {
    height: 170px;
  }
}

/* Tabs / time range */
.segmented-control {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
}

.segmented-control button {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.segmented-control button:hover {
  color: var(--text-primary);
}

.segmented-control button.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-strong);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.table-scroll {
  max-height: 180px;
  overflow-y: auto;
}

.table-responsive {
  overflow-x: auto;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid transparent;
}

.status-badge.online {
  color: var(--status-online);
  background: var(--status-online-soft);
  border-color: rgba(16, 185, 129, 0.2);
}

.status-badge.warning {
  color: var(--status-warning);
  background: var(--status-warning-soft);
  border-color: rgba(245, 158, 11, 0.2);
}

.status-badge.critical {
  color: var(--status-critical);
  background: var(--status-critical-soft);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge.offline {
  color: var(--status-offline);
  background: var(--status-offline-soft);
  border-color: rgba(100, 116, 139, 0.2);
}

.status-badge.maintenance {
  color: var(--status-maintenance);
  background: var(--status-maintenance-soft);
  border-color: rgba(139, 92, 246, 0.2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.status-dot.online {
  background: var(--status-online);
  box-shadow: var(--shadow-glow-online);
}

.status-dot.warning {
  background: var(--status-warning);
  box-shadow: var(--shadow-glow-warning);
}

.status-dot.critical {
  background: var(--status-critical);
  box-shadow: var(--shadow-glow-critical);
}

.status-dot.offline {
  background: var(--status-offline);
}

.status-dot.maintenance {
  background: var(--status-maintenance);
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 3px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  transition: transform var(--transition-fast);
}

.heatmap-cell:hover {
  transform: scale(1.15);
}

.heatmap-cell.level-0 { background: #0f291e; }
.heatmap-cell.level-1 { background: #14522d; }
.heatmap-cell.level-2 { background: #166534; }
.heatmap-cell.level-3 { background: #15803d; }
.heatmap-cell.level-4 { background: #22c55e; }

/* Alerts */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 150px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.alert-item:hover {
  border-color: var(--border-strong);
}

.alert-item.critical {
  border-left: 3px solid var(--status-critical);
}

.alert-item.warning {
  border-left: 3px solid var(--status-warning);
}

.alert-item.resolved {
  border-left: 3px solid var(--status-online);
  opacity: 0.7;
}

.alert-severity {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  margin-top: var(--space-1);
  flex-shrink: 0;
}

.alert-severity.critical { background: var(--status-critical); }
.alert-severity.warning { background: var(--status-warning); }
.alert-severity.resolved { background: var(--status-online); }

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.alert-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Server detail */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-default);
}

.detail-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.detail-title h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
}

.detail-meta {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.metric-item-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.metric-item-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.metric-item-value.small {
  font-size: var(--text-lg);
}

/* Loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: skeleton 1.5s infinite;
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand-600);
  color: var(--text-primary);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--status-critical-soft);
  color: var(--status-critical);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Payment presets */
.pay-preset {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.pay-preset:hover,
.pay-preset.active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: var(--text-primary);
}

/* Tab sections */
.section {
  display: none;
}

.section.active {
  display: block;
}

/* QR modal */
.qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.qr-modal.open {
  display: flex;
}

.qr-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
}

.qr-box img {
  width: min(220px, 70vw);
  height: auto;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  color: var(--text-tertiary);
  text-align: center;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* Responsive */
@media (max-width: 1600px) {
  .chart-container {
    height: 220px;
  }
  .chart-container.small {
    height: 160px;
  }
}

@media (max-width: 1440px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .chart-grid.two-col,
  .chart-grid.three-col {
    grid-template-columns: 1fr;
  }
  .chart-container {
    height: 200px;
  }
  .chart-container.small {
    height: 150px;
  }
}

@media (max-width: 1024px) {
  .monitoring-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: none;
  }
  .monitoring-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  }
  .monitoring-main {
    margin-left: 0;
  }
  .monitoring-sidebar.collapsed ~ .monitoring-main {
    margin-left: 0;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chart-container {
    height: 240px;
  }
  #server-map {
    height: 380px;
  }
  .cabinet-server-map {
    height: 260px;
  }
}

@media (max-width: 768px) {
  .monitoring-content {
    padding: var(--space-4);
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .data-table {
    font-size: var(--text-xs);
  }
  .data-table th,
  .data-table td {
    padding: var(--space-2) var(--space-3);
  }
  .chart-container,
  .chart-container.small {
    height: 220px;
  }
  .page-header h1 {
    font-size: var(--text-xl);
  }
  .card-header {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  .segmented-control {
    width: 100%;
  }
  #server-map {
    height: 280px;
  }
  .cabinet-server-map {
    height: 220px;
  }
}

@media (max-width: 480px) {
  .monitoring-content {
    padding: var(--space-3);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Server map */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.leaflet-container {
  background: var(--bg-tertiary) !important;
  isolation: isolate;
  z-index: 1;
}
#server-map {
  width: 100%;
  height: 500px;
  background: var(--bg-tertiary);
}
.cabinet-server-map {
  width: 100%;
  height: 320px;
  background: var(--bg-tertiary);
}
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.78) contrast(1.35) saturate(0.55);
}
.server-map-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.server-map-marker .map-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  border: 2px solid #0b0f19;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4), 0 0 16px rgba(99, 102, 241, 0.6);
  z-index: 2;
}
.server-map-marker.offline .map-dot {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4), 0 0 16px rgba(239, 68, 68, 0.6);
}
.server-map-marker .map-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6366f1;
  opacity: 0.55;
  z-index: 1;
  animation: map-pulse 2.2s ease-out infinite;
}
.server-map-marker.offline .map-pulse {
  background: #ef4444;
}
.server-map-marker .map-label {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(21, 27, 43, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.server-map-marker.offline .map-label {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}
@keyframes map-pulse {
  0% { width: 14px; height: 14px; opacity: 0.55; }
  100% { width: 42px; height: 42px; opacity: 0; }
}
.server-map-tooltip {
  background: #151b2b !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  border-radius: 8px !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  font-family: inherit !important;
}
.server-map-tooltip:before {
  border-top-color: rgba(148, 163, 184, 0.15) !important;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #151b2b !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
}

/* Public top nav */
.public-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
  z-index: 50;
}
.public-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  gap: var(--space-4);
}
.public-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  flex-shrink: 0;
}
.public-nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  object-fit: cover;
}
.public-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.public-nav-links a:not(.btn) {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}
.public-nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
}
@media (max-width: 768px) {
  .public-nav-toggle {
    display: flex;
  }
  .public-nav-links {
    display: none;
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
    padding: var(--space-2) 0;
  }
  .public-nav.open .public-nav-links {
    display: flex;
  }
  .public-nav-links a {
    padding: var(--space-3) var(--space-6);
  }
  .public-nav-links .btn {
    margin: var(--space-2) var(--space-6) var(--space-3);
    justify-content: center;
  }
}
