/* ====================================================================
   DỰ ÁN: QL KH TỐT HƠN — DESIGN SYSTEM & STYLES
   Aesthetics: Modern Slate Dark Theme, Glassmorphism, Micro-animations
   Mobile-First Responsive
   ==================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Color Palette */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.95);
  --bg-input: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.75);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #10b981;
  --border-card: rgba(255, 255, 255, 0.12);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-bg: rgba(16, 185, 129, 0.15);
  --emerald-border: rgba(16, 185, 129, 0.35);

  --slate-500: #64748b;
  --slate-bg: rgba(100, 116, 139, 0.15);
  --slate-border: rgba(100, 116, 139, 0.3);

  --indigo-500: #6366f1;
  --indigo-bg: rgba(99, 102, 241, 0.15);

  --amber-500: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);

  --rose-500: #ef4444;
  --rose-bg: rgba(239, 68, 68, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.07) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px; /* Space for mobile nav */
}

/* Container - Bung rộng hết cỡ sang phải (w-full / max-w-none) & Đồng bộ căn lề */
.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 24px; /* Chuẩn lề px-6: Header, Nav-tabs và Nội dung luôn thẳng hàng 100% */
  box-sizing: border-box;
}

/* ====================================================================
   HEADER & NAVBAR
   ==================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.brand-info h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  cursor: pointer;
  transition: var(--transition);
}

.db-status-badge:hover {
  background: rgba(16, 185, 129, 0.2);
}

.db-status-badge.offline {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.db-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Navigation Tabs - Căn lề thẳng hàng tuyệt đối & Tự động cân đối dàn đều các tab */
.nav-tabs {
  display: flex;
  flex-wrap: wrap; /* Cho phép rớt dòng khi mở nhỏ */
  gap: 6px;
  margin: 18px 0;
  width: 100%;
  box-sizing: border-box;
  padding: 5px;
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.nav-tab {
  flex: 1 1 auto; /* Cho phép co giãn linh hoạt */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: var(--emerald-500);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
}

.nav-tab.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tab-badge {
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  font-weight: 600;
}

.nav-tab.active .tab-badge {
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

/* ====================================================================
   STATS BAR & METRICS
   ==================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, #64748b);
}

.stat-card.total { --stat-color: #6366f1; }
.stat-card.new { --stat-color: #10b981; }
.stat-card.old { --stat-color: #64748b; }

.stat-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ====================================================================
   FILTER & CONTROLS TOOLBAR
   ==================================================================== */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
}

@media (min-width: 640px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.toolbar-search-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
  flex-wrap: wrap;
}

.filter-time-wrap {
  position: relative;
  min-width: 220px;
  flex-shrink: 0;
}

.filter-time-select {
  width: 100%;
  height: 41px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 34px 0 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

.filter-time-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: var(--bg-card-hover);
}

.filter-time-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.filter-time-select.active-filter {
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-weight: 600;
}

@media (max-width: 768px) {
  .toolbar-search-filter-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .filter-time-wrap {
    width: 100%;
  }
}

.search-box {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 40px;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
}

.search-input:not(:placeholder-shown) + .search-clear {
  display: block;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  max-width: 100%;
  scrollbar-width: none;
}
.filter-group::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.filter-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--emerald-bg);
  border-color: var(--emerald-border);
  color: #34d399;
  font-weight: 600;
}

/* Demo Notice Banner */
.demo-banner {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-left: 4px solid #38bdf8;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}

.demo-banner.connected {
  display: none;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: var(--transition);
  white-space: nowrap;
}

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

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

/* ====================================================================
   CUSTOMER LIST & CARDS (MOBILE OPTIMIZED)
   ==================================================================== */
.customers-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .customers-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .customers-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .customers-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1800px) {
  .customers-container {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.customer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.customer-card:hover {
  border-color: rgba(16, 185, 129, 0.55);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(16, 185, 129, 0.15);
}

.customer-card:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.customer-avatar-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.customer-avatar-group > div:last-child {
  min-width: 0;
}

.customer-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #38bdf8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.customer-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.customer-start-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-new {
  background: var(--emerald-bg);
  color: #34d399;
  border: 1px solid var(--emerald-border);
}

.badge-new::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.badge-old {
  background: var(--slate-bg);
  color: #94a3b8;
  border: 1px solid var(--slate-border);
}

.card-contact {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

.card-contact a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.card-contact a:hover {
  color: var(--emerald-500);
}

.contact-link {
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  border-radius: 4px;
  padding: 1px 4px;
  font-weight: 500;
}

.contact-link:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  text-decoration: underline;
}

.contact-link.contact-email {
  color: #cbd5e1;
}

.contact-link.contact-email:hover {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-action.quick-rev:hover {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}

.btn-action.edit:hover {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
}

.btn-action.copy:hover {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.4);
  background: rgba(192, 132, 252, 0.1);
}

.btn-action.details:hover {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(96, 165, 250, 0.1);
}

.btn-action.delete:hover {
  color: #f87171;
  background: var(--rose-bg);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-xl);
  grid-column: 1 / -1;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 380px;
  margin: 0 auto 20px;
}

/* ====================================================================
   MODAL DIALOGS
   ==================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  overflow-y: auto; /* Lớp trượt ngoài (thanh trượt kép) khi màn hình rất thấp */
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Các modal nhập liệu / xác nhận khi mở đè lên modal khác (như Lịch sử doanh thu) -> luôn hiển thị ở tầng trên */
#revenue-modal {
  z-index: 1050;
}

#delete-revenue-modal,
#delete-modal,
#delete-care-modal,
#done-care-modal {
  z-index: 1100;
}

/* Giao diện Thùng rác khách hàng */
.trash-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}

.trash-card:hover {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(30, 41, 59, 0.8);
}

.trash-badge-remaining {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

.trash-badge-normal {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.trash-badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.trash-badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 720px);
  max-height: min(calc(100dvh - 32px), 720px);
  margin: auto; /* Căn giữa chuẩn xác trong flexbox có overflow */
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* QUAN TRỌNG NHẤT: Thẻ <form> bên trong modal-content phải là Flex Column */
.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-secondary);
  z-index: 2;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* PHẦN THÂN MODAL: Cuộn nội bộ mượt mà, luôn giữ chỗ cho footer cố định */
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* THANH TRƯỢT NỘI BỘ (THANH TRƯỢT KÉP) HIỆN ĐẠI, MƯỢT MÀ VÀ RÕ RÀNG */
.modal-body::-webkit-scrollbar,
.modal-overlay::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.modal-body::-webkit-scrollbar-track,
.modal-overlay::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.modal-overlay::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.6);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.modal-overlay::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.9);
}

.modal-body,
.modal-overlay {
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.6) rgba(15, 23, 42, 0.6);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label span.req {
  color: var(--rose-500);
}

.form-input,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.date-preview-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
}

.date-preview-label {
  color: var(--text-muted);
}

.modal-footer {
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  z-index: 2;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

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

@media (max-width: 640px) {
  .toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
  }
}

.toast {
  pointer-events: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  min-width: 280px;
  max-width: 420px;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 640px) {
  .toast {
    transform: translateY(-50px);
    width: 100%;
  }
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

@media (max-width: 640px) {
  .toast.show {
    transform: translateY(0);
  }
}

.toast-icon {
  flex-shrink: 0;
}

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

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

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

/* ====================================================================
   SKELETON LOADER
   ==================================================================== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card {
  height: 140px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

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

.text-muted {
  color: var(--text-muted);
}

/* ====================================================================
   BƯỚC 2: DOANH THU & XẾP HẠNG VIP STYLES
   ==================================================================== */

/* VIP Badge */
.badge-vip {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.35) 100%);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-vip::before {
  content: '👑';
  font-size: 0.8rem;
}

/* Rank Medals */
.rank-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.rank-1 {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #78350f;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
  border: 1px solid #fde68a;
}

.rank-2 {
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  color: #1e293b;
  box-shadow: 0 0 10px rgba(226, 232, 240, 0.4);
  border: 1px solid #ffffff;
}

.rank-3 {
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
  color: #fff;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.4);
  border: 1px solid #fdba74;
}

.rank-other {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.rank-zero {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  opacity: 0.6;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Ranked Card / Row */
.ranking-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.ranking-card:hover {
  border-color: var(--border-card);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ranking-card.is-vip {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, rgba(17, 24, 39, 0.85) 100%);
}

.ranking-card.is-vip::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.ranking-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ranking-customer-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.ranking-amount-box {
  text-align: right;
}

.ranking-amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.ranking-card.is-vip .ranking-amount {
  color: #fbbf24;
}

.revenue-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.revenue-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.revenue-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ranking-card.is-vip .revenue-bar-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

/* Quick Amount Chips */
.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.amount-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.amount-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Interactive SVG Trend Chart */
.chart-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

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

.chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-svg-wrapper {
  width: 100%;
  height: 180px;
  position: relative;
}

.chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Revenue History Table */
.rev-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.rev-history-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

.rev-history-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}


.rev-history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ====================================================================
   BƯỚC 3 — LỊCH CHĂM SÓC KHÁCH HÀNG (CARE SCHEDULE)
   ==================================================================== */

.care-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 860px) {
  .care-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.care-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.care-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.care-stat-card.care-stat-card-overdue {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.02) 100%);
}

.care-stat-card.care-stat-card-overdue:hover {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
}

.care-stat-card.care-stat-card-today {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.02) 100%);
}

.care-stat-card.care-stat-card-today:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}

.care-stat-card.care-stat-card-week {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.02) 100%);
}

.care-stat-card.care-stat-card-week:hover {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.care-stat-card.care-stat-card-done {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.care-stat-card.care-stat-card-done:hover {
  border-color: rgba(16, 185, 129, 0.7);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

.care-stat-number {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.care-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Banners cảnh báo */
.care-alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.care-alert-banner.overdue-banner {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(185, 28, 28, 0.08) 100%);
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
}

.care-alert-banner.today-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(217, 119, 6, 0.06) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
}

.care-alert-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.care-alert-content {
  flex: 1;
}

.care-alert-title {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.overdue-banner .care-alert-title { color: #f87171; }
.today-banner .care-alert-title { color: #fbbf24; }

.care-alert-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btn-care-banner-action {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-overdue-jump {
  background: #ef4444;
  color: #fff;
  border: 1px solid #dc2626;
}

.btn-overdue-jump:hover {
  background: #dc2626;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.5);
}

.btn-today-jump {
  background: #f59e0b;
  color: #0f172a;
  border: 1px solid #d97706;
}

.btn-today-jump:hover {
  background: #d97706;
  color: #fff;
}

/* Thanh điều hướng theo từng ngày (Daily Navigator) */
.care-day-navigator-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.care-nav-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-nav-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-nav-step:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-nav-today-focus {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  font-weight: 600;
}

.btn-nav-today-focus:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fef08a;
}

.care-nav-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.care-nav-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.care-date-picker-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.8125rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.care-date-picker-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.care-viewing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.btn-clear-date-filter {
  background: transparent;
  border: 1px dashed var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 9px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-date-filter:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Filter Chips bổ sung */
.filter-chip-overdue {
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

.filter-chip-overdue:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

.filter-chip-overdue.active {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

.filter-chip-today {
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
}

.filter-chip-today:hover {
  background: rgba(245, 158, 11, 0.1) !important;
}

.filter-chip-today.active {
  background: #f59e0b !important;
  color: #0f172a !important;
  border-color: #f59e0b !important;
}

.this-week-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.this-week-banner strong { color: #10b981; }

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

.schedule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.schedule-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: var(--border-subtle);
}

.schedule-card.status-pending::before { background: #f59e0b; }
.schedule-card.status-done::before    { background: #10b981; }
.schedule-card.status-skipped::before { background: #64748b; }

.schedule-card.is-overdue {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.04) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.08);
}

.schedule-card.is-overdue::before {
  background: #ef4444;
  width: 5px;
}

.schedule-card.is-today {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.04) 0%, var(--bg-card) 100%);
}

.schedule-card.is-today::before {
  background: #f59e0b;
  width: 5px;
}

.schedule-card.is-vip-customer {
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.04);
}

.schedule-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.schedule-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.schedule-customer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.schedule-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: white;
  flex-shrink: 0;
}

.schedule-avatar.vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.schedule-customer-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.status-chip.pending  { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.status-chip.done     { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.status-chip.skipped  { background: var(--slate-bg); color: var(--slate-500); border: 1px solid var(--slate-border); }
.status-chip.status-chip-overdue {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  font-weight: 700 !important;
}
.status-chip.status-chip-today {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  font-weight: 700 !important;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.date-badge.today-badge {
  color: #fbbf24;
  border-color: rgba(245,158,11,0.45);
  background: rgba(245,158,11,0.12);
  font-weight: 700;
}

.date-badge.overdue-badge {
  color: #f87171;
  border-color: rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.12);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  animation: pulse-dot-anim 1.5s infinite;
}

@keyframes pulse-dot-anim {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 8px #ef4444; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.card-overdue-warning-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
}

.card-overdue-warning-box .warning-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-overdue-warning-box .warning-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.card-overdue-warning-box .warning-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-today-notice-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
}

.card-today-notice-box .today-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-today-notice-box .today-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fbbf24;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.card-today-notice-box .today-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.assignee-tag {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.schedule-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 10px;
  line-height: 1.5;
}

.schedule-note.done-note { border-left-color: #10b981; }

.schedule-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-done {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.1);
  color: #34d399;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-done:hover { background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.5); }

.btn-done-urgent {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #f87171 !important;
  font-weight: 700 !important;
}

.btn-done-urgent:hover {
  background: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-done-today {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fbbf24 !important;
  font-weight: 700 !important;
}

.btn-done-today:hover {
  background: #f59e0b !important;
  color: #000 !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.badge-overdue-alert {
  background: #ef4444 !important;
  color: #fff !important;
  animation: pulse-badge 1.8s infinite !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  font-weight: 700 !important;
}

@keyframes pulse-badge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.care-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.care-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.schedule-section-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 0;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.done-note-area {
  width: 100%;
  min-height: 100px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  padding: 12px 14px;
  resize: vertical;
  transition: var(--transition);
  line-height: 1.5;
}

.done-note-area:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

@media (max-width: 600px) {
  .schedule-card-header { flex-direction: column; gap: 8px; }
  .schedule-card-actions { align-self: flex-end; }
  .care-stats-row { grid-template-columns: repeat(2, 1fr); }
}
.badge-priority { background: rgba(236, 72, 153, 0.15); color: #ec4899; border: 1px solid rgba(236, 72, 153, 0.2); }
.badge-occasion-le_tet { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-occasion-sinh_nhat { background: rgba(217, 70, 239, 0.15); color: #d946ef; border: 1px solid rgba(217, 70, 239, 0.2); }
.badge-occasion-tai_ky_hop_dong { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-occasion-dinh_ky { background: rgba(99, 102, 241, 0.15); color: #6366f1; border: 1px solid rgba(99, 102, 241, 0.2); }

/* ====================================================================
   TÍNH NĂNG 1: HÀNH ĐỘNG 1-CHẠM (QUICK CONNECT) TRÊN THẺ KHÁCH HÀNG
   ==================================================================== */
.card-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}

.btn-quick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  line-height: 1;
}

.btn-quick:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.btn-quick.call {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-quick.call:hover {
  background: rgba(16, 185, 129, 0.22);
}

.btn-quick.zalo {
  background: rgba(0, 104, 255, 0.15);
  color: #60a5fa;
  border-color: rgba(0, 104, 255, 0.35);
}
.btn-quick.zalo:hover {
  background: rgba(0, 104, 255, 0.25);
}

.btn-quick.email {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.35);
}
.btn-quick.email:hover {
  background: rgba(168, 85, 247, 0.28);
  color: #f3e8ff;
  border-color: rgba(168, 85, 247, 0.55);
}

.btn-quick.template {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.35);
}
.btn-quick.template:hover {
  background: rgba(139, 92, 246, 0.25);
}

.btn-quick.quick-care {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}
.btn-quick.quick-care:hover {
  background: rgba(245, 158, 11, 0.25);
}

/* ====================================================================
   TÍNH NĂNG 2: CẢNH BÁO NGUY CƠ RỜI BỎ (CHURN RISK ALERT)
   ==================================================================== */
.badge-churn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  animation: pulseWarning 2.5s infinite;
}

@keyframes pulseWarning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.badge-churn.critical {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-churn.warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-churn:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
}

/* ====================================================================
   TÍNH NĂNG 3: MODAL KỊCH BẢN TIN NHẮN CHĂM SÓC (CARE TEMPLATES)
   ==================================================================== */
.template-occasions-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.template-chip {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 0.78125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.template-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.template-chip.active {
  background: var(--indigo-500);
  color: #ffffff;
  border-color: var(--indigo-500);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  font-weight: 600;
}

/* Salutation Selector Chips */
.salutation-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.salutation-chip {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.salutation-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.salutation-chip.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
  font-weight: 600;
}

.template-meta-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.template-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  transition: var(--transition);
  min-height: 140px;
}

.template-textarea:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ====================================================================
   TÍNH NĂNG 4: DASHBOARD BIỂU ĐỒ 6 KỲ & MA TRẬN CẢNH BÁO ĐỎ (TAB 4)
   ==================================================================== */
.dashboard-grid-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 24px;
}

@media (max-width: 860px) {
  .dashboard-grid-layout {
    grid-template-columns: 1fr;
  }
}

.dash-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.dash-box-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* SVG Bar Chart */
.chart-container-svg {
  width: 100%;
  height: 190px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding-top: 25px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border-subtle);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.chart-bar-rect {
  width: 100%;
  max-width: 38px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border-radius: 6px 6px 2px 2px;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s;
  cursor: pointer;
  position: relative;
  min-height: 4px;
}

.chart-bar-rect:hover {
  transform: scaleY(1.03);
  filter: brightness(1.2);
}

.chart-bar-rect.active {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.chart-bar-value {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6875rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.chart-bar-label {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Pareto 80/20 Visual */
.pareto-visual {
  margin-top: 10px;
}

.pareto-bar-track {
  width: 100%;
  height: 24px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  margin: 12px 0 8px 0;
  border: 1px solid var(--border-subtle);
}

.pareto-segment-vip {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0b0f19;
  transition: width 0.6s ease;
}

.pareto-segment-other {
  background: rgba(100, 116, 139, 0.3);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Radar Matrix (Action Required) */
.radar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
}

.radar-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px;
  margin-top: 14px;
}

.radar-item-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.radar-item-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.radar-item-card.type-critical {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(15, 23, 42, 0.72) 100%);
}

.radar-item-card.type-churn {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(15, 23, 42, 0.72) 100%);
}

.radar-item-card.type-birthday {
  border-left: 4px solid #d946ef;
  background: linear-gradient(135deg, rgba(217, 70, 239, 0.05) 0%, rgba(15, 23, 42, 0.72) 100%);
}

.radar-card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.radar-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.radar-customer-name {
  color: #f8fafc;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.radar-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  white-space: nowrap;
}

.radar-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.radar-product {
  font-size: 0.75rem;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.radar-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  margin-top: auto;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.radar-actions-comms,
.radar-actions-ops {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.radar-card-actions .btn-quick {
  padding: 5px 9px;
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* ====================================================================
   HEADER GUIDE BUTTON
   ==================================================================== */
.btn-guide-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(168, 85, 247, 0.22) 100%);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.15);
}

.btn-guide-header:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(168, 85, 247, 0.35) 100%);
  border-color: rgba(168, 85, 247, 0.65);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

/* ====================================================================
   DAILY ACTION RIBBON (Nhịp đập đầu ngày)
   ==================================================================== */
.daily-action-ribbon {
  position: relative;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.ribbon-glow {
  position: absolute;
  top: -20px;
  left: 20px;
  width: 160px;
  height: 60px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.ribbon-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ribbon-icon {
  font-size: 1.5rem;
  line-height: 1;
  animation: pulse-badge 2s infinite ease-in-out;
}

.ribbon-text {
  flex: 1;
  min-width: 260px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.ribbon-greeting {
  font-weight: 700;
  color: #f8fafc;
  display: block;
  margin-bottom: 2px;
}

.ribbon-desc {
  color: var(--text-secondary);
}

.ribbon-desc strong.text-danger {
  color: #f87171;
  font-weight: 700;
}

.ribbon-desc strong.text-accent {
  color: #d946ef;
  font-weight: 700;
}

.ribbon-desc strong.text-warning {
  color: #fbbf24;
  font-weight: 700;
}

.ribbon-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ribbon-action {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-ribbon-action.danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-ribbon-action.danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
}

.btn-ribbon-action.accent {
  background: rgba(217, 70, 239, 0.15);
  border: 1px solid rgba(217, 70, 239, 0.4);
  color: #f0abfc;
}

.btn-ribbon-action.accent:hover {
  background: rgba(217, 70, 239, 0.3);
  border-color: rgba(217, 70, 239, 0.6);
  color: #ffffff;
}

.btn-ribbon-action.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.btn-ribbon-action.warning:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.6);
  color: #ffffff;
}

/* ====================================================================
   SMART FILTER CHIPS
   ==================================================================== */
.filter-chip.chip-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
}

.filter-chip.chip-churn {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.filter-chip.chip-churn.active {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.filter-chip.chip-birthday {
  border-color: rgba(217, 70, 239, 0.35);
  color: #e879f9;
}

.filter-chip.chip-birthday.active {
  background: linear-gradient(135deg, #d946ef 0%, #c026d3 100%);
  color: #ffffff;
  border-color: #d946ef;
  box-shadow: 0 0 12px rgba(217, 70, 239, 0.4);
}

.filter-chip.chip-vip {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.filter-chip.chip-vip.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* ====================================================================
   TAB 5: CẨM NANG HƯỚNG DẪN & QUY TRÌNH (VIEW-GUIDE)
   ==================================================================== */
.guide-hero {
  position: relative;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.guide-hero-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  margin-bottom: 12px;
}

.guide-hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.guide-hero-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 850px;
  margin-bottom: 20px;
}

.guide-quick-tour {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.guide-tour-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
}

.guide-tour-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-tour {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn-tour.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-tour.danger:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-tour.accent {
  background: rgba(217, 70, 239, 0.15);
  border-color: rgba(217, 70, 239, 0.4);
  color: #f0abfc;
}
.btn-tour.accent:hover {
  background: rgba(217, 70, 239, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-tour.primary {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}
.btn-tour.primary:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-tour.info {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}
.btn-tour.info:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Guide Section & Grids */
.guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
}

.guide-section-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.guide-step-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.guide-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f8fafc;
}

.guide-section-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Flow Grid 4 Steps */
.guide-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.guide-flow-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.guide-flow-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.flow-step-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.flow-step-tag.step-1 { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
.flow-step-tag.step-2 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.flow-step-tag.step-3 { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.flow-step-tag.step-4 { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }

.flow-card-icon {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.flow-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}

.flow-card-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.flow-pro-tip {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid #818cf8;
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.4;
}

/* Features Grid */
.guide-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.guide-feature-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: var(--transition);
}

.guide-feature-box:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.feature-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.feature-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.feature-box-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.guide-feature-box p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guide-list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 4px;
}

/* Legend Grid */
.guide-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.legend-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-badge-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-badge-item .badge,
.legend-badge-item .badge-churn {
  flex-shrink: 0;
  min-width: 110px;
  text-align: center;
}

.legend-badge-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Playbook */
.guide-playbook-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.playbook-item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: var(--transition);
}

.playbook-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.playbook-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playbook-content {
  flex: 1;
}

.playbook-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 4px;
}

.playbook-trigger {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.playbook-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ====================================================================
   COMPREHENSIVE MOBILE & RESPONSIVE POLISH (TIÊU CHÍ 4: DI ĐỘNG HOÀN HẢO)
   ==================================================================== */

/* Global container & touch friendliness */
@media (max-width: 768px) {
  .container {
    padding: 0 16px; /* Chuẩn px-4 trên mobile/tablet */
  }
}

/* Header on mobile: Đảm bảo không vỡ dòng, vừa vặn mọi màn hình */
@media (max-width: 580px) {
  .brand-info p {
    display: none;
  }
  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .brand-info h1 {
    font-size: 1rem;
  }
  .btn-guide-header span {
    display: none;
  }
  .btn-guide-header {
    padding: 6px 9px;
  }
  #db-status-text {
    display: none;
  }
  .db-status-badge {
    padding: 7px 8px;
  }
}

/* Nav Tabs scroll and touch */
@media (max-width: 640px) {
  .nav-tabs {
    margin: 10px 0 16px;
    width: 100%;
    box-sizing: border-box;
    gap: 4px;
    padding: 3px;
    flex-wrap: wrap;
  }
  .nav-tab {
    padding: 8px 12px;
    font-size: 0.8125rem;
    gap: 6px;
    flex: 1 1 auto;
    justify-content: center;
  }
  .nav-tab svg {
    width: 16px;
    height: 16px;
  }
  .nav-tab .tab-badge {
    display: none;
  }
}

/* Card Quick Actions: 2x2 Grid ngón tay bấm tiện lợi trên phone */
@media (max-width: 480px) {
  .card-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .btn-quick {
    justify-content: center;
    padding: 8px 6px;
    font-size: 0.75rem;
  }
}

/* Modals Mobile Optimization: cuộn nội bộ, cố định nút bấm không bao giờ bị che khuất */
.modal-content {
  max-height: min(90vh, 720px);
  max-height: min(calc(100dvh - 32px), 720px);
  display: flex;
  flex-direction: column;
}

.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-content {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh;
    max-height: calc(100dvh - 20px);
    margin-bottom: 0;
  }
  .modal-footer {
    padding: 12px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}

/* Daily Action Ribbon on Mobile */
@media (max-width: 640px) {
  .daily-action-ribbon {
    padding: 12px 14px;
    margin-bottom: 14px;
  }
  .ribbon-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .ribbon-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .btn-ribbon-action {
    text-align: center;
    padding: 8px 10px;
  }
}

/* Guide Tab 5 on Mobile */
@media (max-width: 640px) {
  .guide-hero {
    padding: 18px 14px;
    margin-bottom: 16px;
  }
  .guide-hero-title {
    font-size: 1.25rem;
  }
  .guide-quick-tour {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .guide-tour-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }
  .btn-tour {
    width: 100%;
    text-align: center;
    padding: 8px 12px;
  }
  .guide-section {
    padding: 16px 14px;
    margin-bottom: 16px;
  }
  .playbook-item {
    flex-direction: column;
    gap: 10px;
  }
}

/* ====================================================================
   TIMELINE & INTERACTION HISTORY STYLES
   ==================================================================== */
.timeline {
  position: relative;
  padding: 8px 0;
}

.timeline-item {
  transition: var(--transition);
}

.timeline-item:hover {
  filter: brightness(1.05);
}

#interaction-form-container {
  animation: slideDown 0.25s ease-out;
}

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

/* ====================================================================
   TRASH & SOFT-DELETE RECOVERY STYLES (14 NGÀY LƯU TRỮ)
   ==================================================================== */
.trash-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.trash-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(15, 23, 42, 0.9);
}

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

.trash-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.trash-card-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #f8fafc;
}

.trash-card-company {
  font-size: 0.8125rem;
  color: #94a3b8;
}

.trash-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.trash-badge-remaining {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
}

.trash-badge-normal {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.trash-badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.trash-badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: pulse 2s infinite;
}

.trash-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-restore-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-restore-item:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  transform: translateY(-1px);
}

.btn-delete-perm-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-delete-perm-item:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  border-color: #ef4444;
}

.toast-action-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 10px;
  transition: all 0.15s ease;
}

.toast-action-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.03);
}

/* ====================================================================
   NÚT CUỘN LÊN ĐẦU TRANG (BACK TO TOP)
   ==================================================================== */
.btn-back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4), 0 2px 8px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 990;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.85);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s,
              background 0.2s,
              box-shadow 0.2s;
  outline: none;
}

.btn-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.btn-back-to-top:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.6), 0 0 16px rgba(52, 211, 153, 0.5);
  transform: translateY(-3px) scale(1.08);
}

.btn-back-to-top:active {
  transform: translateY(0) scale(0.95);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

@media (max-width: 640px) {
  .btn-back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

/* ====================================================================
   CLICKABLE CARD HOVER EFFECTS
   ==================================================================== */
.ranking-card.cursor-pointer,
.schedule-card.cursor-pointer {
  transition: all 0.2s ease;
  cursor: pointer;
}
.ranking-card.cursor-pointer:hover,
.schedule-card.cursor-pointer:hover {
  background-color: var(--bg-card-hover, #1f2937);
  border-color: var(--emerald-border, rgba(16, 185, 129, 0.35));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ====================================================================
   RESPONSIVE DESIGN OVERHAUL (ALL TABS)
   ==================================================================== */

/* --- TABLET (641px - 1024px) --- */
@media (max-width: 1024px) and (min-width: 641px) {
  .main-container { padding: 16px; }
  .customer-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .filter-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .dashboard-grid-layout { grid-template-columns: 1fr !important; }
  .care-stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  
  .modal-content {
    width: 90% !important;
    max-width: 700px !important;
  }
}

/* --- MOBILE (<= 640px) --- */
@media (max-width: 640px) {
  /* Layout */
  .main-container { padding: 12px; }
  
  /* Header & Nav Tabs */
  .nav-tabs {
    padding-bottom: 5px !important; 
  }
  
  .nav-btn {
    flex-shrink: 0;
    padding: 10px 16px !important;
    font-size: 0.875rem !important;
    white-space: nowrap;
  }

  /* Grids */
  .customer-grid, .stats-grid, .filter-grid, .dashboard-grid-layout, .care-stats-row {
    grid-template-columns: 1fr !important;
  }
  
  /* Ranking Cards */
  .ranking-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px !important;
  }
  .ranking-customer-info, .ranking-revenue-info, .ranking-actions {
    width: 100% !important;
  }
  .ranking-revenue-info { justify-content: space-between !important; }
  .ranking-actions { justify-content: flex-end !important; }
  
  /* Schedule Cards */
  .schedule-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .schedule-customer-info { width: 100% !important; }
  .schedule-card-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    flex-wrap: wrap;
    gap: 8px !important;
    margin-top: 8px;
  }
  .schedule-card-actions button {
    flex: 1 1 auto;
    text-align: center;
  }

  /* Modals */
  .modal-content {
    width: 95% !important;
    max-width: 100% !important;
    margin: 10px auto !important;
  }
  .modal-body {
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
    padding: 16px !important;
  }
  .form-grid { grid-template-columns: 1fr !important; }
  .modal-footer {
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .modal-footer .btn-secondary,
  .modal-footer .btn-primary {
    width: 100% !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
  }
  .form-group.full-width { grid-column: span 1 !important; }
}

/* --- DESKTOP (>= 1025px) --- */
@media (min-width: 1025px) {
  .customer-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .stats-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* ==========================================================================
   MODAL CHI TIẾT LỊCH CHĂM SÓC MỚI (CARE DETAILS)
   ========================================================================== */
.care-details-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modal-fade-in 0.25s ease-out forwards, modal-zoom-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-zoom-in { from { transform: scale(0.95); } to { transform: scale(1); } }

/* Khối 1: Header */
.cdm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px 12px 0 0;
}
.cdm-header-info { display: flex; flex-direction: column; gap: 6px; }
.cdm-customer-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cdm-customer-name-row h3 { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--text-bright); }
.cdm-customer-meta { font-size: 0.85rem; color: var(--text-muted); }
.cdm-header-actions { display: flex; align-items: center; gap: 8px; }

/* Các nút liên hệ nhanh */
.cdm-quick-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 12px; font-size: 0.85rem; font-weight: 500; border-radius: 6px;
  text-decoration: none; transition: all 0.2s ease;
}
.cdm-btn-call { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.cdm-btn-call:hover { background: rgba(16, 185, 129, 0.2); }
.cdm-btn-zalo { background: rgba(59, 130, 246, 0.1); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
.cdm-btn-zalo:hover { background: rgba(59, 130, 246, 0.2); }
.cdm-btn-email { background: rgba(168, 85, 247, 0.1); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.2); }
.cdm-btn-email:hover { background: rgba(168, 85, 247, 0.2); }

/* Khối chung */
.cdm-section-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }

/* Khối 2: Task */
.cdm-task-section { padding: 20px; border-bottom: 1px solid var(--border); }
.cdm-task-card { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 12px 16px; }
.cdm-task-row { display: flex; gap: 24px; margin-bottom: 12px; }
.cdm-task-col { display: flex; flex-direction: column; gap: 4px; }
.cdm-label { font-size: 0.8125rem; color: var(--text-muted); }
.cdm-value { font-size: 0.9rem; font-weight: 500; color: var(--text-bright); }
.cdm-task-note { border-top: 1px solid rgba(255, 255, 255, 0.05); padding-top: 12px; }
.cdm-desc-box { font-size: 0.9rem; color: var(--text-normal); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }

/* Khối 3: AI Assistant */
.cdm-ai-section { padding: 20px; border-bottom: 1px solid var(--border); background: rgba(99, 102, 241, 0.03); }
.cdm-ai-script-box { position: relative; display: flex; flex-direction: column; gap: 10px; }
.cdm-ai-textarea { width: 100%; min-height: 80px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; color: var(--text-bright); font-size: 0.9rem; resize: none; line-height: 1.4; outline: none; }
.cdm-ai-textarea:focus { border-color: var(--primary); }
.cdm-ai-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Khối 4: Context & Logs */
.cdm-context-section { padding: 20px; background: var(--surface); border-radius: 0 0 12px 12px; }
.cdm-split-row { display: flex; gap: 20px; }
.cdm-context-left { flex: 1; border-right: 1px solid var(--border); padding-right: 20px; }
.cdm-context-right { flex: 1.2; display: flex; flex-direction: column; }

/* Context left */
.cdm-service-card { display: flex; flex-direction: column; gap: 8px; background: rgba(255, 255, 255, 0.02); padding: 10px; border-radius: 6px; }
.cdm-svc-item { display: flex; justify-content: space-between; font-size: 0.85rem; }
.cdm-timeline-mini { display: flex; flex-direction: column; gap: 8px; max-height: 120px; overflow-y: auto; padding-right: 4px; }
.cdm-timeline-item { padding-left: 12px; position: relative; border-left: 2px solid var(--border); font-size: 0.8125rem; margin-bottom: 4px; }
.cdm-timeline-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.cdm-timeline-item.done::before { background: #10b981; }
.cdm-timeline-date { color: var(--text-muted); font-size: 0.75rem; margin-bottom: 2px; }
.cdm-timeline-content { color: var(--text-normal); }

/* Context right */
.cdm-log-textarea { flex: 1; min-height: 80px; margin-bottom: 12px; resize: none; }
.cdm-action-group { display: flex; flex-direction: column; gap: 8px; }
.cdm-btn-full { width: 100%; justify-content: center; }
.cdm-reschedule-box { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.03); padding: 8px; border-radius: 6px; border: 1px solid var(--border); }
.cdm-btn-success { background: #10b981; color: white; border: none; }
.cdm-btn-success:hover { background: #059669; }

/* =========================================================================
   CARE DETAILS MODAL (CAM) - REACT UI PORTED
   ========================================================================= */
.cam-overlay { position: fixed; inset: 0; background: rgba(8, 9, 13, 0.72); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 24px; animation: cam-overlay-in 0.18s ease-out; }
.cam-overlay.active { display: flex; }
@keyframes cam-overlay-in { from { opacity: 0; } to { opacity: 1; } }
.cam-modal { width: 100%; max-width: 560px; max-height: min(88vh, 880px); background: #15171d; border: 1px solid #262a34; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.55); display: flex; flex-direction: column; overflow: hidden; color: #e7e8ee; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; animation: cam-modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes cam-modal-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.cam-header { position: relative; padding: 22px 24px 18px; background: linear-gradient(160deg, #1b1f29 0%, #15171d 65%); border-bottom: 1px solid #23262f; flex-shrink: 0; }
.cam-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid #2a2e39; background: #1c1f28; color: #9aa0ae; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s, color 0.15s; }
.cam-close:hover { background: #262a35; color: #e7e8ee; }
.cam-header-top { display: flex; gap: 14px; align-items: flex-start; padding-right: 36px; }
.cam-avatar { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, #5b6ef5, #8b7cf6); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; color: #fff; flex-shrink: 0; }
.cam-identity { min-width: 0; }
.cam-name { margin: 2px 0 8px; font-size: 17px; font-weight: 600; color: #f2f3f7; line-height: 1.3; }
.cam-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-badge { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.badge-vip { background: rgba(224,168,62,0.14); color: #e0a83e; border-color: rgba(224,168,62,0.3); }
.badge-new { background: rgba(91,124,250,0.14); color: #7c9bff; border-color: rgba(91,124,250,0.3); }
.badge-old { background: rgba(140,148,166,0.12); color: #9aa0ae; border-color: rgba(140,148,166,0.25); }
.badge-waiting { background: rgba(224,168,62,0.14); color: #e0a83e; border-color: rgba(224,168,62,0.3); }
.badge-confirmed { background: rgba(76,195,138,0.14); color: #4cc38a; border-color: rgba(76,195,138,0.3); }
.badge-overdue { background: rgba(241,101,101,0.14); color: #f16565; border-color: rgba(241,101,101,0.3); }
.badge-staff { background: #1e222c; color: #9aa0ae; border-color: #2a2e39; }
.cam-quick-actions { display: flex; gap: 8px; margin-top: 16px; }
.cam-action-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 9px 10px; border-radius: 10px; border: 1px solid #2a2e39; background: #1c1f28; color: #e7e8ee; text-decoration: none; cursor: pointer; transition: transform 0.12s, background 0.15s, border-color 0.15s; }
.cam-action-btn:hover { transform: translateY(-1px); }
.cam-action-call:hover { background: rgba(91,124,250,0.12); border-color: rgba(91,124,250,0.4); color: #7c9bff; }
.cam-action-zalo:hover { background: rgba(76,195,138,0.12); border-color: rgba(76,195,138,0.4); color: #4cc38a; }
.cam-action-mail:hover { background: rgba(224,168,62,0.12); border-color: rgba(224,168,62,0.4); color: #e0a83e; }
.cam-body { overflow-y: auto; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; }
.cam-body::-webkit-scrollbar { width: 8px; }
.cam-body::-webkit-scrollbar-thumb { background: #2a2e39; border-radius: 8px; }
.cam-section { display: flex; flex-direction: column; gap: 10px; }
.cam-section-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; color: #9aa0ae; margin: 0; display:flex; align-items:center; gap:6px; }
.cam-task-meta { display: flex; gap: 10px; }
.cam-meta-item { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cam-meta-label { font-size: 11.5px; color: #6b7280; }
.cam-meta-value { font-size: 13.5px; font-weight: 600; color: #e7e8ee; }
.cam-tag { display: inline-flex; width: fit-content; padding: 4px 10px; border-radius: 7px; background: #1e222c; border: 1px solid #2a2e39; color: #c8cbd6; font-size: 12.5px; }
.cam-due { display: flex; align-items: center; gap: 5px; color: #e0a83e; }
.cam-note-box { background: #1a1d24; border: 1px solid #23262f; border-radius: 10px; padding: 12px 14px; }
.cam-note-text { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; color: #d4d6de; }
.cam-ai-block { background: linear-gradient(150deg, rgba(139,124,246,0.08), rgba(91,110,245,0.04)); border: 1px solid rgba(139,124,246,0.28); border-radius: 14px; padding: 16px; position: relative; }
.cam-ai-title { color: #b3a4fb; }
.cam-ai-tabs { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.cam-ai-tab { font-size: 12px; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid #2a2e39; background: #1a1d24; color: #9aa0ae; cursor: pointer; transition: all 0.15s; }
.cam-ai-tab-active { background: rgba(139,124,246,0.18); border-color: rgba(139,124,246,0.5); color: #cabdfc; }
.cam-ai-content { margin-top: 12px; font-size: 13.5px; line-height: 1.6; color: #dcdee6; background: #14161c; border: 1px solid #23262f; border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; min-height:80px; }
.cam-ai-actions { display: flex; gap: 8px; margin-top: 12px; }
.cam-btn { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: transform 0.12s, background 0.15s, opacity 0.15s; }
.cam-btn:hover { transform: translateY(-1px); }
.cam-btn-ghost { background: #1c1f28; border-color: #2a2e39; color: #e7e8ee; }
.cam-btn-ghost:hover { background: #232733; }
.cam-btn-violet { background: linear-gradient(135deg, #6c6ff5, #8b7cf6); color: #fff; flex: 1; }
.cam-btn-success { background: rgba(76,195,138,0.14); border-color: rgba(76,195,138,0.35); color: #4cc38a; }
.cam-btn-success:hover { background: rgba(76,195,138,0.22); }
.cam-btn-outline { background: #1c1f28; border-color: #2a2e39; color: #d4d6de; }
.cam-btn-outline:hover { background: #232733; }
.cam-btn-muted { background: rgba(241,101,101,0.1); border-color: rgba(241,101,101,0.28); color: #f16565; }
.cam-btn-muted:hover { background: rgba(241,101,101,0.18); }
.cam-service-card { display: flex; align-items: center; gap: 12px; background: #1a1d24; border: 1px solid #23262f; border-radius: 10px; padding: 12px 14px; }
.cam-service-icon { width: 36px; height: 36px; border-radius: 9px; background: rgba(91,124,250,0.14); color: #7c9bff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cam-service-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cam-service-name { font-size: 13.5px; font-weight: 600; color: #e7e8ee; }
.cam-service-sub { font-size: 12px; color: #8890a0; }
.cam-service-revenue { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cam-revenue-value { font-size: 13.5px; font-weight: 700; color: #4cc38a; }
.cam-timeline { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; }
.cam-timeline-item { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.cam-timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 3px; top: 20px; bottom: -6px; width: 1px; background: #262a34; }
.cam-timeline-dot { width: 7px; height: 7px; border-radius: 50%; background: #5b6ef5; margin-top: 5px; flex-shrink: 0; }
.cam-timeline-content { display: flex; flex-direction: column; gap: 2px; }
.cam-timeline-date { font-size: 11.5px; color: #6b7280; display: flex; align-items: center; gap: 4px; }
.cam-timeline-note { font-size: 13px; color: #c8cbd6; line-height: 1.4; }
.cam-empty-text { font-size: 13px; color: #6b7280; margin: 0; }
.cam-log-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.cam-textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; background: #14161c; border: 1px solid #262a34; border-radius: 9px; padding: 10px 12px; color: #e7e8ee; font-size: 13.5px; font-family: inherit; line-height: 1.5; }
.cam-textarea:focus { outline: none; border-color: #5b6ef5; }
.cam-textarea::placeholder { color: #565c6b; }
.cam-reschedule-row { display: flex; margin-top: 6px; }
.cam-date-input { width: 100%; box-sizing: border-box; background: #14161c; border: 1px solid #262a34; border-radius: 8px; padding: 8px 10px; color: #e7e8ee; font-size: 13px; font-family: inherit; color-scheme: dark; }
.cam-date-input:focus { outline: none; border-color: #5b6ef5; }
.cam-log-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cam-log-actions .cam-btn { flex: 1; min-width: 140px; }
.cam-flash { font-size: 12.5px; font-weight: 600; color: #4cc38a; background: rgba(76,195,138,0.1); border: 1px solid rgba(76,195,138,0.28); border-radius: 8px; padding: 7px 11px; animation: cam-flash-in 0.18s ease-out; margin-top: 4px; text-align: center; }
@keyframes cam-flash-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 480px) {
  .cam-overlay { padding: 0; align-items: flex-end; }
  .cam-modal { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .cam-quick-actions { flex-wrap: wrap; }
  .cam-action-btn { min-width: 100px; }
}

/* ==========================================================================
   AUTH OVERLAY STYLES
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-container {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-brand .brand-icon {
  margin: 0 auto 16px;
}
.auth-brand h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  color: var(--text-main);
}
.auth-brand p {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.9rem;
}
.auth-form .form-group {
  margin-bottom: 16px;
}
.auth-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-sub);
}
.auth-form input {
  width: 100%;
  padding: 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(91, 110, 245, 0.2);
}
