/**
 * Andy Dashboard — HUD-style admin surface.
 *
 * Visual language matches /dashboard/andy.html: deep space backdrop,
 * neon cyan/violet accents, mono typography for technical chrome,
 * Inter for body. The dashboard is the "bridge" of the same ship the
 * Andy console runs on, not a separate product.
 */

:root {
  /* Surface */
  --bg-0: #050810;
  --bg-1: #0a1020;
  --surface: rgba(15, 26, 48, 0.55);
  --surface-strong: rgba(15, 26, 48, 0.85);
  --surface-elev: rgba(20, 34, 60, 0.85);
  --border: rgba(159, 191, 255, 0.10);
  --border-strong: rgba(159, 191, 255, 0.20);

  /* Text */
  --fg: #d7e3f4;
  --fg-mid: #9eb1cf;
  --fg-dim: #6f86a8;

  /* Accents (same as andy.css) */
  --andy-cyan: #5cc8ff;
  --andy-violet: #a48cff;
  --andy-green: #9fffbe;
  --andy-glow: rgba(92, 200, 255, 0.55);
  --andy-glow-soft: rgba(92, 200, 255, 0.18);

  /* States */
  --success: #66f7a6;
  --warning: #ffd45c;
  --danger: #ff7a7a;

  /* Type */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Geometry */
  --radius: 14px;
  --radius-sm: 8px;
}

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

html,
body {
  min-height: 100vh;
  font-family: var(--font-display);
  color: var(--fg);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient backdrop — soft radial gradients + scanlines, same vibe as
   andy.html. Pseudo-elements so it never interferes with clicks. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 80% 50% at 15% 0%,
      rgba(92, 200, 255, 0.10),
      transparent 60%
    ),
    radial-gradient(
      ellipse 80% 60% at 85% 100%,
      rgba(164, 140, 255, 0.10),
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 40% at 50% 50%,
      rgba(92, 200, 255, 0.03),
      transparent 70%
    );
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────── */
/* LOGIN                                                              */
/* ─────────────────────────────────────────────────────────────────── */
.login-screen {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 44px 36px 36px;
  background: var(--surface-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(92, 200, 255, 0.04),
    0 0 80px rgba(92, 200, 255, 0.05);
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-logo {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--andy-cyan);
  filter: drop-shadow(0 0 14px var(--andy-glow));
}
.login-logo svg {
  width: 100%;
  height: 100%;
}

.login-header h1 {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: lowercase;
  color: var(--fg);
}
.login-header h1::after {
  content: '·';
  display: inline-block;
  margin-left: 0.4em;
  color: var(--andy-cyan);
  animation: blink 1.4s steps(2, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-error,
.register-error {
  padding: 10px 14px;
  background: rgba(255, 122, 122, 0.10);
  border: 1px solid rgba(255, 122, 122, 0.35);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.register-notice {
  color: var(--fg-dim);
  font-size: 13px;
  text-align: center;
  margin-bottom: 4px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* FORMS                                                              */
/* ─────────────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: rgba(5, 8, 16, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: rgba(92, 200, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(92, 200, 255, 0.10);
  background: rgba(5, 8, 16, 0.85);
}

.form-group small {
  font-size: 12px;
  color: var(--fg-dim);
}

/* ─────────────────────────────────────────────────────────────────── */
/* BUTTONS                                                            */
/* ─────────────────────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-back,
.logout-btn,
button[type='submit'] {
  font-family: var(--font-display);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s,
    box-shadow 0.2s, transform 0.05s;
}

.btn-primary,
.login-form button[type='submit'] {
  padding: 12px 22px;
  border: 1px solid rgba(92, 200, 255, 0.5);
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(92, 200, 255, 0.16),
    rgba(92, 200, 255, 0.04)
  );
  color: var(--andy-cyan);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.btn-primary:hover,
.login-form button[type='submit']:hover {
  background: linear-gradient(
    180deg,
    rgba(92, 200, 255, 0.28),
    rgba(92, 200, 255, 0.08)
  );
  box-shadow:
    0 0 0 3px rgba(92, 200, 255, 0.08),
    0 6px 26px rgba(92, 200, 255, 0.15);
}
.btn-primary:active,
.login-form button[type='submit']:active {
  transform: translateY(1px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.btn-secondary:hover {
  border-color: rgba(92, 200, 255, 0.4);
  color: var(--andy-cyan);
}

.btn-back {
  background: none;
  border: none;
  color: var(--fg-dim);
  padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.btn-back:hover {
  color: var(--andy-cyan);
}

/* ─────────────────────────────────────────────────────────────────── */
/* APP LAYOUT                                                         */
/* ─────────────────────────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────────── */
/* SIDEBAR                                                            */
/* ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    180deg,
    rgba(15, 26, 48, 0.6) 0%,
    rgba(10, 16, 32, 0.4) 100%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  position: relative;
}

.sidebar::after {
  /* hairline on the right edge, glowing */
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(92, 200, 255, 0.35) 30%,
    rgba(164, 140, 255, 0.35) 70%,
    transparent
  );
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--andy-cyan);
  filter: drop-shadow(0 0 8px var(--andy-glow));
}
.logo svg {
  width: 100%;
  height: 100%;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: lowercase;
  color: var(--fg);
}

/* Nav */
.nav {
  flex: 1;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.nav-item::before {
  /* leading bullet — replaces the emoji icon */
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex-shrink: 0;
  transition: opacity 0.2s, box-shadow 0.2s;
}
.nav-item:hover {
  color: var(--fg);
  background: rgba(92, 200, 255, 0.04);
}
.nav-item.active {
  color: var(--andy-cyan);
  background: rgba(92, 200, 255, 0.08);
  border-color: rgba(92, 200, 255, 0.20);
}
.nav-item.active::before {
  opacity: 1;
  box-shadow: 0 0 10px var(--andy-glow);
}
.nav-icon {
  display: none;
}

.sidebar-footer {
  padding: 16px 18px 24px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.logout-btn:hover {
  border-color: rgba(255, 122, 122, 0.5);
  color: var(--danger);
}

/* ─────────────────────────────────────────────────────────────────── */
/* MAIN                                                               */
/* ─────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 32px 40px 48px;
  overflow-y: auto;
}

.tab {
  display: none;
  animation: fadeUp 0.4s ease-out;
}
.tab.active {
  display: block;
}

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

.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.page-header h1::before {
  /* subtle accent bar before the title */
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, var(--andy-cyan), var(--andy-violet));
  border-radius: 2px;
  margin-right: 14px;
  vertical-align: -4px;
  box-shadow: 0 0 12px var(--andy-glow);
}

/* ─────────────────────────────────────────────────────────────────── */
/* CARDS                                                              */
/* ─────────────────────────────────────────────────────────────────── */
.card,
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 18px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.card:hover,
.settings-section:hover {
  border-color: var(--border-strong);
}

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

.card-header h2 {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--fg-mid);
}

.card-icon {
  display: none; /* drop emoji icons in favor of mono headers */
}

.card-body {
  padding: 22px;
}

/* WhatsApp Card */
.whatsapp-card .card-header {
  border-bottom: none;
}

.wa-connected,
.wa-disconnected {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.wa-connected {
  color: var(--success);
}
.wa-disconnected {
  color: var(--danger);
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* STATUS BADGE                                                       */
/* ─────────────────────────────────────────────────────────────────── */
.status-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.status-badge.connected {
  color: var(--success);
  background: rgba(102, 247, 166, 0.08);
}
.status-badge.disconnected {
  color: var(--danger);
  background: rgba(255, 122, 122, 0.08);
}
.status-badge.pending {
  color: var(--warning);
  background: rgba(255, 212, 92, 0.08);
}

/* ─────────────────────────────────────────────────────────────────── */
/* STATS GRID                                                         */
/* ─────────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  padding: 24px 22px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: left;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(92, 200, 255, 0.45),
    transparent
  );
}
.stat-card:hover {
  border-color: rgba(92, 200, 255, 0.30);
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 400;
  line-height: 1.05;
  color: var(--fg);
  letter-spacing: -0.02em;
  text-shadow: 0 0 24px rgba(92, 200, 255, 0.18);
}

.stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-top: 8px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* CHATS LIST                                                         */
/* ─────────────────────────────────────────────────────────────────── */
.search-box input {
  background: rgba(5, 8, 16, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--fg);
  font-family: var(--font-display);
  font-size: 13px;
  width: 320px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
  outline: none;
  border-color: rgba(92, 200, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(92, 200, 255, 0.10);
}

.chats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.chat-item:hover {
  border-color: rgba(92, 200, 255, 0.30);
  background: rgba(15, 26, 48, 0.75);
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(92, 200, 255, 0.18),
    rgba(164, 140, 255, 0.18)
  );
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--andy-cyan);
  flex-shrink: 0;
}

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

.chat-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview {
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.chat-time {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  color: var(--fg-dim);
}

.chat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.chat-badge.enabled {
  color: var(--success);
  background: rgba(102, 247, 166, 0.08);
}
.chat-badge.disabled {
  color: var(--fg-dim);
  background: transparent;
}

.tts-select {
  display: block;
  margin-top: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(5, 8, 16, 0.6);
  color: var(--fg);
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────── */
/* TOGGLE                                                             */
/* ─────────────────────────────────────────────────────────────────── */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.toggle input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--fg-dim);
  top: 3px;
  left: 3px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s;
}
.toggle input:checked + .toggle-slider {
  background: rgba(92, 200, 255, 0.20);
  border-color: rgba(92, 200, 255, 0.55);
}
.toggle input:checked + .toggle-slider::after {
  transform: translateX(20px);
  background: var(--andy-cyan);
  box-shadow: 0 0 12px var(--andy-glow);
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toggle-group span {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--fg-dim);
}

/* ─────────────────────────────────────────────────────────────────── */
/* MESSAGES                                                           */
/* ─────────────────────────────────────────────────────────────────── */
.messages-actions {
  margin-bottom: 18px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid var(--border);
}

.message.incoming {
  background: var(--surface);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.outgoing {
  background: linear-gradient(
    180deg,
    rgba(92, 200, 255, 0.18),
    rgba(92, 200, 255, 0.08)
  );
  border-color: rgba(92, 200, 255, 0.35);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-sender {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--andy-cyan);
  margin-bottom: 4px;
}
.message.outgoing .message-sender {
  color: rgba(215, 227, 244, 0.7);
}

.message-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  margin-top: 6px;
  text-align: right;
}
.message.outgoing .message-time {
  color: rgba(215, 227, 244, 0.5);
}

.pagination {
  text-align: center;
  padding: 20px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* SETTINGS                                                           */
/* ─────────────────────────────────────────────────────────────────── */
.settings-section {
  padding: 22px;
  margin-bottom: 16px;
}

.settings-section h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-mid);
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────────────────────── */
/* TASKS                                                              */
/* ─────────────────────────────────────────────────────────────────── */
.tasks-list,
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card,
.skill-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.task-card:hover,
.skill-card:hover {
  border-color: rgba(92, 200, 255, 0.30);
}

/* Generic stat-row used in AI usage panel */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.stat-row:last-child {
  border-bottom: none;
}
.stat-row strong {
  font-family: var(--font-mono);
  color: var(--andy-cyan);
}

/* ─────────────────────────────────────────────────────────────────── */
/* MODAL                                                              */
/* ─────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeUp 0.2s ease-out;
}

.modal-content {
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow: auto;
  background: var(--surface-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-mid);
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover {
  color: var(--danger);
  background: rgba(255, 122, 122, 0.10);
}

.modal-body {
  padding: 22px;
}

.modal-body form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

/* ─────────────────────────────────────────────────────────────────── */
/* ACTIVITY FEED                                                      */
/* ─────────────────────────────────────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 3px 0;
  position: relative;
}
.activity-item.has-header {
  padding-top: 14px;
  margin-top: 6px;
}
.activity-item.has-header:not(:first-child)::before {
  /* hairline separator only above grouped blocks */
  content: '';
  position: absolute;
  top: 0;
  left: 46px; /* aligns with body, not avatar */
  right: 0;
  height: 1px;
  background: var(--border);
}

.activity-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--andy-cyan);
  background: linear-gradient(
    135deg,
    rgba(92, 200, 255, 0.16),
    rgba(164, 140, 255, 0.16)
  );
  border: 1px solid var(--border-strong);
}
.activity-item.bot .activity-avatar {
  color: var(--andy-violet);
  background: linear-gradient(
    135deg,
    rgba(164, 140, 255, 0.20),
    rgba(92, 200, 255, 0.10)
  );
}
.activity-item.continuation .activity-avatar {
  background: transparent;
  border: none;
}

.activity-body {
  min-width: 0;
  padding-top: 2px;
}

.activity-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.activity-sender {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}
.activity-chat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.activity-chat::before {
  content: '·';
  margin-right: 6px;
  color: var(--fg-dim);
  opacity: 0.6;
}
.activity-time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  color: var(--fg-dim);
}

.activity-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
}
.activity-muted {
  color: var(--fg-dim);
}

.activity-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(92, 200, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-mid);
}
.activity-chip-icon {
  font-size: 14px;
  line-height: 1;
}

/* ─────────────────────────────────────────────────────────────────── */
/* MISC                                                               */
/* ─────────────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-dim);
  font-size: 13px;
  font-style: italic;
}

::selection {
  background: rgba(92, 200, 255, 0.30);
  color: var(--fg);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(159, 191, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(159, 191, 255, 0.30);
}

/* ─────────────────────────────────────────────────────────────────── */
/* RESPONSIVE                                                         */
/* ─────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-header {
    padding: 18px 14px;
    justify-content: center;
  }
  .logo-text {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px 0;
  }
  .nav-item span:not(.nav-icon) {
    display: none;
  }
  .nav-item::before {
    margin: 0;
  }
  .main {
    padding: 24px 20px 36px;
  }
  .search-box input {
    width: 100%;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stat-value {
    font-size: 30px;
  }
}
