/* ═══════════════════════════════════════════════════════════════
   Management Bot (ربات مدیریتی) — Mobile-Native Rich Frontend
   Designed specifically for mobile devices with native touch UX,
   responsive cards, custom controls, and glassmorphism styling.
   ═══════════════════════════════════════════════════════════════ */

/* ── Container & Global Scoping ─────────────────────────────── */
#section-mgmt-bot {
  position: relative;
  padding-bottom: calc(var(--safe-bottom, 0px) + 60px);
}

@media (min-width: 1024px) {
  #section-mgmt-bot {
    padding-bottom: 40px;
  }
}

/* ── Hero Status Card ───────────────────────────────────────── */
.mgmt-hero-card {
  background: linear-gradient(135deg, rgba(32, 31, 28, 0.96) 0%, rgba(23, 22, 20, 0.98) 100%);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius, 16px);
  padding: 18px 16px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mgmt-hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 100%;
  background: radial-gradient(circle, rgba(217, 119, 87, 0.08) 0%, transparent 65%);
  pointer-events: none;
}

.mgmt-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.mgmt-bot-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.mgmt-bot-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(217, 119, 87, 0.2) 0%, rgba(196, 104, 74, 0.3) 100%);
  border: 1.5px solid rgba(217, 119, 87, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--heading, #e6f1ff);
  box-shadow: 0 4px 16px rgba(217, 119, 87, 0.2);
}

.mgmt-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-secondary, #111827);
  background: #94a3b8;
  transition: all 0.3s ease;
}

.mgmt-status-dot.active {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: mgmtPulse 2s infinite;
}

.mgmt-status-dot.inactive {
  background: #f43f5e;
}

.mgmt-status-dot.warning {
  background: #f59e0b;
}

@keyframes mgmtPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.mgmt-hero-info {
  flex: 1;
  min-width: 0;
}

.mgmt-hero-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mgmt-hero-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgmt-hero-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.mgmt-hero-user-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent, #818cf8);
  text-decoration: none;
  background: rgba(217, 119, 87, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(217, 119, 87, 0.2);
  direction: ltr;
}

.mgmt-hero-user-link:hover, .mgmt-hero-user-link:active {
  background: rgba(217, 119, 87, 0.2);
}

.mgmt-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.mgmt-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm, 10px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light, #ccd6f6);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 38px;
}

.mgmt-hero-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.1);
}

.mgmt-hero-btn.btn-primary-action {
  background: linear-gradient(135deg, var(--accent, #818cf8) 0%, var(--accent-hover, #6366f1) 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(196, 104, 74, 0.3);
}

.mgmt-hero-btn.btn-primary-action:active {
  box-shadow: 0 2px 6px rgba(196, 104, 74, 0.2);
}

/* ── Hero Metrics Grid ──────────────────────────────────────── */
.mgmt-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 640px) {
  .mgmt-metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.mgmt-metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm, 10px);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.mgmt-metric-card:active {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(1px);
}

.mgmt-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

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

.mgmt-metric-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
  line-height: 1.2;
}

.mgmt-metric-label {
  font-size: 0.68rem;
  color: var(--muted, #8892b0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Segmented Mobile Tabs ──────────────────────────────────── */
.mgmt-tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 8px 2px;
  position: sticky;
  top: var(--topbar-h, 60px);
  z-index: 20;
  background: var(--bg, #0a0e1a);
}

.mgmt-tabs-nav::-webkit-scrollbar {
  display: none;
}

.mgmt-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-card, #1a1f35);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text, #8892b0);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.mgmt-tab-btn i {
  font-size: 0.9rem;
}

.mgmt-tab-btn:active {
  transform: scale(0.95);
}

.mgmt-tab-btn.active {
  background: linear-gradient(135deg, var(--accent, #818cf8) 0%, var(--accent-hover, #6366f1) 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(217, 119, 87, 0.3);
}

.mgmt-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f43f5e;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

.mgmt-tab-btn.active .mgmt-tab-badge {
  background: #ffffff;
  color: var(--accent-hover, #6366f1);
}

/* ── Tab Panels ─────────────────────────────────────────────── */
.mgmt-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: mgmtFadeSlide 0.25s ease-out;
}

.mgmt-tab-panel[hidden] {
  display: none !important;
}

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

/* ── Mobile Native Cards ────────────────────────────────────── */
.mgmt-card {
  background: var(--bg-card, #1a1f35);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius, 16px);
  padding: 16px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.mgmt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.mgmt-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
  margin: 0;
}

.mgmt-card-title i {
  color: var(--accent, #818cf8);
  font-size: 1.1rem;
}

.mgmt-card-subtitle {
  font-size: 0.74rem;
  color: var(--muted, #8892b0);
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Custom Mobile Form Inputs ──────────────────────────────── */
.mgmt-input-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mgmt-input-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light, #ccd6f6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mgmt-input-helper {
  font-size: 0.68rem;
  color: var(--muted, #8892b0);
  font-weight: normal;
}

.mgmt-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.mgmt-input-icon {
  position: absolute;
  right: 14px;
  color: var(--muted, #8892b0);
  font-size: 0.9rem;
  pointer-events: none;
}

.mgmt-input {
  width: 100%;
  height: 46px;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 10px);
  padding: 0 14px;
  color: var(--heading, #e6f1ff);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  outline: none;
}

.mgmt-input.has-icon-right {
  padding-right: 40px;
}

.mgmt-input.has-btn-left {
  padding-left: 85px;
}

.mgmt-input:focus {
  border-color: var(--accent, #818cf8);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
  background: rgba(13, 18, 37, 0.9);
}

.mgmt-input-btn {
  position: absolute;
  left: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(217, 119, 87, 0.12);
  border: 1px solid rgba(217, 119, 87, 0.25);
  color: var(--accent, #818cf8);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.mgmt-input-btn:active {
  transform: scale(0.95);
  background: rgba(217, 119, 87, 0.25);
}

.mgmt-select {
  width: 100%;
  height: 46px;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 10px);
  padding: 0 14px;
  color: var(--heading, #e6f1ff);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}

.mgmt-select:focus {
  border-color: var(--accent, #818cf8);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}

.mgmt-textarea {
  width: 100%;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 10px);
  padding: 12px 14px;
  color: var(--heading, #e6f1ff);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: all 0.2s ease;
}

.mgmt-textarea:focus {
  border-color: var(--accent, #818cf8);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}

/* ── Choice Cards (Segmented Radio) ─────────────────────────── */
.mgmt-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 480px) {
  .mgmt-choice-grid {
    grid-template-columns: 1fr;
  }
}

.mgmt-choice-card {
  background: var(--bg-input, #0d1225);
  border: 1.5px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 12px);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgmt-choice-card:active {
  transform: scale(0.98);
}

.mgmt-choice-card.active {
  border-color: var(--accent, #818cf8);
  background: rgba(217, 119, 87, 0.08);
  box-shadow: 0 0 0 1px var(--accent, #818cf8);
}

.mgmt-choice-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--muted, #8892b0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.mgmt-choice-card.active .mgmt-choice-radio {
  border-color: var(--accent, #818cf8);
}

.mgmt-choice-card.active .mgmt-choice-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #818cf8);
}

.mgmt-choice-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mgmt-choice-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--heading, #e6f1ff);
}

.mgmt-choice-desc {
  font-size: 0.68rem;
  color: var(--muted, #8892b0);
  line-height: 1.4;
}

/* ── Mobile Master Switch Card ──────────────────────────────── */
.mgmt-switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 12px);
  margin-bottom: 14px;
  gap: 12px;
}

.mgmt-switch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mgmt-switch-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
}

.mgmt-switch-desc {
  font-size: 0.7rem;
  color: var(--muted, #8892b0);
}

/* ── Webhook Diagnostic Hub ─────────────────────────────────── */
.mgmt-webhook-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 12px);
  padding: 14px;
  margin-bottom: 14px;
}

.mgmt-webhook-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.mgmt-webhook-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.mgmt-webhook-pill.sync {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.mgmt-webhook-pill.unsync {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.3);
}

.mgmt-webhook-pill.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.mgmt-webhook-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.mgmt-webhook-stat-item {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.72rem;
}

.mgmt-webhook-stat-item b {
  color: var(--heading, #e6f1ff);
  display: block;
  font-size: 0.85rem;
  margin-top: 2px;
}

.mgmt-webhook-alert {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 0.72rem;
  color: #fca5a5;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
}

/* ── Feature Toggles ────────────────────────────────────────── */
.mgmt-features-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mgmt-feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .mgmt-feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mgmt-feature-card {
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 12px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}

.mgmt-feature-card:active {
  border-color: rgba(217, 119, 87, 0.3);
}

.mgmt-feature-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.mgmt-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(217, 119, 87, 0.12);
  border: 1px solid rgba(217, 119, 87, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.mgmt-feature-text {
  flex: 1;
  min-width: 0;
}

.mgmt-feature-text strong {
  font-size: 0.86rem;
  color: var(--heading, #e6f1ff);
  display: block;
}

.mgmt-feature-text p {
  font-size: 0.72rem;
  color: var(--muted, #8892b0);
  line-height: 1.45;
  margin: 3px 0 0 0;
}

.mgmt-feature-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.mgmt-tool-chip {
  font-size: 0.64rem;
  font-family: ui-monospace, monospace;
  direction: ltr;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mgmt-tool-chip.monitor {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.mgmt-tool-chip.sensitive {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ── Mobile Users List ──────────────────────────────────────── */
.mgmt-users-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mgmt-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.mgmt-search-input {
  width: 100%;
  height: 42px;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 10px);
  padding: 0 38px 0 14px;
  color: var(--heading, #e6f1ff);
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s ease;
}

.mgmt-search-input:focus {
  border-color: var(--accent, #818cf8);
}

.mgmt-search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted, #8892b0);
  font-size: 0.85rem;
}

.mgmt-users-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mgmt-user-card {
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 12px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.mgmt-user-card:active {
  border-color: rgba(217, 119, 87, 0.25);
}

.mgmt-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mgmt-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mgmt-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(217, 119, 87, 0.15) 0%, rgba(196, 104, 74, 0.2) 100%);
  border: 1px solid rgba(217, 119, 87, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent, #818cf8);
  flex-shrink: 0;
}

.mgmt-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mgmt-user-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgmt-user-handle {
  font-size: 0.72rem;
  color: var(--accent, #818cf8);
  direction: ltr;
  text-align: right;
}

.mgmt-user-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.72rem;
}

.mgmt-user-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mgmt-user-detail-label {
  color: var(--muted, #8892b0);
  font-size: 0.65rem;
}

.mgmt-user-detail-val {
  color: var(--heading, #e6f1ff);
  font-weight: 600;
}

.mgmt-user-bots-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mgmt-bot-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #34d399;
}

.mgmt-bot-chip.disabled {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
  color: #fb7185;
}

.mgmt-user-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.mgmt-user-action-btn {
  flex: 1;
  min-width: 80px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text-light, #ccd6f6);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgmt-user-action-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.12);
}

.mgmt-user-action-btn.btn-danger {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
  flex: 0 0 38px;
  min-width: 38px;
}

.mgmt-user-action-btn.btn-danger:active {
  background: rgba(244, 63, 94, 0.2);
}

/* ── AI Assistant Tab ───────────────────────────────────────── */
.mgmt-presets-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.mgmt-presets-row::-webkit-scrollbar {
  display: none;
}

.mgmt-preset-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--text, #8892b0);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.mgmt-preset-chip:active {
  transform: scale(0.95);
}

.mgmt-preset-chip.active {
  background: rgba(217, 119, 87, 0.15);
  border-color: var(--accent, #818cf8);
  color: var(--accent, #818cf8);
}

.mgmt-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mgmt-model-chip {
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  direction: ltr;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-light, #ccd6f6);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mgmt-model-chip:hover, .mgmt-model-chip:active {
  background: rgba(217, 119, 87, 0.15);
  border-color: rgba(217, 119, 87, 0.3);
  color: var(--accent, #818cf8);
}

.mgmt-token-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mgmt-range-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input, #0d1225);
  outline: none;
  accent-color: var(--accent, #818cf8);
}

.mgmt-range-val {
  min-width: 50px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent, #818cf8);
  background: rgba(217, 119, 87, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
}

/* ── Activity Logs & Approvals ──────────────────────────────── */
.mgmt-approvals-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.mgmt-approval-card {
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm, 12px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mgmt-approval-card.resolved {
  background: var(--bg-input, #0d1225);
  border-color: var(--border, rgba(255, 255, 255, 0.08));
}

.mgmt-approval-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mgmt-approval-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--heading, #e6f1ff);
}

.mgmt-approval-summary {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.72rem;
  color: var(--text-light, #ccd6f6);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: left;
}

.mgmt-approval-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mgmt-approval-btn {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgmt-approval-btn:active {
  transform: scale(0.96);
}

.mgmt-approval-btn.approve {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.mgmt-approval-btn.reject {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.mgmt-logs-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mgmt-log-item {
  background: var(--bg-input, #0d1225);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s ease;
}

.mgmt-log-icon {
  font-size: 1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.mgmt-log-body {
  flex: 1;
  min-width: 0;
}

.mgmt-log-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mgmt-log-action {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--heading, #e6f1ff);
}

.mgmt-log-time {
  font-size: 0.65rem;
  color: var(--muted, #8892b0);
}

.mgmt-log-details {
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--muted, #8892b0);
  line-height: 1.4;
  direction: ltr;
  text-align: left;
  word-break: break-all;
}

/* ── Mobile Floating Save Action Bar ────────────────────────── */
.mgmt-mobile-save-bar {
  position: fixed;
  bottom: calc(var(--bottom-nav-h, 64px) + var(--safe-bottom, 0px));
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 95;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  animation: mgmtSlideUpBar 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1024px) {
  .mgmt-mobile-save-bar {
    right: var(--sidebar-w, 260px);
    bottom: 0;
    padding-bottom: max(12px, var(--safe-bottom, 0px));
  }
}

@keyframes mgmtSlideUpBar {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mgmt-mobile-save-btn {
  flex: 1;
  height: 46px;
  border-radius: var(--radius-sm, 12px);
  background: linear-gradient(135deg, var(--accent, #818cf8) 0%, var(--accent-hover, #6366f1) 100%);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(196, 104, 74, 0.35);
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgmt-mobile-save-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(196, 104, 74, 0.25);
}

.mgmt-mobile-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Modal Enhancements for Mobile ──────────────────────────── */
.mgmt-modal-sheet .modal-content {
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .mgmt-modal-sheet .modal-content {
    border-radius: var(--radius, 16px);
    max-height: 90vh;
  }
}

.mgmt-chip-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.mgmt-counter-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgmt-counter-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  color: var(--heading, #e6f1ff);
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mgmt-counter-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════
   LIGHT THEME OVERRIDES (Anthropic Warm Ivory)
   ═══════════════════════════════════════════ */
html[data-theme="light"] #section-mgmt-bot {
  color: var(--text);
}

html[data-theme="light"] .mgmt-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f7f6f0 100%);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

html[data-theme="light"] .mgmt-hero-card::before {
  background: radial-gradient(circle, rgba(204, 120, 92, 0.1) 0%, transparent 65%);
}

html[data-theme="light"] .mgmt-bot-avatar {
  background: linear-gradient(135deg, rgba(204, 120, 92, 0.15) 0%, rgba(204, 120, 92, 0.25) 100%);
  border-color: rgba(204, 120, 92, 0.35);
  color: var(--heading);
}

html[data-theme="light"] .mgmt-status-dot {
  border-color: var(--bg-secondary);
}

html[data-theme="light"] .mgmt-hero-btn {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-light);
}

html[data-theme="light"] .mgmt-hero-btn:hover {
  background: var(--bg-card-hover);
  color: var(--heading);
}

html[data-theme="light"] .mgmt-hero-btn.btn-primary-action {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
}

html[data-theme="light"] .mgmt-tabs-nav {
  background: var(--bg);
}

html[data-theme="light"] .mgmt-tab-btn {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="light"] .mgmt-tab-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
}

html[data-theme="light"] .mgmt-card,
html[data-theme="light"] .mgmt-switch-card,
html[data-theme="light"] .mgmt-metric-card,
html[data-theme="light"] .mgmt-feature-card,
html[data-theme="light"] .mgmt-user-card,
html[data-theme="light"] .mgmt-approval-card {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

html[data-theme="light"] .mgmt-choice-card {
  background: var(--bg-input);
  border-color: var(--border);
}

html[data-theme="light"] .mgmt-choice-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

html[data-theme="light"] .mgmt-input,
html[data-theme="light"] .mgmt-select,
html[data-theme="light"] .mgmt-textarea,
html[data-theme="light"] .mgmt-search-input {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--heading);
}

html[data-theme="light"] .mgmt-input:focus,
html[data-theme="light"] .mgmt-select:focus,
html[data-theme="light"] .mgmt-textarea:focus {
  background: #ffffff;
  border-color: var(--accent);
}

html[data-theme="light"] .mgmt-preset-chip,
html[data-theme="light"] .mgmt-model-chip,
html[data-theme="light"] .mgmt-bot-chip,
html[data-theme="light"] .mgmt-tool-chip {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="light"] .mgmt-counter-btn {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--heading);
}

html[data-theme="light"] .mgmt-webhook-box {
  background: var(--bg-secondary);
  border-color: var(--border);
}

html[data-theme="light"] .mgmt-user-avatar {
  background: linear-gradient(135deg, rgba(204, 120, 92, 0.15) 0%, rgba(204, 120, 92, 0.25) 100%);
  color: var(--accent);
  border-color: rgba(204, 120, 92, 0.3);
}

html[data-theme="light"] .mgmt-user-action-btn {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-light);
}

html[data-theme="light"] .mgmt-user-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--heading);
}

html[data-theme="light"] .mgmt-log-item {
  border-color: var(--border-subtle);
}

html[data-theme="light"] .mgmt-log-details {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text);
}