/* ═══════════════════════════════════════════════════════════════
   WaLink Dashboard — Premium Dark Mode Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Font Import ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Root Variables ───────────────────────────────────────────── */
:root {
  --navy-900:  #0f172a;
  --navy-800:  #1e293b;
  --navy-700:  #334155;
  --navy-600:  #475569;
  --navy-500:  #64748b;

  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  --rose-500: #f43f5e;
  --rose-600: #e11d48;

  --blue-500: #3b82f6;
  --blue-600: #2563eb;

  --purple-500: #8b5cf6;

  --glass-bg:     rgba(30, 41, 59, 0.65);
  --glass-border: rgba(148, 163, 184, 0.08);
  --glass-blur:   16px;

  --sidebar-width: 64px;
  --topbar-height: 72px;

  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--navy-900);
  color: #e2e8f0;
}

/* Subtle radial gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Custom Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.3);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.5);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(100,116,139,0.3) transparent;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.3); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.3), 0 0 30px rgba(16, 185, 129, 0.1); }
  50%      { box-shadow: 0 0 25px rgba(16, 185, 129, 0.5), 0 0 50px rgba(16, 185, 129, 0.2); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes flashGreen {
  0%   { background-color: rgba(16, 185, 129, 0.12); }
  100% { background-color: transparent; }
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 40;
  padding: 16px 0;
}

.sidebar-logo {
  padding: 8px 0 24px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: transform var(--transition-normal);
}

.logo-icon:hover {
  transform: scale(1.08);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-btn:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.08);
}

.sidebar-btn.active {
  color: var(--emerald-500);
  background: rgba(16, 185, 129, 0.1);
}

.sidebar-btn.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--emerald-500);
  border-radius: 0 3px 3px 0;
}

.sidebar-bottom {
  padding: 16px 0 8px;
}

/* ── Connection Dot ───────────────────────────────────────────── */
.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background var(--transition-normal);
}

.connection-dot.connected {
  background: var(--emerald-500);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

.connection-dot.disconnected {
  background: var(--rose-500);
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 0 32px 48px;
  position: relative;
  z-index: 1;
}

/* ── TOP BAR ──────────────────────────────────────────────────── */
.top-bar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 28px;
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 30;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #f8fafc;
}

.top-bar-divider {
  width: 1px;
  height: 20px;
  background: var(--navy-700);
}

.top-bar-subtitle {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--navy-500);
}

.connection-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Add Device Button ────────────────────────────────────────── */
.btn-add-device {
  display: inline-flex;
  align-items: center;
  padding: 9px 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.25);
  letter-spacing: 0.01em;
}

.btn-add-device:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}

.btn-add-device:active {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   STATS ROW
   ═══════════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  opacity: 0.06;
  transition: opacity var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.14);
}

.stat-card:hover::before {
  opacity: 0.1;
}

.stat-card--sessions::before { background: linear-gradient(135deg, var(--emerald-500), var(--blue-500)); }
.stat-card--connected::before { background: linear-gradient(135deg, var(--emerald-500), #22d3ee); }
.stat-card--msgin::before { background: linear-gradient(135deg, var(--blue-500), #8b5cf6); }
.stat-card--msgout::before { background: linear-gradient(135deg, var(--purple-500), var(--rose-500)); }

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-500);
  flex-shrink: 0;
}

.stat-card-icon--green  { background: rgba(16, 185, 129, 0.1); color: var(--emerald-500); }
.stat-card-icon--blue   { background: rgba(59, 130, 246, 0.1); color: var(--blue-500); }
.stat-card-icon--purple { background: rgba(139, 92, 246, 0.1); color: var(--purple-500); }

.stat-card-data {
  display: flex;
  flex-direction: column;
}

.stat-card-value {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #f8fafc;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--navy-500);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════
   SESSIONS SECTION
   ═══════════════════════════════════════════════════════════════ */
.sessions-section {
  position: relative;
}

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sessions-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.sessions-count {
  font-size: 0.75rem;
  color: var(--navy-500);
  background: rgba(30, 41, 59, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ── Session Card ─────────────────────────────────────────────── */
.session-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 22px;
  transition: all var(--transition-normal);
  animation: cardEnter 0.4s ease-out both;
  position: relative;
  overflow: hidden;
}

.session-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--emerald-500), transparent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.session-card:hover {
  transform: translateY(-3px);
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.session-card:hover::after {
  opacity: 1;
}

.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.session-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f1f5f9;
  font-family: 'Inter', monospace;
  letter-spacing: -0.01em;
}

.session-card-phone {
  font-size: 0.8125rem;
  color: var(--navy-500);
  margin-top: 2px;
}

/* ── Status Badge ─────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--transition-normal);
}

.status-badge .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge--connected {
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-500);
}
.status-badge--connected .status-dot {
  background: var(--emerald-500);
  animation: pulse 2s ease-in-out infinite;
}

.status-badge--scanning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber-500);
}
.status-badge--scanning .status-dot {
  background: var(--amber-500);
  animation: pulse 1.2s ease-in-out infinite;
}

.status-badge--disconnected {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-500);
}
.status-badge--disconnected .status-dot {
  background: var(--rose-500);
}

/* ── Message Stats ────────────────────────────────────────────── */
.session-card-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.04);
}

.session-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-stat-icon {
  color: var(--navy-500);
}

.session-stat-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #e2e8f0;
}

.session-stat-label {
  font-size: 0.6875rem;
  color: var(--navy-600);
  margin-left: 2px;
}

/* ── Card Actions ─────────────────────────────────────────────── */
.session-card-actions {
  display: flex;
  gap: 6px;
}

.card-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  color: var(--navy-500);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-action-btn:hover {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(148, 163, 184, 0.15);
}

.card-action-btn--settings:hover { color: var(--blue-500); }
.card-action-btn--restart:hover  { color: var(--amber-500); }
.card-action-btn--delete:hover   { color: var(--rose-500); border-color: rgba(244, 63, 94, 0.2); }

.card-flash {
  animation: flashGreen 0.6s ease-out;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
}

.empty-state.hidden { display: none; }

.empty-state-icon {
  position: relative;
  margin-bottom: 24px;
  animation: float 4s ease-in-out infinite;
}

.empty-state-pulse {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.06);
  animation: pulse 3s ease-in-out infinite;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--navy-500);
  max-width: 380px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeIn 0.2s ease-out;
  padding: 24px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 20px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  position: relative;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}

.modal-card--confirm {
  max-width: 400px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--navy-500);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
}

.modal-header {
  text-align: center;
  margin-bottom: 28px;
}

.modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.modal-icon--emerald { background: rgba(16, 185, 129, 0.12); color: var(--emerald-500); }
.modal-icon--blue    { background: rgba(59, 130, 246, 0.12); color: var(--blue-500); }
.modal-icon--red     { background: rgba(244, 63, 94, 0.12); color: var(--rose-500); }

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--navy-500);
  line-height: 1.5;
}

.modal-body {
  display: flex;
  flex-direction: column;
}

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

/* ── Input Fields ─────────────────────────────────────────────── */
.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-field {
  flex: 1;
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: 'Inter', monospace;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 10px;
  outline: none;
  transition: all var(--transition-fast);
}

.input-field:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-field--full {
  width: 100%;
}

.input-field::placeholder {
  color: var(--navy-600);
}

.input-error {
  font-size: 0.75rem;
  color: var(--rose-500);
  margin-top: 6px;
}

.input-error.hidden { display: none; }

.input-hint {
  font-size: 0.75rem;
  color: var(--navy-600);
  margin-top: 6px;
}

.input-section {
  margin-bottom: 20px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-start-session {
  padding: 10px 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-start-session:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(148, 163, 184, 0.15);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rose-500);
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.15);
}

/* ── Settings Actions ─────────────────────────────────────────── */
.settings-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.settings-danger {
  padding-top: 8px;
}

.danger-divider {
  height: 1px;
  background: rgba(244, 63, 94, 0.1);
  margin-bottom: 18px;
}

.danger-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--rose-500);
  margin-bottom: 6px;
}

.danger-text {
  font-size: 0.75rem;
  color: var(--navy-500);
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   QR CODE
   ═══════════════════════════════════════════════════════════════ */
.add-device-step { }
.add-device-step.hidden { display: none; }

.qr-container {
  width: 260px;
  height: 260px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid rgba(16, 185, 129, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: glow 3s ease-in-out infinite;
  overflow: hidden;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-placeholder.hidden { display: none; }

.qr-image {
  width: 230px;
  height: 230px;
  border-radius: 8px;
  image-rendering: pixelated;
}

.qr-image.hidden { display: none; }

.qr-status {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--navy-500);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  min-width: 280px;
  max-width: 400px;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #f1f5f9;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: slideRight 0.35s ease-out;
  pointer-events: auto;
}

.toast--exiting {
  animation: slideOut 0.3s ease-in forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast--success { border-left: 3px solid var(--emerald-500); }
.toast--success .toast-icon { color: var(--emerald-500); }

.toast--error { border-left: 3px solid var(--rose-500); }
.toast--error .toast-icon { color: var(--rose-500); }

.toast--info { border-left: 3px solid var(--blue-500); }
.toast--info .toast-icon { color: var(--blue-500); }

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: var(--navy-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color var(--transition-fast);
}

.toast-close:hover { color: #e2e8f0; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 0 16px 32px;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-card-value {
    font-size: 1.25rem;
  }

  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 12px;
    align-items: flex-start;
  }

  .modal-card {
    margin: 16px;
    padding: 24px;
  }
}

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

/* ── Doc Panels ────────────────────────────────────────────────── */
.doc-tab-btn.active {
  background: rgba(16, 185, 129, 0.1) !important;
  color: var(--emerald-500) !important;
  border-left: 3px solid var(--emerald-500);
  padding-left: 13px !important;
}

.code-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── CRM Styles ────────────────────────────────────────────────── */
.chat-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item:hover {
  background: rgba(148, 163, 184, 0.05);
}

.chat-item.active {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--emerald-500);
  padding-left: 13px;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #f1f5f9;
}

.chat-item-time {
  font-size: 0.6875rem;
  color: var(--navy-500);
}

.chat-item-preview {
  font-size: 0.75rem;
  color: var(--navy-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat bubble styling */
.message-bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.message-bubble--incoming {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--glass-border);
  color: #e2e8f0;
  border-bottom-left-radius: 2px;
}

.message-bubble--outgoing {
  align-self: flex-end;
  background: var(--emerald-600);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.message-bubble-time {
  display: block;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
  margin-top: 4px;
}

.message-bubble--incoming .message-bubble-time {
  color: var(--navy-500);
}

/* CRM Scrollable Thread */
#crmMessageThread {
  display: flex;
  flex-direction: column;
}
