/* ── WeBot Agency — Shared Design System ────────────────────────────────── */
:root {
  --bg:           #0a0d14;
  --surface:      #0d1117;
  --surface2:     #111827;
  --surface3:     #141925;
  --border:       rgba(120, 141, 255, 0.12);
  --border-hover: rgba(120, 141, 255, 0.25);
  --accent:       #5b7fff;
  --accent-dim:   rgba(91, 127, 255, 0.15);
  --accent-hover: #4a6ee0;
  --accent2:      #ffd869;
  --accent2-dim:  rgba(255, 216, 105, 0.12);
  --text:         #e4e8ff;
  --text-muted:   #6b7a9e;
  --text-faint:   #3d4a6b;
  --success:      #22c55e;
  --success-dim:  rgba(34, 197, 94, 0.12);
  --error:        #ef4444;
  --error-dim:    rgba(239, 68, 68, 0.12);
  --warn:         #f59e0b;
  --warn-dim:     rgba(245, 158, 11, 0.12);
  --purple:       #a78bfa;
  --purple-dim:   rgba(167, 139, 250, 0.12);
  --teal:         #2dd4bf;
  --teal-dim:     rgba(45, 212, 191, 0.12);
  --scrollbar:    rgba(120, 141, 255, 0.18);
  --nav-h:        52px;
  --sidebar-w:    260px;
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Top Navigation Bar ── */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(10, 13, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.2px;
  flex-shrink: 0;
  margin-right: 32px;
}

.nav-brand .brand-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-brand .brand-name { color: var(--text); }
.nav-brand .brand-sub { color: var(--text-muted); font-size: 11px; font-weight: 400; margin-left: 2px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: var(--accent-dim);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-link .nav-icon { font-size: 14px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Connection Status ── */
.conn-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--error);
  flex-shrink: 0;
  transition: background 0.3s;
}
.conn-dot.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.conn-dot.connecting { background: var(--warn); animation: pulse 1.2s infinite; }

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

/* ── Page Layout ── */
.page-content {
  padding: 28px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

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

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: 12px; }

  /* ── Mobile Nav ── */
  .nav-bar {
    padding: 0 12px;
    height: auto;
    min-height: var(--nav-h);
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 8px;
  }

  .nav-brand {
    margin-right: auto;
    font-size: 14px;
  }

  .nav-brand .brand-sub { display: none; }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    padding: 2px 0;
  }

  .nav-links::-webkit-scrollbar { display: none; }

  .nav-link {
    padding: 5px 10px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .nav-link .nav-label { display: none; }
  .nav-link .nav-icon { font-size: 16px; }

  .nav-right { order: 2; }

  .conn-status {
    font-size: 0;
    padding: 4px 6px;
    min-width: 0;
  }
  .conn-status .conn-label { display: none; }
  .conn-dot { width: 8px; height: 8px; }

  /* ── Mobile Typography ── */
  .page-title { font-size: 20px; }
  .page-subtitle { font-size: 12px; }

  /* ── Mobile Cards ── */
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }

  /* ── Mobile Stat Cards ── */
  .stat-value { font-size: 22px; }
  .stat-card { padding: 14px; }

  /* ── Mobile Modal ── */
  .modal {
    width: 95vw;
    padding: 20px;
    max-height: 85vh;
    overflow-y: auto;
  }

  /* ── Mobile Toast ── */
  #toast-container {
    bottom: 12px;
    right: 12px;
    left: 12px;
  }
  .toast { max-width: 100%; }

  /* ── Mobile Buttons ── */
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sm { padding: 7px 12px; font-size: 12px; }

  /* ── Mobile Section Headers ── */
  .section-header { flex-wrap: wrap; gap: 8px; }

  /* ── Mobile Tabs ── */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { flex-shrink: 0; white-space: nowrap; font-size: 11px; padding: 6px 10px; }
}

/* ── Stat Cards ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}

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

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-change {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--error); }
.stat-change.neutral { color: var(--text-muted); }

/* ── Progress Bar ── */
.progress-wrap {
  margin: 12px 0 4px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 2px;
  transition: width 0.6s ease;
}

.progress-fill.green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-fill.yellow { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-fill.red { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ── Badge / Tag ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-blue { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(91,127,255,0.2); }
.badge-green { background: var(--success-dim); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: var(--error-dim); color: var(--error); border: 1px solid rgba(239,68,68,0.2); }
.badge-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }
.badge-teal { background: var(--teal-dim); color: var(--teal); border: 1px solid rgba(45,212,191,0.2); }
.badge-muted { background: var(--surface3); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Status Dot ── */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.active { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.idle   { background: var(--text-faint); }
.status-dot.busy   { background: var(--warn); box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.status-dot.error  { background: var(--error); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.tab {
  flex: 1;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.15s;
  font-family: inherit;
  text-align: center;
}

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

.tab.active {
  background: var(--surface3);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

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

.modal {
  background: var(--surface2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 440px;
  max-width: 90vw;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.modal label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}

.modal input:focus,
.modal textarea:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 4px; }
.empty-state h3 { font-size: 16px; color: var(--text); font-weight: 600; }
.empty-state p { font-size: 13px; max-width: 300px; line-height: 1.6; }

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

/* ── Utility ── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeIn 0.2s ease; }

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

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease;
  cursor: pointer;
  border: 1px solid;
  max-width: 320px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { background: var(--success-dim); color: var(--success); border-color: rgba(34,197,94,0.25); }
.toast.error   { background: var(--error-dim); color: var(--error); border-color: rgba(239,68,68,0.25); }
.toast.info    { background: var(--accent-dim); color: var(--accent); border-color: rgba(91,127,255,0.25); }
.toast.warn    { background: var(--warn-dim); color: var(--warn); border-color: rgba(245,158,11,0.25); }
