:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #090d16;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --accent-gold: #f59e0b;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --radius: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 11px;
  color: var(--primary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.nav-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.2), rgba(13, 148, 136, 0.05));
  color: #2dd4bf;
  border-left: 3px solid #2dd4bf;
  font-weight: 600;
}

.user-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--accent-gold);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-main);
  position: relative;
}

.topbar {
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Cards & UI Components */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ai {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
}
.btn-ai:hover {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-guide {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-guide:hover {
  background: #fbbf24;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

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

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-master { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-custom { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Banner Canvas Visual Preview */
.banner-preview {
  width: 100%;
  aspect-ratio: 1/1;
  background: linear-gradient(135deg, #881337, #e11d48);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
  color: white;
  position: relative;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.banner-text-56 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}

.banner-emoji {
  font-size: 32px;
  margin-top: 16px;
}

.banner-footer {
  position: absolute;
  bottom: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* Kanban Board for CRM */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  overflow-x: auto;
}

.kanban-col {
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 500px;
}

.kanban-col-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.lead-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

/* Onboarding Wizard Checklist */
.onboarding-banner {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.onboarding-step-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.onboarding-step-card:hover {
  border-color: #2dd4bf;
  transform: translateY(-2px);
  background: rgba(15, 23, 42, 0.9);
}

/* ==================================================== */
/* FLOATING AI COPILOT & SUPPORT WIDGET */
/* ==================================================== */
.ai-floating-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 90;
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #8b5cf6 100%);
  color: white;
  padding: 14px 22px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(236, 72, 153, 0.5), 0 0 20px rgba(139, 92, 246, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulse-glow 2.5s infinite;
}

.ai-floating-trigger:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 12px 40px rgba(236, 72, 153, 0.7);
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7), 0 8px 30px rgba(236, 72, 153, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(236, 72, 153, 0), 0 8px 30px rgba(236, 72, 153, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0), 0 8px 30px rgba(236, 72, 153, 0.5); }
}

.ai-chat-popup {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(139, 92, 246, 0.2);
  z-index: 95;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
  animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e1b4b 0%, #311042 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #090d16;
}

.chat-msg {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
}
.chat-msg.bot {
  background: #1e293b;
  border: 1px solid var(--border);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-btn {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: #2dd4bf;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.chip-btn:hover {
  background: rgba(45, 212, 191, 0.2);
  border-color: #2dd4bf;
}

.zalo-support-card {
  margin-top: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-radius: 10px;
  color: white;
  text-align: center;
}

.ai-chat-input-box {
  padding: 12px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

@media (max-width: 1024px) {
  .app-container { flex-direction: column; }
  .sidebar { width: 100%; height: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .onboarding-steps { grid-template-columns: 1fr; }
  .ai-chat-popup { right: 12px; bottom: 80px; width: calc(100vw - 24px); height: 500px; }
}
