/* ==========================================================================
   MonitoramentoPRO — v0.dev / Next.js / shadcn Enterprise Design System
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Surface & Background (Obsidian Dark Theme) */
  --bg-canvas: #09090b;
  --bg-subtle: #0c0c0f;
  --bg-card: rgba(18, 18, 23, 0.85);
  --bg-card-hover: rgba(24, 24, 30, 0.95);
  --bg-input: #0f0f14;
  --bg-modal: #111116;

  /* Borders (shadcn 1px subtle system) */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.09);
  --border-card-hover: rgba(255, 255, 255, 0.18);
  --border-focus: #06b6d4;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Text Colors */
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;

  /* Accent Colors (v0 / Neon Cyberpunk) */
  --cyan: #06b6d4;
  --cyan-hover: #22d3ee;
  --cyan-dim: rgba(6, 182, 212, 0.12);
  --cyan-border: rgba(6, 182, 212, 0.25);

  --emerald: #10b981;
  --emerald-dim: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.25);

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.25);

  --rose: #f43f5e;
  --rose-dim: rgba(244, 63, 94, 0.12);
  --rose-border: rgba(244, 63, 94, 0.25);

  --indigo: #6366f1;
  --purple: #a855f7;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-card-hover: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(6, 182, 212, 0.08);
  --shadow-modal: 0 24px 72px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 60px;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.06) 0%, transparent 40%),
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
  overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

::selection {
  background: rgba(6, 182, 212, 0.3);
  color: #fff;
}

/* ==========================================================================
   AUTH SCREEN (v0 Style)
   ========================================================================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-modal);
  animation: authSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-icon-lg {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #f4f4f5 0%, #a1a1aa 100%);
  color: #09090b;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.6);
}

.auth-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.auth-header h2 span {
  color: var(--cyan);
}

.auth-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-error-alert {
  background: var(--rose-dim);
  border: 1px solid var(--rose-border);
  color: #fda4af;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-footer-hint {
  text-align: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.auth-2fa-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 auto 16px;
}

.otp-input {
  letter-spacing: 14px !important;
  font-size: 1.8rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  color: var(--cyan) !important;
  padding: 12px !important;
}

/* ==========================================================================
   APP SHELL LAYOUT (v0 / Modern SaaS)
   ========================================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Mobile Topbar */
.mobile-topbar {
  display: none;
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  height: var(--topbar-height);
  padding: 0 16px;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 400;
  width: 100%;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mobile-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #f4f4f5, #71717a);
  color: #09090b;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.mobile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-mobile {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-mobile:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-card-hover);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: #09090b;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sidebar-backdrop.open {
  display: block;
}

.btn-close-sidebar-mobile {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
  transition: color 0.15s ease;
}

.btn-close-sidebar-mobile:hover {
  color: var(--text-primary);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: #f4f4f5;
  color: #09090b;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-info h1 span {
  color: var(--cyan);
}

.brand-info p {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 1px;
}

/* Nav Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.nav-item i {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item:hover i {
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
}

.nav-item.active i {
  color: var(--cyan);
}

.badge-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.nav-item.active .badge-count {
  background: var(--cyan-dim);
  color: var(--cyan);
}

/* Service Card in Sidebar */
.service-quick-card {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.service-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.status-indicator-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--rose-dim);
  color: var(--rose);
  border: 1px solid var(--rose-border);
  white-space: nowrap;
}

.status-indicator-pill.active {
  background: var(--emerald-dim);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.service-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-service {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}

.btn-service:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-card);
}

.btn-service.btn-sync:hover {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: var(--cyan-border);
}

.btn-service.btn-restart:hover {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: var(--amber-border);
}

/* ==========================================================================
   MAIN CONTENT & HEADER
   ========================================================================== */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  overflow-y: auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-title h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Live Telemetry Badge (Auto-Refresh indicator) */
.live-telemetry-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  box-sizing: border-box;
  gap: 7px;
  padding: 0 13px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald);
  font-family: var(--font-mono);
  user-select: none;
}

.live-telemetry-badge .pulse-ring {
  position: relative;
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
}

.live-telemetry-badge .pulse-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--emerald);
  opacity: 0.4;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* User Profile Menu */
.user-profile-menu {
  position: relative;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  height: 38px;
  box-sizing: border-box;
  gap: 8px;
  padding: 0 13px 0 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-card-hover);
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #f4f4f5 0%, #a1a1aa 100%);
  color: #09090b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  min-width: 0;
}

.user-name-display {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-role-badge {
  font-size: 0.65rem;
  color: var(--emerald);
  font-weight: 500;
  line-height: 1;
  margin-top: 1px;
}

.fa-chevron-down {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.user-chip.open .fa-chevron-down {
  transform: rotate(180deg);
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #111116;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  min-width: 230px;
  display: none;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
}

.profile-dropdown-menu.open {
  display: flex;
  animation: dropdownIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.dropdown-header-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dropdown-header-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropdown-item {
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.12s ease;
  width: 100%;
  font-family: var(--font-sans);
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.dropdown-item.text-danger:hover {
  background: var(--rose-dim);
  color: var(--rose);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(9, 9, 11, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-card);
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 300;
}

.bottom-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  min-width: 44px;
  font-family: var(--font-sans);
  transition: color 0.15s ease;
}

.bottom-nav-item i {
  font-size: 1.15rem;
}

.bottom-nav-item.active {
  color: #fff;
}

.bottom-nav-item.active i {
  color: var(--cyan);
}

/* ==========================================================================
   BUTTONS (v0.dev / shadcn Style)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans);
  min-height: 36px;
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Primary Button: Solid White (v0 style) */
.btn-primary {
  background: #f4f4f5;
  color: #09090b;
  border-color: #f4f4f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary Button: Subtle Dark Glass */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-card);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-card-hover);
  color: #fff;
}

.btn-success {
  background: var(--emerald-dim);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.2);
}

.btn-warning {
  background: var(--amber-dim);
  border-color: var(--amber-border);
  color: var(--amber);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-danger {
  background: var(--rose-dim);
  border-color: var(--rose-border);
  color: var(--rose);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-card);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-card-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--cyan);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  transition: opacity 0.15s ease;
  padding: 0;
}

.btn-link:hover {
  opacity: 0.8;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  min-height: 28px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 10px 20px;
  font-size: 0.92rem;
  min-height: 42px;
}

/* ==========================================================================
   CARDS & GLASSMORPHISM (v0 style)
   ========================================================================== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.panel-card {
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title i {
  font-size: 1.1rem;
  color: var(--cyan);
}

.panel-title h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Tabs Animation */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   METRIC CARDS (v0 Stats Cards)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.metric-card:hover {
  border-color: var(--border-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.metric-icon.green {
  background: var(--emerald-dim);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.metric-icon.cyan {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--cyan-border);
}

.metric-icon.purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.metric-icon.amber {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.metric-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.metric-value-sm {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

/* ==========================================================================
   TABLES (Clean Responsive - Fits 100% Screen)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 0;
}

.data-table th {
  padding: 10px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.2);
}

.data-table td {
  padding: 11px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

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

.peer-title-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  vertical-align: middle;
}

.peer-title-cell strong {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  font-size: 0.88rem;
}

/* ==========================================================================
   STATUS BADGES & PILLS
   ========================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.online {
  background: var(--emerald-dim);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.status-pill.offline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.status-pill.disabled {
  background: var(--rose-dim);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--cyan-border);
  background: var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--font-mono);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.2;
  flex-shrink: 0;
}

.badge-tag.badge-amber,
.badge-tag.text-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-tag.badge-cyan,
.badge-tag.text-cyan {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: var(--cyan-border);
}

.action-buttons-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.action-buttons-row .btn {
  padding: 5px 9px;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
  gap: 5px;
  line-height: 1.2;
  white-space: nowrap;
}

/* ==========================================================================
   SERVER SPECS (Horizontal Grid Dashboard)
   ========================================================================== */
.dashboard-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.server-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.spec-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  transition: all 0.15s ease;
}

.spec-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-card);
}

.spec-card .spec-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.spec-card .spec-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.spec-mini-badge {
  display: inline-block;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.75rem;
  color: var(--cyan);
  white-space: nowrap;
}

.highlight-port {
  color: var(--amber);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   FORMS & INPUTS (shadcn Style)
   ========================================================================== */
.custom-select,
.custom-input,
.custom-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.custom-select:focus,
.custom-input:focus,
.custom-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.custom-select {
  cursor: pointer;
}

.custom-textarea {
  resize: vertical;
  min-height: 80px;
}

.readonly-input {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  cursor: default;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.required {
  color: var(--rose);
}

.tooltip-icon {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 4px;
  cursor: help;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action .custom-input {
  flex: 1;
}

/* ==========================================================================
   DYNAMIC IP / SUBNET LIST (MikroTik / WinBox Style Multi-Input)
   ========================================================================== */
.ip-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.ip-list-row {
  display: flex;
  align-items: center;
  gap: 6px;
  animation: fadeInIpRow 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInIpRow {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ip-list-row .ip-list-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 12px;
}

.btn-remove-ip-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 38px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fb7185;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-remove-ip-row:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: #f43f5e;
  color: #fff;
  transform: scale(1.05);
}

.btn-add-ip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-add-ip-row:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   DASHBOARD RECENT PEERS (Cards Grid & Interactive Telemetry)
   ========================================================================== */
.dash-recent-peers-panel {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.dash-recent-peers-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-border), transparent);
  pointer-events: none;
}

.dash-panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-peers-quick-stats {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-emerald-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--emerald);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.dash-peers-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-filter-pills {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
}

.dash-filter-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dash-filter-pill:hover {
  color: var(--text-primary);
}

.dash-filter-pill.active {
  background: var(--cyan-dim);
  color: var(--cyan);
  border-color: var(--cyan-border);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}

.dash-peers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* Individual Dashboard Peer Card */
.dash-peer-card {
  background: linear-gradient(160deg, rgba(24, 24, 32, 0.88) 0%, rgba(14, 14, 19, 0.95) 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.dash-peer-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-card-hover);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(6, 182, 212, 0.08);
}

.dash-peer-card.is-online {
  border-color: rgba(16, 185, 129, 0.22);
}

.dash-peer-card.is-online::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3.5px;
  background: linear-gradient(180deg, var(--emerald), #059669);
  border-radius: 4px 0 0 4px;
}

.dash-peer-card.is-online:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(16, 185, 129, 0.12);
}

.dash-peer-card.is-primary::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  background: radial-gradient(circle at top right, rgba(245, 158, 11, 0.18), transparent 70%);
  pointer-events: none;
}

.dash-peer-card.is-disabled {
  opacity: 0.65;
  filter: grayscale(0.4);
}

/* Card Header: Avatar & Info */
.dash-peer-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-peer-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s ease;
}

.dash-peer-avatar.online {
  background: var(--emerald-dim);
  border-color: var(--emerald-border);
  color: var(--emerald);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.18);
}

.avatar-pulse-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--emerald);
  border: 2px solid #121217;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.dash-peer-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-peer-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-peer-name, .peer-block-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.dash-peer-sub-row, .peer-block-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.badge-amber-glow {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
  white-space: nowrap;
}

.dash-peer-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-peer-endpoint {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Network Row: IP & Subnets */
.dash-peer-network-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-peer-ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.22);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dash-peer-ip-badge:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--cyan);
  color: #fff;
  transform: translateY(-1px);
}

.dash-peer-ip-badge .copy-icon {
  font-size: 0.72rem;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

/* Card Actions (Organized 2-Row Layout) */
.dash-peer-actions-v2 {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.peer-actions-primary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.peer-actions-secondary-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.btn-outline-cyan {
  background: rgba(6, 182, 212, 0.08) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
  color: var(--cyan) !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  transition: all 0.15s ease !important;
}

.btn-outline-cyan:hover {
  background: rgba(6, 182, 212, 0.22) !important;
  border-color: var(--cyan) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3) !important;
  transform: translateY(-1px) !important;
}

.dash-peer-actions-v2 .btn {
  font-size: 0.75rem;
  padding: 6px 10px;
  min-height: 32px;
}

.dash-peer-ip-badge:hover .copy-icon {
  opacity: 1;
}

.dash-peer-lan-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.dash-peer-notes {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.03);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Telemetry Box: Handshake & Traffic */
.dash-peer-telemetry {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.telemetry-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.telemetry-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.telemetry-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

/* Traffic Meter */
.dash-peer-traffic-meter {
  height: 3px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.dash-traffic-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  transition: width 0.3s ease;
  border-radius: 99px;
}

.dash-traffic-bar-fill.active-pulse {
  background: linear-gradient(90deg, #06b6d4, #10b981, #a855f7);
  background-size: 200% 100%;
  animation: trafficShimmer 3s ease infinite;
}

@keyframes trafficShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Card Actions */
.dash-peer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.dash-peer-actions .btn {
  font-size: 0.75rem;
  padding: 5px 9px;
  min-height: 30px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Empty State */
.dash-peers-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 42px 20px;
  border: 1px dashed var(--border-card-hover);
  border-radius: var(--radius-lg);
  background: rgba(18, 18, 24, 0.4);
}

.dash-empty-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  position: relative;
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.15);
}

.dash-peers-empty h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.dash-peers-empty p {
  font-size: 0.84rem;
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.4;
}

/* ==========================================================================
   PEER CARDS (v0 High-Tech Block Cards)
   ========================================================================== */
.peers-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.peer-block-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.peer-block-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-card-hover);
}

.peer-block-card.border-online::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: var(--emerald);
  border-radius: 4px 0 0 4px;
}

.peer-block-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.peer-block-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.peer-block-avatar.online {
  background: var(--emerald-dim);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.peer-block-info {
  flex: 1;
  min-width: 0;
}

.peer-block-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.peer-block-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer-block-ip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.peer-block-note {
  font-size: 0.73rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.peer-block-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
}

.metric-mini {
  display: flex;
  flex-direction: column;
}

.metric-mini-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.metric-mini-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.peer-block-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.peer-block-actions .btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  min-height: 28px;
}

/* ==========================================================================
   CODE BLOCKS & MIKROTIK
   ========================================================================== */
.code-preview-box {
  background: #050508;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  margin: 14px 0;
  overflow: hidden;
}

.code-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

.code-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan);
}

.code-actions {
  display: flex;
  gap: 6px;
}

.code-block {
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: #38bdf8;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.mikrotik-controls-grid {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr;
  gap: 14px;
}

.steps-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.step-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
}

.step-number {
  width: 24px;
  height: 24px;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.step-text strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.step-text p {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.step-text code {
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ==========================================================================
   MODALS (v0 Bottom Sheet on Mobile, Centered on Desktop)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex !important;
  z-index: 10000 !important;
  animation: fadeIn 0.15s ease;
}

.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box.modal-lg { max-width: 740px; }
.modal-box.modal-sm { max-width: 420px; }

.modal-header {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-modal);
  z-index: 1;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title i {
  font-size: 1.1rem;
  color: var(--cyan);
}

.modal-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.modal-tab-btn {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
}

.modal-tab-btn:hover {
  color: var(--text-primary);
}

.modal-tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: var(--cyan-dim);
}

.modal-tab-pane {
  display: none;
}

.modal-tab-pane.active {
  display: block;
  animation: tabFadeIn 0.15s ease;
}

.qr-wrapper {
  background: #fff;
  padding: 12px;
  border-radius: var(--radius-md);
  display: inline-block;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  margin: 0 auto;
}

.qr-wrapper img {
  display: block;
  max-width: 220px;
  height: auto;
}

.modal-danger-icon {
  width: 48px;
  height: 48px;
  background: var(--rose-dim);
  border: 1px solid var(--rose-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--rose);
  margin: 0 auto 12px;
}

.modal-confirm-icon {
  width: 48px;
  height: 48px;
  background: var(--amber-dim);
  border: 1px solid var(--amber-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--amber);
  margin: 0 auto 12px;
}

.modal-body-center {
  text-align: center;
  padding: 24px 20px 14px;
}

.modal-body-center h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.modal-body-center p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ==========================================================================
   TOAST NOTIFICATIONS (Rich HTML/CSS System)
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20000;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 48px);
}

.toast {
  background: #111116;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
  position: relative;
  overflow: hidden;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.removing {
  animation: toastSlideOut 0.2s ease forwards;
}

@keyframes toastSlideOut {
  to { opacity: 0; transform: translateX(16px); max-height: 0; margin: 0; padding: 0; }
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastProgress 4.5s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.success .toast-progress { background: var(--emerald); }
.toast.error .toast-progress { background: var(--rose); }
.toast.warning .toast-progress { background: var(--amber); }
.toast.info .toast-progress { background: var(--cyan); }

.toast-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast.success .toast-icon { background: var(--emerald-dim); color: var(--emerald); }
.toast.error .toast-icon { background: var(--rose-dim); color: var(--rose); }
.toast.warning .toast-icon { background: var(--amber-dim); color: var(--amber); }
.toast.info .toast-icon { background: var(--cyan-dim); color: var(--cyan); }

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

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.toast-msg {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   DIAGNOSTICS & TERMINAL
   ========================================================================== */
.terminal-box {
  background: #050508;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  min-height: 110px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.ping-input-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  max-width: 440px;
}

.service-management-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.service-btns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

/* ==========================================================================
   SEARCH & FILTER
   ========================================================================== */
.search-filter-box {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: min(100%, 520px);
  max-width: 760px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 240px;
}

.search-input-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  height: 42px;
  padding: 8px 118px 8px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input-wrap input::-webkit-search-cancel-button {
  display: none;
}

.search-input-wrap input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.18);
}

.search-input-wrap input:focus + .search-clear-btn,
.search-input-wrap:focus-within > i {
  color: var(--cyan);
}

.search-clear-btn {
  position: absolute;
  right: 78px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn[hidden] {
  display: none;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.search-result-count {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 999px;
  padding: 2px 8px;
}

.search-result-count[hidden] {
  display: none;
}

.peer-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.peer-filter-pill {
  border: 1px solid var(--border-card);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.peer-filter-pill:hover {
  border-color: var(--cyan-border);
  color: var(--cyan);
}

.peer-filter-pill.active {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.45);
  color: var(--cyan);
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-danger { color: var(--rose); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-100 { width: 100%; }
.d-block { display: block; }
.d-flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.flex-2 { flex: 2; min-width: 0; }
.dashboard-split { display: flex; gap: 16px; align-items: flex-start; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 20px; }
.py-4 { padding: 16px 0; }
.max-w-4xl { max-width: 880px; }

/* ==========================================================================
   RESPONSIVE DESIGN (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1100px) {
  .dashboard-split { flex-direction: column; }
  .mikrotik-controls-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 24px 20px; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 240px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .mikrotik-controls-grid { grid-template-columns: 1fr; }
  .peers-cards-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }
  .dashboard-layout { flex-direction: column; }
  .mobile-topbar { display: flex !important; }
  .mobile-bottom-nav { display: flex !important; }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 275px !important;
    height: 100vh !important;
    transform: translateX(-100%) !important;
    box-shadow: 24px 0 72px rgba(0, 0, 0, 0.95) !important;
    z-index: 1000 !important;
  }

  .sidebar.open { transform: translateX(0) !important; }
  .btn-close-sidebar-mobile { display: block !important; }

  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 12px 88px !important;
    overflow-x: hidden !important;
  }

  .top-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    margin-bottom: 14px !important;
  }

  .header-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }

  .header-title h2 { font-size: 1.25rem !important; }
  .user-meta { display: none !important; }
  .profile-dropdown-menu { right: auto !important; left: 0 !important; min-width: 210px !important; }
  .panel-card, .glass-card { padding: 14px !important; }
  .panel-header { margin-bottom: 12px !important; }
  .metrics-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; margin-bottom: 12px !important; }
  .metric-card { padding: 12px !important; gap: 8px !important; }
  .metric-icon { width: 36px !important; height: 36px !important; font-size: 15px !important; }
  .metric-value { font-size: 1.2rem !important; }
  .metric-label { font-size: 0.68rem !important; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .service-btns-grid { grid-template-columns: 1fr 1fr !important; }
  .peers-cards-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
  .peer-block-card { padding: 12px !important; }
  .peer-block-actions { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 5px !important; }

  /* Dashboard Recent Peers Mobile Rules */
  .dash-recent-peers-panel { padding: 14px !important; }
  .dash-peers-grid { grid-template-columns: 1fr !important; gap: 10px !important; margin-top: 12px !important; }
  .dash-panel-title-group { width: 100% !important; justify-content: space-between !important; }
  .dash-peers-header-actions { width: 100% !important; justify-content: space-between !important; gap: 6px !important; }
  .dash-filter-pills { flex: 1 !important; justify-content: space-around !important; }
  .dash-peer-card { padding: 13px !important; gap: 10px !important; }
  
  /* Mobile Bottom Sheet Modal */
  .modal-backdrop.open { padding: 0 !important; align-items: flex-end !important; }
  .modal-box {
    max-height: 90vh !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .modal-header { border-radius: 0 !important; }
  .modal-body { padding: 16px 14px !important; }
  .modal-footer { padding: 12px 14px !important; }
  
  #toast-container {
    bottom: 72px !important;
    right: 10px !important;
    left: 10px !important;
    max-width: unset !important;
    width: calc(100% - 20px) !important;
  }
}

/* ==========================================================================
   AI COPILOT (Floating Trigger & Glass Drawer)
   ========================================================================== */
.btn-outline-cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--cyan);
  font-weight: 600;
  border-radius: var(--radius-full);
  height: 38px;
  box-sizing: border-box;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.82rem;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.btn-outline-cyan:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25) 0%, rgba(168, 85, 247, 0.25) 100%);
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.35);
  transform: translateY(-1px);
}

.header-actions .btn-primary {
  height: 38px;
  box-sizing: border-box;
  padding: 0 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  user-select: none;
}

/* Extra Small Action Badges and Mini Buttons */
.btn-xs {
  padding: 4px 12px;
  font-size: 0.75rem;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-full);
  box-sizing: border-box;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-xs {
  background: rgba(6, 182, 212, 0.12) !important;
  border: 1px solid rgba(6, 182, 212, 0.35) !important;
  color: var(--cyan) !important;
  padding: 3px 10px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-full) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  line-height: 1 !important;
  height: 24px !important;
  box-sizing: border-box !important;
  user-select: none !important;
  font-family: var(--font-sans) !important;
}

.btn-icon-xs:hover {
  background: rgba(6, 182, 212, 0.28) !important;
  border-color: var(--cyan) !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3) !important;
  transform: translateY(-1px) !important;
}

/* ==========================================================================
   PEER TELEMETRY & DROPS MONITORING STYLES
   ========================================================================== */

.peer-telemetry-uptime-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
}

.peer-telemetry-uptime-badge.online {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--emerald);
}

.peer-telemetry-uptime-badge.offline {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.peer-drops-telemetry-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  margin: 8px 0;
}

.drop-metric-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  text-align: center;
}

.drop-metric-pill .metric-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.drop-metric-pill .metric-val {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 1px;
}

.drop-sla-pill {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.telemetry-hero-card {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
}

.telem-status-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.telem-status-indicator.offline {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.telem-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--emerald);
}

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

.telem-status-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.telem-sla-box {
  text-align: right;
}

.telem-sla-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-mini-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.metric-mini-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-mini-number {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin: 4px 0 2px;
}

.metric-mini-sub {
  font-size: 0.65rem;
}

.telem-events-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-card);
  border-radius: 8px;
}

.nav-item-ai {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%) !important;
  border: 1px solid rgba(6, 182, 212, 0.2) !important;
  margin-top: 6px !important;
}

.nav-item-ai:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18) 0%, rgba(168, 85, 247, 0.18) 100%) !important;
  border-color: var(--cyan) !important;
}

/* Floating AI Action Button (Arrastável - Oculto quando deslogado) */
.floating-ai-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0891b2 0%, #7c3aed 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  padding: 10px 18px 10px 14px;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 8px 32px rgba(8, 145, 178, 0.4), 0 0 20px rgba(124, 58, 237, 0.3);
  z-index: 990;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  user-select: none;
}

.floating-ai-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 40px rgba(8, 145, 178, 0.6), 0 0 28px rgba(124, 58, 237, 0.45);
}

.floating-ai-btn.dragging {
  cursor: grabbing !important;
  transition: none !important;
  opacity: 0.95;
  transform: scale(1.08) !important;
  box-shadow: 0 20px 50px rgba(8, 145, 178, 0.7), 0 0 35px rgba(124, 58, 237, 0.6) !important;
}

.floating-ai-icon {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.floating-ai-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius-full);
  border: 2px solid rgba(6, 182, 212, 0.6);
  animation: floatingPulse 2.5s infinite;
  pointer-events: none;
}

@keyframes floatingPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* AI Copilot — overlay só no mobile (desktop usa janela flutuante sem bloquear a UI) */
.ai-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  pointer-events: none;
}

.ai-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Desktop: janela flutuante arrastável */
.ai-copilot-drawer {
  position: fixed;
  top: auto;
  right: 24px;
  bottom: 88px;
  left: auto;
  width: min(440px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 120px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 48px);
  background: rgba(14, 14, 18, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-card-hover);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(6, 182, 212, 0.12);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
  overflow: hidden;
  resize: both;
  min-width: 340px;
  min-height: 420px;
}

.ai-copilot-drawer.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ai-copilot-drawer.dragging-window {
  transition: none !important;
  user-select: none;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(6, 182, 212, 0.28);
}

/* Drawer Header */
.ai-drawer-header {
  padding: 14px 16px 14px 18px;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 18, 24, 0.92);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.ai-drawer-header:active {
  cursor: grabbing;
}

.ai-drag-hint {
  display: none;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar-glow {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.ai-header-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-cyan-pill {
  font-size: 0.65rem;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.ai-status-indicator {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Painel de histórico de conversas */
.ai-history-panel {
  display: none;
  flex-direction: column;
  border-bottom: 1px solid var(--border-card);
  background: rgba(10, 10, 14, 0.96);
  max-height: 42%;
  min-height: 140px;
  flex-shrink: 0;
}

.ai-history-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.ai-history-list {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-history-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.ai-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  background: rgba(255, 255, 255, 0.03);
}

.ai-history-item.current {
  border-color: rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.08);
}

.ai-history-item-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.ai-history-item-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.ai-history-item-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}

.btn-icon-sm:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-card);
  color: var(--text-primary);
}

/* Messages Container */
.ai-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Chat Messages */
.ai-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: msgFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-message.user {
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ai-message.assistant .ai-msg-avatar {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
}

.ai-message.user .ai-msg-avatar {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-card);
  color: #fff;
}

.ai-msg-content {
  max-width: 86%;
  background: rgba(22, 22, 28, 0.9);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}

.ai-message.user .ai-msg-content {
  background: linear-gradient(135deg, #0e7490 0%, #1e1b4b 100%);
  border-color: rgba(6, 182, 212, 0.35);
  color: #fff;
  border-top-right-radius: 2px;
}

.ai-message.assistant .ai-msg-content {
  border-top-left-radius: 2px;
}

.ai-msg-content p:not(:last-child) {
  margin-bottom: 8px;
}

.ai-msg-content ul, .ai-msg-content ol {
  margin: 8px 0 8px 18px;
}

.ai-msg-content li {
  margin-bottom: 4px;
}

.ai-msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.8rem;
}

.ai-msg-content th, .ai-msg-content td {
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  text-align: left;
}

.ai-msg-content th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--cyan);
}

/* Code Blocks in AI Chat */
.ai-code-block {
  position: relative;
  background: #09090c;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  margin: 10px 0;
  overflow: hidden;
}

.ai-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-ai-copy-code {
  background: transparent;
  border: none;
  color: var(--cyan);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.btn-ai-copy-code:hover {
  background: var(--cyan-dim);
  color: #fff;
}

.ai-code-content {
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #a5f3fc;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* Tool Execution Badge / Card in Chat */
.ai-tool-card {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-tool-card.success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}

.ai-tool-card.running {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}

.ai-tool-card .tool-icon {
  font-size: 14px;
}

/* Suggestions Chips */
.ai-suggestions-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.ai-suggestions-title {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ai-suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ai-chip:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan-border);
  color: var(--cyan);
  transform: translateY(-1px);
}

/* Input Area */
.ai-input-wrapper {
  padding: 14px 16px;
  border-top: 1px solid var(--border-card);
  background: rgba(18, 18, 24, 0.95);
}

.ai-chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-input-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 6px 8px 6px 12px;
  transition: all 0.15s ease;
}

.ai-input-group:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.18);
}

.ai-chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 24px;
  line-height: 1.4;
  padding: 4px 0;
}

.btn-ai-send {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--cyan);
  border: none;
  color: #09090b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-ai-send:hover:not(:disabled) {
  background: var(--cyan-hover);
  transform: scale(1.05);
}

.btn-ai-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.ai-engine-badge {
  color: var(--text-muted);
}

/* Desktop: overlay desligado — peers e dashboard ficam usáveis atrás do chat */
@media (min-width: 769px) {
  .ai-drawer-overlay,
  .ai-drawer-overlay.open {
    display: none !important;
    pointer-events: none !important;
  }

  .ai-drag-hint {
    display: inline;
  }

  .ai-header-actions,
  .ai-header-actions .btn-icon-sm {
    cursor: pointer;
  }
}

/* Mobile: drawer em tela cheia (comportamento original) */
@media (max-width: 768px) {
  .ai-copilot-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border-card-hover);
    resize: none;
    transform: translateX(100%);
    opacity: 1;
    visibility: visible;
  }

  .ai-copilot-drawer.open {
    transform: translateX(0);
  }

  .ai-drawer-header {
    cursor: default;
  }

  .ai-drag-hint {
    display: none !important;
  }

  .floating-ai-btn {
    bottom: 18px;
    right: 18px;
    padding: 8px 14px 8px 10px;
    font-size: 0.82rem;
  }

  .floating-ai-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}



/* Port Forwards */
.pf-info-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin: 0 0 18px 0;
  border-radius: 12px;
  border: 1px solid rgba(6, 182, 212, 0.28);
  background: rgba(6, 182, 212, 0.08);
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.pf-info-banner i {
  color: var(--cyan);
  margin-top: 3px;
}
.pf-info-banner code {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.pf-wan-row {
  margin-bottom: 18px;
}
.pf-wan-row label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.pf-public-link {
  color: var(--cyan);
  text-decoration: none;
}
.pf-public-link:hover {
  text-decoration: underline;
}
.table-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 768px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}
.status-indicator-pill.online {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-indicator-pill.offline {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
