/* ═══════════════════════════════════════════════════════
   SafeList — Premium Design System
   Black & White Monochrome UI
   ═══════════════════════════════════════════════════════ */

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

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:           #000000;
  --bg-surface:   rgba(10, 10, 10, 0.8);
  --bg-card:      rgba(13, 13, 13, 0.7);
  --bg-hover:     #141414;
  --bg-active:    #1a1a1a;
  --bg-input:     #111111;

  --border:       #1c1c1c;
  --border-md:    #242424;
  --border-light: #2e2e2e;

  --text-primary: #ffffff;
  --text-secondary:#999999;
  --text-muted:   #555555;
  --text-dim:     #333333;

  --accent:       #ffffff;
  --accent-dim:   rgba(255,255,255,0.08);
  --accent-hover: rgba(255,255,255,0.12);

  --green:        #22c55e;
  --green-dim:    rgba(34,197,94,0.12);
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,0.12);
  --amber:        #f59e0b;
  --amber-dim:    rgba(245,158,11,0.12);
  --blue:         #3b82f6;

  --sidebar-w:    220px;
  --topbar-h:     56px;
  --radius:       6px;
  --radius-sm:    4px;
  --radius-lg:    10px;
  --transition:   0.15s ease;
}

/* ─── Light Theme Variables ─────────────────────────────── */
[data-theme="light"] {
  --bg:           #f4f5f7;
  --bg-surface:   rgba(255, 255, 255, 0.8);
  --bg-card:      rgba(255, 255, 255, 0.7);
  --bg-hover:     #f0f1f4;
  --bg-active:    #e5e7eb;
  --bg-input:     #ffffff;

  --border:       #e5e7eb;
  --border-md:    #d1d5db;
  --border-light: #f3f4f6;

  --text-primary: #111827;
  --text-secondary:#4b5563;
  --text-muted:   #6b7280;
  --text-dim:     #9ca3af;

  --accent:       #000000;
  --accent-dim:   rgba(0,0,0,0.05);
  --accent-hover: rgba(0,0,0,0.1);
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 60% at 50% -10%, rgba(255,255,255,0.03) 0%, transparent 60%);
}

.login-card {
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--text-primary);
  color: var(--bg);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.login-logo h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus { border-color: var(--border-light); }

.login-error {
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-header {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon-sm {
  width: 28px;
  height: 28px;
  background: var(--text-primary);
  color: var(--bg);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 13px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-active);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--text-primary);
  border-radius: 1px;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 4px;
}
.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.mobile-menu-btn {
  display: none;
  padding: 4px;
  color: var(--text-secondary);
}

/* ─── Bot Selector Dropdown ─────────────────────────────── */
.bot-selector {
  position: relative;
}

.bot-selector-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 180px;
  max-width: 240px;
}
.bot-selector-trigger:hover { border-color: var(--border-light); background: var(--bg-hover); }
.bot-selector-trigger.open { border-color: var(--border-light); }

.bot-selector-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition);
}
.bot-selector-indicator.online {
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-dim);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 2px var(--green-dim); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0.06); }
}

.bot-selector-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bot-selector-username {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.bot-selector-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.bot-selector-trigger.open .bot-selector-chevron { transform: rotate(180deg); }

/* Dropdown Panel */
.bot-selector-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.4);
  z-index: 500;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
}
.bot-selector-dropdown.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.bot-selector-list {
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.bot-selector-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.bot-selector-item:hover { background: var(--bg-hover); }
.bot-selector-item.selected { background: var(--bg-active); }

.bot-item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.bot-item-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-dim);
}
.bot-item-info { flex: 1; min-width: 0; }
.bot-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bot-selector-item.selected .bot-item-name { font-weight: 600; }
.bot-item-username {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.bot-item-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-primary);
  opacity: 0;
}
.bot-selector-item.selected .bot-item-check { opacity: 1; }

.bot-selector-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

.bot-selector-actions {
  padding: 6px;
}
.bot-selector-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  width: 100%;
}
.bot-selector-action:hover { background: var(--bg-hover); color: var(--text-primary); }

/* No bot state */
.no-bot-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  transition: all var(--transition);
}
.no-bot-trigger:hover { background: rgba(239,68,68,0.18); }

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Page Loading ───────────────────────────────────────── */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-md);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════ */

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  font-family: inherit;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}
.btn-primary:hover:not(:disabled) { background: #e5e5e5; border-color: #e5e5e5; }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-md);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.18); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.card-sm { padding: 14px 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  padding: 18px 20px;
  position: relative;
}
.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-dim);
}
.stat-accent.green { background: var(--green); }
.stat-accent.amber { background: var(--amber); }
.stat-accent.blue { background: var(--blue); }
.stat-accent.white { background: var(--text-primary); }

/* ─── Table ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td {
  padding: 11px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}
.td-muted { color: var(--text-secondary) !important; font-size: 12px; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
.badge-green { color: var(--green); border-color: rgba(34,197,94,0.25); background: var(--green-dim); }
.badge-red { color: var(--red); border-color: rgba(239,68,68,0.25); background: var(--red-dim); }
.badge-amber { color: var(--amber); border-color: rgba(245,158,11,0.25); background: var(--amber-dim); }
.badge-gray { color: var(--text-muted); border-color: var(--border-md); background: var(--bg-hover); }
.badge-white { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-active); }
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar-wrap {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.progress-bar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.progress-bar-track {
  height: 4px;
  background: var(--bg-active);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--text-primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.progress-bar-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-light);
}
.form-input::placeholder { color: var(--text-dim); }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle input { display: none; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-track {
  background: var(--text-primary);
  border-color: var(--text-primary);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-track::after {
  left: calc(100% - 16px);
  background: var(--bg);
}
.toggle-label { font-size: 13px; font-weight: 500; cursor: pointer; }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  cursor: pointer;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--text-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state p { font-size: 13px; max-width: 280px; }

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.page-header-left h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.page-header-left p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ─── Section Titles ─────────────────────────────────────── */
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.section-title-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 14px;
  margin-top: -8px;
}

/* ─── Search Bar ─────────────────────────────────────────── */
.search-bar {
  position: relative;
  width: 240px;
}
.search-bar svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px 7px 32px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.search-bar input:focus { border-color: var(--border-light); }

/* ─── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
}
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: all var(--transition);
  cursor: pointer;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ─── Toast ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  min-width: 200px;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.toast-success::before { background: var(--green); }
.toast-error::before { background: var(--red); }
.toast-info::before { background: var(--blue); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── No Bot State ───────────────────────────────────────── */
.no-bot-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - var(--topbar-h) - 48px);
  text-align: center;
  padding: 40px;
}
.no-bot-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.no-bot-state h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.no-bot-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ─── Code / Token Field ─────────────────────────────────── */
.token-field {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--green);
  word-break: break-all;
}

/* ─── Bot Card Grid ──────────────────────────────────────── */
.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s ease;
  position: relative;
}
.bot-card:hover {
  border-color: var(--border-light) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;
}
.bot-card.active-bot {
  border-color: var(--border-light) !important;
}
.bot-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.bot-avatar {
  width: 42px;
  height: 42px;
  background: var(--bg-active);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  flex-shrink: 0;
}
.bot-card-info { flex: 1; min-width: 0; }
.bot-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bot-card-username { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.bot-card-status { position: absolute; top: 16px; right: 16px; }
.bot-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.bot-stat-mini {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.bot-stat-mini-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.bot-stat-mini-value { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; margin-top: 2px; }
.bot-card-actions { display: flex; gap: 6px; }

/* ─── Inline Actions ─────────────────────────────────────── */
.action-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -var(--sidebar-w);
    transform: translateX(calc(-1 * var(--sidebar-w)));
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.6);
  }
  .mobile-menu-btn { display: flex; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .bot-selector-trigger { min-width: 140px; }
}

/* ─── Notification Center ───────────────────────────────── */
.notif-bell-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.notif-bell-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 0 8px rgba(239,68,68,0.6);
}

/* Notification Dropdown Panel */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0,0,0,0.7), 0 2px 8px rgba(0,0,0,0.4);
  z-index: 600;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.notif-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.notif-tab {
  background: transparent;
  border: none;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.notif-tab:hover { color: var(--text-primary); }
.notif-tab.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
  transition: background var(--transition);
}
.notif-card:hover {
  background: var(--bg-hover);
}
.notif-card.type-error {
  border-left: 3px solid #ef4444;
  background: rgba(239,68,68,0.04);
}
.notif-card.type-dispatch {
  border-left: 3px solid #3b82f6;
}
.notif-card.type-channel {
  border-left: 3px solid #10b981;
}

.notif-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.notif-card-title {
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-card-time {
  font-size: 10px;
  color: var(--text-muted);
}
.notif-card-msg {
  color: var(--text-secondary);
  word-break: break-word;
}
.notif-card-solution {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(59,130,246,0.1);
  border-radius: 4px;
  color: #60a5fa;
  font-size: 11px;
  white-space: pre-line;
}

/* Alerta ainda não lido: barra lateral mais forte para saltar aos olhos */
.notif-card.notif-unread {
  border-left-width: 3px;
  box-shadow: inset 2px 0 0 var(--amber, #f59e0b);
}

/* Detalhe técnico recolhido: fica disponível para diagnóstico sem poluir a
   leitura de quem só quer saber o que fazer. */
.notif-card-raw {
  margin-top: 6px;
  font-size: 10px;
}
.notif-card-raw summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.notif-card-raw summary:hover {
  color: var(--text-secondary);
}
.notif-card-raw code {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  background: var(--bg-hover);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  white-space: pre-wrap;
}

/* ─── Locked Nav Item (Sem Bot) ─────────────────────────── */
.nav-item.locked-nav {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}
.nav-item.locked-nav::after {
  content: "🔒";
  font-size: 11px;
  margin-left: auto;
  opacity: 0.8;
}
.nav-item.locked-nav:hover {
  background: transparent;
  color: var(--text-muted);
}


