:root {
  --sidebar-width: 260px;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --bg-soft: #f4f6fb;
  --card-radius: 14px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg-soft);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #1e293b;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a, #1e293b);
  color: #cbd5e1;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 22px 20px;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav { padding: 14px 10px; }

.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
  padding: 16px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 14.5px;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}

.nav-link i { width: 18px; text-align: center; opacity: .85; }

.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
}

.nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

/* Main content */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  height: 64px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content { padding: 24px; flex: 1; }

.avatar-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

/* Cards / widgets */
.stat-card {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226,232,240,.8);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: 0 6px 20px rgba(15,23,42,.04);
  transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15,23,42,.08);
}

.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  color: #fff;
}

.card, .table-card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: 0 6px 20px rgba(15,23,42,.04);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #1a3789);
}

/* Chat manager */
.chat-list-item {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
}
.chat-list-item:hover, .chat-list-item.active { background: #eef2ff; }

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 8px;
  font-size: 14.5px;
  line-height: 1.4;
}
.chat-bubble.in { background: #f1f5f9; align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-bubble.out { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color:#fff; align-self: flex-end; border-bottom-right-radius: 4px; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
}
