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

:root {
  --bg: #04060a;
  --bg-elevated: #0b0f19;
  --surface: rgba(11, 15, 25, 0.68);
  --border: rgba(99, 102, 241, 0.15);
  --border-focus: rgba(59, 130, 246, 0.6);
  --text: #f1f5f9;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-bright: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Dynamic background neon radial glow */
.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(37, 99, 235, 0.12), transparent 60%),
    radial-gradient(ellipse 40% 30% at 85% 85%, rgba(99, 102, 241, 0.06), transparent),
    radial-gradient(ellipse 35% 25% at 15% 65%, rgba(16, 185, 129, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Interactive custom switch */
.custom-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.custom-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--muted);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}
.custom-switch input:checked + .switch-slider {
  background-color: rgba(37, 99, 235, 0.25);
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.custom-switch input:checked + .switch-slider:before {
  transform: translateX(20px);
  background-color: var(--accent-bright);
}
.custom-switch input:disabled + .switch-slider {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Brand logo styling */
.logo-corner {
  position: fixed;
  top: 1.5rem;
  left: 1.75rem;
  z-index: 10;
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 44px;
  height: auto;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.logo-corner:hover .brand-mark {
  transform: translateY(-2px) scale(1.05);
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

/* Authentication Page */
.auth-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1.5rem;
}
.auth-form--centered {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 2.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 64px rgba(0, 0, 0, 0.6);
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.auth-form label span {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}
.auth-form input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: rgba(0, 0, 0, 0.45);
}

/* Premium Primary Button */
.btn-login {
  width: 100%;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.btn-login:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow:
    0 0 20px rgba(59, 130, 246, 0.3),
    0 6px 20px rgba(37, 99, 235, 0.45);
}
.btn-login:active {
  transform: translateY(0);
}
.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Premium Ghost Button */
.btn-ghost {
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-focus);
}
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Landing wrap */
.landing-wrap {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 6rem 1.5rem 4rem;
}
.hero {
  text-align: center;
  margin-bottom: 4rem;
  padding: 3.5rem 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

/* Top bar shell */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 12, 0.85);
  backdrop-filter: blur(16px);
}
.brand.compact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: #fff;
}
.brand.compact .brand-mark {
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.user-pill {
  font-size: 0.8rem;
  color: var(--accent-bright);
  padding: 0.35rem 0.85rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 99px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-weight: 500;
}

/* Main app grid shell */
.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: calc(100vh - 65px);
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 1.5rem 0.75rem;
  border-right: 1px solid var(--border);
  background: rgba(6, 8, 12, 0.55);
  backdrop-filter: blur(12px);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}
.sidebar-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}
.sidebar-item.is-active {
  color: #fff;
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--border-focus);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
}
.sidebar-icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-label {
  font-weight: 500;
}

.dashboard-main {
  flex: 1;
  padding: 2.25rem 2.5rem 4rem;
  overflow-y: auto;
}
.panel-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}
.panel-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

/* Tool list grid layout */
.tool-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 768px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1200px) {
  .tool-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tool-card:hover {
  background: rgba(18, 24, 38, 0.8);
  border-color: var(--border-focus);
  transform: translateY(-3px);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(59, 130, 246, 0.15);
}
.tool-icon {
  font-size: 1.85rem;
  flex-shrink: 0;
}
.tool-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tool-body strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}
.tool-body span:last-child {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.tool-arrow {
  color: var(--muted);
  font-size: 1.25rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.tool-card:hover .tool-arrow {
  color: var(--accent-bright);
  transform: translateX(4px);
}

/* System metrics board */
.metrics-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}
@media (min-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.25s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(59, 130, 246, 0.1);
}
.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.85rem;
}
.metric-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  font-feature-settings: "tnum";
}
.metric-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.02);
}
.metric-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
#metric-cpu .metric-bar-fill {
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
}
#metric-ram .metric-bar-fill {
  background: linear-gradient(90deg, #8b5cf6 0%, #c084fc 100%);
}
#metric-disk .metric-bar-fill {
  background: linear-gradient(90deg, #0d9488 0%, #2dd4bf 100%);
}
.metric-footer {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Service status items */
.status-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.status-item:hover {
  background: rgba(18, 24, 38, 0.7);
  border-color: var(--border-focus);
}
.status-name-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.status-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}
.status-port {
  font-size: 0.75rem;
  color: var(--muted);
}
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.3s ease;
}
.status-led.online {
  background-color: var(--success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.75);
}
.status-led.offline {
  background-color: var(--error);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.75);
}

/* Bot specific cards */
.bot-card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.bot-card:hover {
  border-color: var(--border-focus) !important;
  transform: translateY(-4px);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(59, 130, 246, 0.15) !important;
}

/* Split Pane layouts for roles config */
.permissions-split-container {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}
@media (max-width: 900px) {
  .permissions-split-container {
    flex-direction: column;
    gap: 1.5rem;
  }
}
.permissions-role-selector {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .permissions-role-selector {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
}
.role-select-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 900px) {
  .role-select-item {
    flex-shrink: 0;
    width: auto;
  }
}
.role-select-item:hover {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--text);
  transform: translateX(4px);
}
@media (max-width: 900px) {
  .role-select-item:hover {
    transform: translateY(-2px);
  }
}
.role-select-item.is-active {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--border-focus);
  color: #fff;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}
.role-icon {
  font-size: 1.35rem;
}
.role-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.role-text strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.role-text span {
  font-size: 0.7rem;
  color: var(--muted);
}

.permissions-settings-pane {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Modals styling overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.modal-content {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 64px rgba(0, 0, 0, 0.7) !important;
}

/* General Layout helpers */
.tool-panel {
  animation: pageFadeIn 0.35s ease;
}
.tool-panel[hidden] {
  display: none !important;
}
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   TOPBAR: Icon button, Avatar chip, User dropdown
   ===================================================== */
.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: #fff;
}
.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.topbar-icon-btn:hover {
  color: var(--accent-bright);
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}
.topbar-icon-btn svg {
  transition: transform 0.35s ease;
}
.topbar-icon-btn:hover svg {
  transform: rotate(30deg);
}

/* User avatar button */
.user-menu-wrap {
  position: relative;
}
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.user-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}
.avatar-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.topbar-username {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text);
}
.chevron-icon {
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.user-avatar-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

/* User dropdown menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: rgba(10, 14, 26, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 14px;
  padding: 0.5rem;
  z-index: 500;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 60px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(37, 99, 235, 0.08);
  backdrop-filter: blur(24px);
  animation: dropdownIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.user-dropdown[hidden] { display: none; }

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
}
.user-dropdown-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.user-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.user-dropdown-info strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-info span {
  font-size: 0.72rem;
  color: var(--muted);
}
.user-dropdown-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0.25rem 0;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.user-dropdown-item--danger {
  color: var(--error);
}
.user-dropdown-item--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
}

/* =====================================================
   SIDEBAR: Search, Groups, Separator
   ===================================================== */
.sidebar-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.sidebar-search-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.sidebar-search-icon-svg {
  color: var(--muted);
  flex-shrink: 0;
}
.sidebar-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}
.sidebar-search-input::placeholder {
  color: var(--muted);
}
.sidebar-group-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.5rem 0.75rem 0.25rem;
  margin-bottom: 0.25rem;
}
.sidebar-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0.85rem 0.5rem;
}

/* =====================================================
   ADMIN TABS & PANELS (IN-LINE VIEW)
   ===================================================== */
.admin-tab-btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.admin-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.admin-tab-btn.is-active {
  color: var(--accent-bright);
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

/* Tab panes styling */
.admin-tab-pane {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}
.admin-tab-pane.is-active {
  display: flex;
}
.admin-section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* =====================================================
   USERS TABLE: Filter bar + clean table
   ===================================================== */
.users-filter-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-pill:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}
.filter-pill.is-active {
  color: var(--accent-bright);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}
.users-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
.users-table thead tr {
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.users-table th {
  padding: 0.8rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.users-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}
.users-table tbody tr:last-child {
  border-bottom: none;
}
.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
.users-table td {
  padding: 0.85rem 1rem;
  color: var(--text);
  vertical-align: middle;
}
.table-loading {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem !important;
}

/* =====================================================
   TOAST NOTIFICATIONS (top-right)
   ===================================================== */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(10, 14, 26, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  min-width: 260px;
}
.toast.toast--visible {
  opacity: 1;
  transform: translateX(0);
}
.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.toast-msg {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}
.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.toast-close:hover { color: var(--text); }
.toast--success { border-left: 3px solid var(--success); }
.toast--error   { border-left: 3px solid var(--error); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--info    { border-left: 3px solid var(--accent-bright); }

/* Admin panel in-page tabs and body */
.admin-panel-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}
.admin-panel-body {
  display: flex;
  flex-direction: column;
}

/* =====================================================
   FIELD INPUT utility
   ===================================================== */
.field-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .sidebar-item {
    flex-shrink: 0;
    width: auto;
    padding: 0.6rem 1rem;
  }
  .dashboard-main {
    padding: 1.5rem 1.25rem 3rem;
  }
}

/* =====================================================
   INTEGRATIONS MANAGER & CUSTOM MODALS
   ===================================================== */
.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.8);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.custom-modal-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  display: flex !important;
}
.custom-modal-content {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 64px rgba(0, 0, 0, 0.7) !important;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}
.custom-modal-backdrop:not([hidden]) .custom-modal-content {
  transform: translateY(0);
}
.custom-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.custom-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.75rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}
.custom-modal-close:hover {
  color: var(--text);
}
.custom-modal-body {
  padding: 1.5rem;
}
.integration-modal-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.25rem;
}

/* Password field wrapper with toggle */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-toggle-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle-btn:hover {
  color: var(--accent-bright);
}

/* Integration Grid and status styles */
.integration-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.integration-status-badge.connected {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.integration-status-badge.disconnected {
  background: rgba(156, 163, 175, 0.1);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

/* Premium Code Editor Styles */
.editor-tabs-container {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
}

.editor-tab-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  padding: 0.6rem 1.2rem;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  outline: none;
}

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

.editor-tab-btn.is-active {
  color: var(--accent-bright);
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--border-focus);
  border-bottom: 2px solid var(--accent-bright);
  box-shadow: 0 -2px 10px rgba(59, 130, 246, 0.1);
}

.editor-textarea {
  width: 100%;
  height: 480px;
  background: #030508 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius);
  color: #a78bfa !important;
  font-family: 'Fira Code', 'Courier New', Courier, monospace !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
  padding: 1.25rem !important;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.editor-textarea:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.8),
    0 0 15px rgba(59, 130, 246, 0.2) !important;
}

.editor-textarea[readonly] {
  color: #818cf8 !important;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}



