/* Inter Office CRM — assets/css/app.css */
:root {
  --primary: #c82127;
  --primary-hover: #b01c22;
  --primary-dark: #8f1419;
  --primary-soft: rgba(200, 33, 39, 0.08);
  --primary-glow: rgba(200, 33, 39, 0.25);
  
  --secondary: #475569;
  --secondary-hover: #334155;
  
  --ink: #0f172a;
  --ink-light: #1e293b;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  
  --ground: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  
  --border: #e2e8f0;
  --border-focus: #c82127;
  
  --good: #10b981;
  --good-bg: #ecfdf5;
  --warn: #f59e0b;
  --warn-bg: #fffbeb;
  --crit: #ef4444;
  --crit-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  --font-sans: 'Inter', sans-serif;
  --font-mono: 'Inter', sans-serif;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-sans) !important;
  background-color: var(--ground);
  color: var(--ink);
  line-height: 1.5;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Accessibility Skip Link */
.crm-skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: #ffffff !important;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 99999;
  transition: top 0.2s ease;
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.crm-skip-link:focus {
  top: 16px;
  outline: 2px solid #ffffff;
}

/* Accessibility Focus Visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* Micro-interaction Feedback */
.btn {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn:active {
  transform: scale(0.98);
}
.nav-item {
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.nav-item:active {
  transform: scale(0.99);
}

body.crm-login-body {
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background-color: #ffffff;
}

a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { 
  font-family: var(--font-sans) !important; 
  font-size: inherit; 
}

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

/* Sidebar — Màu đen nhẹ cao cấp & Cấu trúc theo mẫu Shoppino */
.sidebar {
  width: 250px;
  background: #16181f; /* Màu đen nhẹ hiện đại */
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  position: relative;
}

/* 1. Logo Area */
.sidebar-logo-area {
  padding: 24px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.sidebar-logo-link {
  display: inline-block;
  line-height: 1;
  text-decoration: none;
}
.sidebar-logo-img {
  height: 36px;
  width: auto;
  max-width: 195px;
  object-fit: contain;
  display: block;
}

/* 2. Navigation Menu */
.sidebar-nav {
  padding: 0 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.sidebar-nav-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 12px 4px;
  margin-bottom: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}
.nav-item.active {
  background: rgba(200, 33, 39, 0.18);
  color: #ffffff;
  font-weight: 600;
}
.nav-item.active .nav-icon {
  color: #f87171;
  stroke: #f87171;
}
.nav-active-pill {
  display: none;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(200, 33, 39, 0.6);
}
.nav-item.active .nav-active-pill {
  display: block;
}
.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
  transition: color 0.15s;
}

/* Disabled Nav Item (Sắp ra mắt) */
.nav-item.nav-item-disabled {
  cursor: default !important;
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}
.nav-item.nav-item-disabled:hover {
  background: transparent !important;
  color: #94a3b8 !important;
}
.nav-badge-upcoming {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1.3;
}

/* 4. Bottom of Sidebar - Sidebar Footer User Box */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  position: relative;
  margin-top: auto;
  flex-shrink: 0;
}
.sidebar-user-menu {
  position: relative;
  width: 100%;
}
.sidebar-user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  color: #ffffff;
  box-sizing: border-box;
  outline: none;
}
.sidebar-user-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.sidebar-user-menu.active .sidebar-user-btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(200, 33, 39, 0.5);
  box-shadow: 0 0 0 2px rgba(200, 33, 39, 0.25);
}
.sidebar-user-avatar-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-user-avatar-circle,
#sidebar-user-avatar-img,
.sidebar-user-avatar-wrap img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 50% !important;
  -webkit-border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
}
.sidebar-user-avatar-wrap .user-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background: #22c55e;
  border: 1.5px solid #16181f;
  border-radius: 50%;
  box-shadow: 0 0 4px #22c55e;
  z-index: 2;
}
.sidebar-user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
  flex: 1;
}
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  letter-spacing: -0.01em;
}
.sidebar-user-role {
  font-size: 10.5px;
  font-weight: 400;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  margin-top: 2px;
}
.sidebar-user-menu .user-chevron {
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s;
  flex-shrink: 0;
  margin-left: 2px;
}
.sidebar-user-menu.active .user-chevron {
  transform: rotate(180deg);
  color: #ffffff;
}

/* Sidebar User Dropup Menu */
.sidebar-user-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 250px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 -8px 28px -4px rgba(16, 24, 40, 0.2), 0 4px 12px -2px rgba(16, 24, 40, 0.08);
  padding: 0;
  z-index: 1050;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}
.sidebar-user-menu.active .sidebar-user-dropdown {
  display: block;
  animation: sidebarUserDropupAnim 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sidebarUserDropupAnim {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ground);
}

/* Topbar */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  position: relative;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.btn-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-sidebar-toggle:hover {
  background: var(--surface-2);
  color: var(--primary);
  border-color: #cbd5e1;
}
.view-title { 
  font-size: 16px; 
  font-weight: 700; 
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  flex-shrink: 0;
}

/* 1. Nút WP-Admin đồng bộ size */
.topbar-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  flex-shrink: 0;
}

.topbar-admin-btn:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
  color: var(--ink);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.topbar-admin-btn svg {
  color: var(--ink-faint);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.topbar-admin-btn:hover svg {
  color: var(--primary);
}

/* 2. Topbar Date Filter Dropdown */
.topbar-date-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-date-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  outline: none;
  flex-shrink: 0;
}

.topbar-date-btn:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.topbar-date-filter.active .topbar-date-btn {
  background: var(--surface-2);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(200, 33, 39, 0.12);
}

.topbar-date-btn svg:not(.chevron-icon) {
  color: var(--primary);
  flex-shrink: 0;
}

.topbar-date-btn .chevron-icon {
  color: var(--ink-faint);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  margin-left: 2px;
}

.topbar-date-filter.active .topbar-date-btn .chevron-icon {
  transform: rotate(180deg);
  color: var(--primary);
}
.date-filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 275px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  padding: 8px;
  z-index: 200;
  animation: fadeIn 0.15s ease;
  font-family: 'Inter', sans-serif !important;
}
.topbar-date-filter.active .date-filter-dropdown {
  display: block;
}
.date-filter-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: 'Inter', sans-serif !important;
}
.date-filter-opt:hover {
  background: var(--surface-2);
}
.date-filter-opt.active {
  background: rgba(200, 33, 39, 0.08);
  color: var(--primary);
  font-weight: 600;
}
.date-filter-opt .range-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-family: 'Inter', sans-serif !important;
}
.date-filter-opt.active .range-hint {
  color: var(--primary);
}
.date-filter-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.date-filter-custom {
  padding: 6px 4px 2px;
  font-family: 'Inter', sans-serif !important;
}
.custom-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: none !important; /* Không viết in hoa */
  letter-spacing: normal;
  font-family: 'Inter', sans-serif !important;
}
.custom-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}
.custom-sep {
  color: var(--ink-faint);
  font-size: 12px;
  flex-shrink: 0;
}
.date-input-mini {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 30px;
  font-size: 11.5px;
  font-family: 'Inter', sans-serif !important;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.date-input-mini:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.date-input-mini::-webkit-datetime-edit,
.date-input-mini::-webkit-datetime-edit-fields-wrapper,
.date-input-mini::-webkit-datetime-edit-text,
.date-input-mini::-webkit-datetime-edit-month-field,
.date-input-mini::-webkit-datetime-edit-day-field,
.date-input-mini::-webkit-datetime-edit-year-field {
  font-family: 'Inter', sans-serif !important;
  font-size: 11.5px;
  color: var(--ink);
}
.date-input-mini::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
  padding: 0;
  margin-left: 2px;
}
.date-input-mini::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
.btn-xs {
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
  font-family: 'Inter', sans-serif !important;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   TOPBAR USER ACCOUNT (PHƯƠNG ÁN 1: CLEAN EXECUTIVE)
   ========================================================================== */
.topbar-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 2px 10px 2px 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  outline: none;
  flex-shrink: 0;
}

.topbar-user-btn:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.topbar-user-menu.active .topbar-user-btn {
  background: var(--surface-2);
  border-color: #cbd5e1;
}

.topbar-user-avatar-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
  box-shadow: 0 0 0 1.5px #ffffff;
}

.topbar-user-avatar-wrap .user-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
}

.topbar-user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.15;
  min-width: 0;
}

.topbar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.topbar-user-role {
  font-size: 10px;
  font-weight: 400;
  color: #64748b;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chevron {
  color: var(--ink-faint);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.15s;
  flex-shrink: 0;
  margin-left: 2px;
}

.topbar-user-menu.active .user-chevron {
  transform: rotate(180deg);
  color: #475569;
}

/* User Dropdown Box — Clean Executive Popover */
.topbar-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 268px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 32px -4px rgba(16, 24, 40, 0.12), 0 4px 12px -2px rgba(16, 24, 40, 0.04);
  padding: 0;
  z-index: 1050;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.topbar-user-menu.active .topbar-user-dropdown {
  display: block;
  animation: cleanExecutiveDropdownAnim 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1. Header Khối Riêng */
.user-dropdown-header {
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-dropdown-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-dropdown-header-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.user-dropdown-header-info {
  flex: 1;
  min-width: 0;
}

.user-dropdown-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.user-dropdown-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.user-dropdown-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #c82127;
  background: rgba(200, 33, 39, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(200, 33, 39, 0.2);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.user-dropdown-login {
  font-size: 11px;
  color: #64748b;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2. Thân Menu */
.user-dropdown-body {
  padding: 6px;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
  user-select: none;
}

.user-dropdown-item:hover {
  background: #f8fafc;
}

.dropdown-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.user-dropdown-item:hover .dropdown-item-icon {
  background: rgba(200, 33, 39, 0.08);
  color: #c82127;
}

.dropdown-item-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.dropdown-item-title {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
}

.dropdown-item-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* 3. Chân Menu: Đăng xuất */
.user-dropdown-footer {
  border-top: 1px solid #f1f5f9;
  padding: 6px;
  background: #ffffff;
}

.user-dropdown-item.item-logout:hover {
  background: #fff1f2;
}

.user-dropdown-item.item-logout .icon-logout {
  background: #fee2e2;
  color: #e11d48;
}

.user-dropdown-item.item-logout:hover .icon-logout {
  background: #fecdd3;
  color: #be123c;
}

.logout-text {
  color: #be123c !important;
  font-weight: 600 !important;
}

@keyframes cleanExecutiveDropdownAnim {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 12px !important;
    height: 52px !important;
  }
  .topbar-left {
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
  .topbar-left .view-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .topbar-admin-btn {
    display: none !important; /* Ẩn nút WP-Admin trên mobile để tránh chật chội và đè chữ Dashboard */
  }
  .topbar-date-btn {
    padding: 0 8px !important;
    height: 32px !important;
    font-size: 11.5px !important;
  }
  .topbar-date-btn span {
    max-width: 70px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .topbar-user-btn {
    padding: 2px !important;
    height: 32px !important;
    width: 32px !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }
  .topbar-user-details,
  .topbar-user-btn .user-chevron {
    display: none !important;
  }
  .topbar-user-avatar-wrap {
    width: 26px !important;
    height: 26px !important;
  }
  .dash-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .dash-actions .btn {
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: center !important;
  }
}

/* Content Container */
.content-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 24px 44px 24px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.content-container::-webkit-scrollbar,
.my-tasks-container::-webkit-scrollbar,
.recent-projects-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.content-container::-webkit-scrollbar-track,
.my-tasks-container::-webkit-scrollbar-track,
.recent-projects-container::-webkit-scrollbar-track {
  background: transparent;
}
.content-container::-webkit-scrollbar-thumb,
.my-tasks-container::-webkit-scrollbar-thumb,
.recent-projects-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.content-container::-webkit-scrollbar-thumb:hover,
.my-tasks-container::-webkit-scrollbar-thumb:hover,
.recent-projects-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Common Panels & Cards */
.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }

/* Filter & Action Bars */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Form Controls */
.form-control {
  width: 100%;
  box-sizing: border-box;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea.form-control { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-with-suffix .form-control {
  padding-right: 46px;
}
.input-suffix {
  position: absolute;
  right: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}
.link-doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.link-doc-card:hover {
  border-color: rgba(200, 33, 39, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.link-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.link-doc-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-open-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}
.btn-open-link.disabled {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* Data Tables */
.table-responsive {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.8px;
}
.data-table th {
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12.8px;
  text-transform: none !important;
  letter-spacing: normal;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.1s; cursor: pointer; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Chips / Badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-crit { background: var(--crit-bg); color: var(--crit); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-neutral { background: var(--surface-3); color: var(--ink-soft); }

/* ==========================================================================
   DASHBOARD STYLING — INTER OFFICE CRM
   ========================================================================== */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.dash-welcome-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.dash-welcome-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.dash-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-actions .btn {
  height: 32px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dash-actions .btn svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.dash-actions .btn:hover svg {
  transform: scale(1.08);
}
.dash-actions .btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--ink);
}
.dash-actions .btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.dash-actions .btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.dash-actions .btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(200, 33, 39, 0.25);
}

/* 5 KPI Cards Grid — Nền trắng cao cấp hiện đại */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
/* Laptop 1200px - 1366px: Chống rớt dòng tiêu đề */
@media (max-width: 1366px) and (min-width: 1101px) {
  .kpi-grid {
    gap: 10px;
  }
  .kpi-card {
    padding: 14px 10px 12px 10px !important;
    min-height: 112px !important;
  }
  .kpi-card-main {
    gap: 10px !important;
  }
  .kpi-icon-box {
    width: 38px !important;
    height: 38px !important;
    border-radius: 9px !important;
  }
  .kpi-icon-box svg {
    width: 19px !important;
    height: 19px !important;
  }
  .kpi-card .kpi-label {
    font-size: 12px !important;
  }
  .kpi-card .kpi-value {
    font-size: 24px !important;
  }
  .kpi-comparison-text {
    font-size: 11px !important;
  }
  .donut-canvas-col {
    width: 155px !important;
    height: 155px !important;
  }
  .donut-center-num {
    font-size: 23px !important;
  }
}
/* Tablet 641px - 1100px: 2 cột, thẻ thứ 5 full width cân xứng */
@media (max-width: 1100px) and (min-width: 641px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .kpi-grid .kpi-card:nth-child(5) {
    grid-column: 1 / -1 !important;
  }
}
/* Mobile <= 640px: 2 cột nhỏ gọn, thẻ thứ 5 full width */
@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
    margin-bottom: 16px;
  }
  .kpi-grid .kpi-card:nth-child(5) {
    grid-column: 1 / -1 !important;
  }
  .kpi-card {
    padding: 12px 10px !important;
    min-height: 88px !important;
    border-radius: 12px !important;
  }
  .kpi-card-main {
    gap: 8px !important;
  }
  .kpi-icon-box {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
  }
  .kpi-icon-box svg {
    width: 17px !important;
    height: 17px !important;
  }
  .kpi-card .kpi-label {
    font-size: 11.5px !important;
  }
  .kpi-card .kpi-value {
    font-size: 20px !important;
  }
  .kpi-card-footer {
    margin-top: 8px !important;
  }
  .kpi-comparison-text {
    font-size: 10px !important;
  }
  .kpi-trend-pill {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
}

.kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px 16px 14px 16px;
  min-height: 120px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.kpi-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.kpi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

.kpi-icon-box svg {
  width: 22px;
  height: 22px;
  display: block;
}

.kpi-solid-red {
  background: #c0262b;
  color: #ffffff;
}

.kpi-solid-orange {
  background: #ea580c;
  color: #ffffff;
}

.kpi-solid-green {
  background: #16a34a;
  color: #ffffff;
}

.kpi-solid-blue {
  background: #2563eb;
  color: #ffffff;
}

.kpi-solid-purple {
  background: #7c3aed;
  color: #ffffff;
}

.kpi-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
}

.kpi-card .kpi-label {
  font-size: 13.5px;
  font-weight: 500;
  color: #0f172a !important;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 2px;
  white-space: normal;
  word-break: keep-all;
}

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #000000 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0;
}

.kpi-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.kpi-comparison-text {
  font-size: 12.5px;
  color: #334155;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
}

.kpi-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2.5px 7px;
  border-radius: 9999px;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.kpi-trend-pill.trend-up {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.kpi-trend-pill.trend-down {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.kpi-trend-pill.trend-neutral {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.kpi-trend-pill .trend-icon {
  flex-shrink: 0;
}
.kpi-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.kpi-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10.5px;
  white-space: nowrap;
}
.kpi-tag-good { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.kpi-tag-info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.kpi-tag-amber { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.kpi-tag-indigo { background: #eef2ff; color: #4f46e5; border: 1px solid #c7d2fe; }
.kpi-tag-neutral { background: var(--surface-2); color: var(--ink-light); border: 1px solid var(--border); }
.kpi-sub-text {
  color: var(--ink-faint);
  font-size: 10.5px;
  white-space: nowrap;
}

/* 4 Interactive Alert Cards (Đồng bộ chiều cao và bố cục với 5 card trên) */
.dash-alert-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 1100px) {
  .dash-alert-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .dash-alert-grid { grid-template-columns: 1fr; }
}

.alert-kpi-card {
  cursor: pointer;
}
.alert-card-red:hover {
  border-color: #fca5a5 !important;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.08) !important;
}
.alert-card-amber:hover {
  border-color: #fcd34d !important;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.08) !important;
}
.alert-card-orange:hover {
  border-color: #fdba74 !important;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.08) !important;
}
.alert-card-blue:hover {
  border-color: #93c5fd !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08) !important;
}

.kpi-val-alert-red { color: #dc2626 !important; }
.kpi-val-alert-amber { color: #d97706 !important; }
.kpi-val-alert-orange { color: #ea580c !important; }
.kpi-val-alert-blue { color: #2563eb !important; }

.kpi-icon-orange { color: #ea580c; }

.kpi-action-arrow {
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.alert-kpi-card:hover .kpi-action-arrow {
  color: #0f172a;
  background: #ffffff;
  transform: translateX(3px);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Row 2: Charts Grid - Responsive Executive Layout */
.dash-charts-grid,
.dash-row2-grid {
  display: grid;
  grid-template-columns: minmax(0, 31fr) minmax(0, 40fr) minmax(0, 29fr);
  gap: 16px;
  margin-bottom: 22px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
/* Medium Desktop, Laptops & Tablet Landscape (769px - 1340px): Card 1 full width, Card 2 & 3 chia 2 cột bên dưới */
@media (min-width: 769px) and (max-width: 1340px) {
  .dash-charts-grid,
  .dash-row2-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 16px;
  }
  .dash-row2-grid .dash-chart-card:nth-child(1) {
    grid-column: 1 / -1 !important;
  }
  .dash-row2-grid .dash-chart-card:nth-child(2),
  .dash-row2-grid .dash-chart-card:nth-child(3) {
    grid-column: span 1 !important;
  }
}
/* Mobile & Tablet Portrait (<= 768px): Xếp chồng 1 cột thông thoáng, tối ưu trải nghiệm */
@media (max-width: 768px) {
  .dash-charts-grid,
  .dash-row2-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }
  .dash-row2-grid .dash-chart-card {
    grid-column: 1 / -1 !important;
    padding: 16px !important;
  }
  .dash-chart-wrapper {
    height: 250px !important;
  }
}
.dash-chart-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.dash-chart-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pipeline-source-filter-wrap {
  display: flex;
  align-items: center;
}
.pipeline-source-select {
  height: 28px;
  padding: 2px 26px 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: #334155;
  background-color: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 8px center;
  background-size: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s ease;
  font-family: 'Inter', sans-serif !important;
  max-width: 145px;
}
.pipeline-source-select:hover {
  background-color: #ffffff;
  border-color: #94a3b8;
}
.pipeline-source-select:focus {
  border-color: #ea580c;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.15);
  background-color: #ffffff;
}
.chart-header-stacked {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  margin-bottom: 8px !important;
}
.chart-legend-simple {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: #475569;
}
.chart-legend-simple .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chart-legend-simple .legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dash-chart-sub {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-weight: 400;
  margin-top: 2px;
}
.dash-chart-wrapper {
  height: 270px;
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.dash-chart-wrapper canvas {
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Funnel 5 Stages (Cân xứng, to rõ & hiển thị đầy đủ tên giai đoạn) */
.funnel-chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 16px);
  height: 270px;
  padding: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.funnel-svg-col {
  flex: 0 1 clamp(165px, 13vw, 225px);
  width: clamp(165px, 13vw, 225px);
  max-width: 235px;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
.funnel-svg-col svg {
  width: 100%;
  height: auto;
  max-height: 240px;
  display: block;
}
.funnel-list-col {
  flex: 1 1 auto;
  min-width: 152px;
  max-width: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 235px;
  padding-left: 0;
  box-sizing: border-box;
}
.funnel-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px dashed #f1f5f9;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.funnel-stage-row:last-child {
  border-bottom: none;
}
.funnel-stage-name {
  white-space: nowrap;
  font-weight: 500;
  color: #1e293b;
  font-size: clamp(10.5px, 0.82vw, 11.5px);
  letter-spacing: -0.2px;
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.funnel-stage-pct {
  font-weight: 700;
  color: #475569;
  font-size: clamp(11px, 0.82vw, 12px);
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
  margin-left: 4px;
}

/* Source Donut + Legend (Co giãn linh hoạt, không tràn khung) */
.source-donut-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.2vw, 18px);
  height: 270px;
  padding: 0 4px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.donut-canvas-col {
  width: clamp(130px, 11vw, 175px);
  max-width: 185px;
  height: clamp(130px, 11vw, 175px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
.donut-canvas-col canvas {
  max-width: 100% !important;
  max-height: 100% !important;
}
.donut-center-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center-num {
  font-size: clamp(20px, 1.8vw, 28px);
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.5px;
}
.donut-center-txt {
  font-size: clamp(10px, 0.75vw, 11.5px);
  color: #64748b;
  font-weight: 500;
  margin-top: 3px;
}
.donut-legend-col {
  flex: 1 1 auto;
  max-width: 155px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(4px, 0.7vw, 8px);
  box-sizing: border-box;
}
.source-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.source-legend-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.source-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-legend-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(10.5px, 0.75vw, 11.5px);
  color: #334155;
  font-weight: 500;
  min-width: 0;
}
.source-legend-pct {
  font-weight: 600;
  font-size: clamp(11px, 0.8vw, 12px);
  color: #0f172a;
  padding-left: 4px;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
  margin-left: 4px;
}

/* Row 3: Bảng Khách hàng / Cơ hội mới nhất */
.dash-recent-opps-card {
  margin-bottom: 24px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
.dash-recent-opps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}
.dash-recent-opps-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-recent-view-all {
  font-size: 13px;
  font-weight: 600;
  color: #c0262b;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s ease, color 0.15s ease;
}
.dash-recent-view-all:hover {
  color: #991b1b;
  transform: translateX(2px);
}
.dash-recent-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.dash-recent-table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.dash-recent-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: #1e293b;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-recent-table tbody tr {
  transition: background-color 0.15s ease;
  cursor: pointer;
}
.dash-recent-table tbody tr:hover {
  background-color: #f8fafc;
}
.dash-recent-table tbody tr:last-child td {
  border-bottom: none;
}
.opp-cust-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.opp-cust-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.opp-cust-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opp-stage-pill {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.2;
}
/* 1. Lead mới / Tiềm năng: Tím pastel (Purple/Violet) */
.opp-stage-new,
.opp-stage-potential {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}
/* 2. Sàng lọc / Tìm hiểu: Xanh lam băng (Sky) */
.opp-stage-screening {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
/* 3. Khảo sát: Cam ấm tươi (Orange) */
.opp-stage-survey {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}
/* 4. Chăm sóc: Xanh mòng két (Teal) */
.opp-stage-care {
  background: #f0fdfa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}
/* 5. Báo giá / Đề xuất: Vàng kim ấm (Amber/Yellow) */
.opp-stage-quoting {
  background: #fefce8;
  color: #ca8a04;
  border: 1px solid #fef08a;
}
/* 6. Đàm phán: Xanh dương hoàng gia (Royal Blue) */
.opp-stage-negotiating {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
/* 7. Đã ký hợp đồng / Thắng: Xanh lục bảo thành công (Emerald Green) */
.opp-stage-won {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
/* 8. Tạm dừng: Xám ghi (Slate) */
.opp-stage-paused {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
/* 9. Hủy / Thất bại: Đỏ hoa hồng (Rose/Red) */
.opp-stage-cancelled {
  background: #fef2f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}
/* 10. Mặc định / Khác */
.opp-stage-default {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.opp-sales-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.opp-sales-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid #cbd5e1;
}
.opp-sales-name {
  font-size: 12.5px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
}

/* Bottom Operative Grid */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
@media (max-width: 992px) {
  .dash-bottom-grid { grid-template-columns: 1fr; }
}
.dash-task-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.my-tasks-container,
.recent-projects-container {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

/* Task Tabs Row */
.task-tabs-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.task-tab-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.task-tab-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.task-tab-btn.active {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 600;
}
.task-tab-count {
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-family: var(--font-mono);
  font-weight: 600;
}
.task-tab-btn.active .task-tab-count {
  background: rgba(200, 33, 39, 0.12);
  color: var(--primary);
}

/* Lead Status Tabs Row - Segmented Control (Linear / Apple style) */
.lead-status-tabs-row {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 9px;
  gap: 3px;
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
  max-width: 100%;
  overflow-x: auto;
}
.lead-status-tab-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  color: #64748b;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.2;
}
.lead-status-tab-btn svg {
  opacity: 0.75;
  transition: opacity 0.15s;
}
.lead-status-tab-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #1e293b;
}
.lead-status-tab-btn:hover svg {
  opacity: 1;
}
.lead-status-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}
.lead-status-tab-btn.active svg {
  opacity: 1;
  color: #ea580c;
}
.lead-status-tab-btn[data-tab="signed"].active svg {
  color: #059669;
}
.lead-status-tab-count {
  font-size: 11px;
  padding: 1.5px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  transition: all 0.15s ease;
}
.lead-status-tab-btn:hover .lead-status-tab-count {
  background: #cbd5e1;
  color: #334155;
}
.lead-status-tab-btn.active .lead-status-tab-count {
  background: #f1f5f9;
  color: #0f172a;
}
.lead-status-tab-btn[data-tab="signed"].active .lead-status-tab-count {
  background: #ecfdf5;
  color: #059669;
}

/* Pagination Controls (Number based 1, 2, 3...) */
.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-mono, monospace);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}
.pagination-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
.pagination-btn.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.25);
  cursor: default;
}
.pagination-btn:disabled:not(.active) {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: #f1f5f9;
}
.pagination-number {
  min-width: 32px;
  padding: 0 6px;
}
.pagination-ellipsis {
  min-width: 20px;
  text-align: center;
  color: #94a3b8;
  font-weight: 600;
  font-size: 13px;
  user-select: none;
}

/* Task Item Card */
.task-item-card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s;
  cursor: pointer;
}
.task-item-card:hover {
  border-color: #cbd5e1;
  background: #fafbfc;
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.task-item-crit { border-left: 3.5px solid var(--crit); }
.task-item-warn { border-left: 3.5px solid var(--warn); }
.task-item-info { border-left: 3.5px solid var(--info); }

.task-item-left {
  flex: 1;
  min-width: 0;
}
.task-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.task-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-item-entity {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 500;
  flex-shrink: 0;
}
.task-item-action {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}
.task-item-meta {
  font-size: 11px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.task-assignee-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  padding: 1px 6px;
  border-radius: 4px;
  color: #475569;
}
.task-assignee-tag svg {
  color: #64748b;
}
.task-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* Project Pulse Item Card (Khối 4) */
.proj-pulse-card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proj-pulse-card:hover {
  border-color: #cbd5e1;
  background: #fafbfc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transform: translateY(-1px);
}
.proj-pulse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.proj-pulse-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.proj-pulse-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.proj-pulse-code {
  font-size: 10.5px;
  padding: 1px 5px;
  background: #f1f5f9;
  border-radius: 3px;
  color: #64748b;
  font-family: var(--font-mono);
  font-weight: 600;
  flex-shrink: 0;
}
.proj-pulse-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.proj-pulse-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-soft);
  flex-wrap: wrap;
  gap: 8px;
}
.proj-pulse-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.proj-pulse-meta-item strong {
  color: var(--ink);
}
.proj-cd-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.cd-crit {
  background: #fee2e2;
  color: #b91c1c;
}
.cd-warn {
  background: #fef3c7;
  color: #b45309;
}
.cd-info {
  background: #e0f2fe;
  color: #0369a1;
}
.cd-neutral {
  background: #f1f5f9;
  color: #475569;
}
.proj-pulse-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.proj-pulse-bar-bg {
  flex: 1;
  height: 7px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.proj-pulse-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.proj-pulse-pct-num {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}
.bar-green { background: linear-gradient(90deg, #10b981, #059669); }
.bar-blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.bar-amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.bar-red { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* Timeline Notes */
.timeline-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}
.timeline-meta { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 4px; }
.timeline-author { font-weight: 600; color: var(--ink); margin-right: 6px; }
.timeline-body { font-size: 13px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; }

/* 7 Document Links Grid */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.doc-card:hover { border-color: var(--primary); background: var(--surface); box-shadow: var(--shadow-sm); }
.doc-info { display: flex; align-items: center; gap: 10px; }
.doc-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doc-name { font-weight: 600; font-size: 13px; }
.doc-status { font-size: 11px; color: var(--ink-faint); }



/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-2);
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease;
}
.toast-success { background: var(--good); }
.toast-error { background: var(--crit); }
@keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Form 3 Khâu layout */
.stage-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
}
.stage-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 991px) {
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
  }
  .form-grid .form-group[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.form-label .req { color: var(--crit); }

/* ==========================================================================
   LOGIN SCREEN (FULL-WIDTH SPLIT-SCREEN — BRAND RED #c82127 & INTER FONT)
   ========================================================================== */
.login-full-split {
  height: 100vh;
  width: 100%;
  max-width: 100%;
  display: flex;
  font-family: var(--font-sans);
  overflow: hidden;
  background-color: #ffffff;
}

/* 1. LEFT HERO (FULL HEIGHT, 50% WIDTH) */
.split-left-hero {
  flex: 1.05;
  height: 100vh;
  background: linear-gradient(145deg, #df2229 0%, #c82127 42%, #961217 100%);
  color: #ffffff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-wireframe-svg {
  position: absolute;
  right: -25px;
  top: 50%;
  transform: translateY(-50%);
  width: 620px;
  height: auto;
  max-height: 94vh;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.12));
}

.hero-starburst-wrap {
  width: 52px;
  height: 52px;
  position: relative;
  z-index: 2;
  margin-bottom: 24px;
}
.starburst-icon {
  width: 46px;
  height: 46px;
  color: #ffffff;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.18));
}

.hero-text-container {
  position: relative;
  z-index: 2;
  max-width: 480px;
}
.hero-headline {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: #ffffff;
  margin-bottom: 20px;
}
.wave-emoji {
  display: inline-block;
  animation: wave-hand 2.4s infinite;
  transform-origin: 70% 70%;
}
@keyframes wave-hand {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.hero-subtext {
  font-size: 15px;
  line-height: 1.68;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 400;
}

.hero-bottom-footer {
  position: relative;
  z-index: 2;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

/* 2. RIGHT FORM (FULL HEIGHT, 50% WIDTH) */
.split-right-form {
  flex: 1;
  height: 100vh;
  background: #ffffff;
  padding: 40px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}
.split-right-form::-webkit-scrollbar {
  width: 5px;
}
.split-right-form::-webkit-scrollbar-track {
  background: transparent;
}
.split-right-form::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 9999px;
}
.split-right-form::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

.form-content-inner {
  width: 100%;
  max-width: 420px;
  margin: auto;
}

.saleskip-brand-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 28px;
}
.brand-logo-img {
  height: 52px;
  max-width: 230px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.saleskip-auth-header {
  text-align: center;
  margin-bottom: 26px;
}
.auth-welcome-title {
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}
.auth-welcome-sub {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
}
.auth-welcome-sub a {
  color: #0f172a;
  font-weight: 600;
  text-decoration: underline;
}

/* Alert Toasts (Reference Style) */
.login-alert-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  border-radius: 12px;
  padding: 13px 16px;
  margin-bottom: 24px;
  border: 1px solid #f1f5f9;
  border-left: 4px solid #ea580c;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  text-align: left;
}
.login-alert-toast.toast-type-success {
  border-left-color: #10b981;
}
.toast-icon-wrap {
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toast-content-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.toast-title-text {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.toast-desc-text {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.45;
  word-break: break-word;
}
.toast-dismiss-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.toast-dismiss-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

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

/* Input Form */
.saleskip-input-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.saleskip-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label-text {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.field-input-box {
  position: relative;
  display: flex;
  align-items: center;
}
.saleskip-clean-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #f8fafc;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}
.saleskip-clean-input:focus {
  background: #ffffff;
  border-color: #0f172a;
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.saleskip-clean-input.input-highlight {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.clean-pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.clean-pwd-toggle:hover {
  color: #0f172a;
}

/* Checkbox */
.saleskip-check-row {
  display: flex;
  align-items: center;
  margin-top: -2px;
}
.minimal-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.minimal-checkbox input {
  display: none;
}
.check-box-square {
  width: 19px;
  height: 19px;
  border: 1.8px solid #94a3b8;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.minimal-checkbox:hover .check-box-square {
  border-color: #0f172a;
}
.check-box-square svg {
  width: 13px;
  height: 13px;
  display: none;
}
.minimal-checkbox input:checked + .check-box-square {
  background: #0f172a;
  border-color: #0f172a;
}
.minimal-checkbox input:checked + .check-box-square svg {
  display: block;
}
.check-text {
  font-size: 13.5px;
  color: #475569;
}

/* Buttons */
.btn-saleskip-submit {
  width: 100%;
  height: 48px;
  background: #c82127;
  color: #ffffff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 6px;
  font-family: var(--font-sans);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(200, 33, 39, 0.25);
  position: relative;
  overflow: hidden;
}
.btn-saleskip-submit:hover {
  background: #a8191e;
  box-shadow: 0 6px 18px rgba(200, 33, 39, 0.38);
  transform: translateY(-1px);
}
.btn-saleskip-submit:active {
  transform: translateY(0);
}
.btn-saleskip-submit.loading,
.btn-saleskip-submit:disabled {
  background: #c82127;
  opacity: 0.9;
  cursor: not-allowed;
  transform: none;
}
.btn-saleskip-submit .btn-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-saleskip-submit .btn-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
}
.btn-saleskip-submit .spinner-svg,
.btn-saleskip-submit .login-spinner-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  animation: crm-spin 0.75s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes crm-spin {
  to { transform: rotate(360deg); }
}

.saleskip-foot-link {
  margin-top: 24px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}
.saleskip-foot-link a {
  color: #0f172a;
  font-weight: 600;
  text-decoration: underline;
}

/* RESPONSIVE (THEO MẪU MOBILE APP) */
@media (max-width: 900px) {
  body.crm-login-body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .login-full-split {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
  }
  /* ẨN CỘT BANNER ĐỎ TRÊN MOBILE ĐỂ TẬP TRUNG FORM ĐĂNG NHẬP NHƯ MOCKUP */
  .split-left-hero {
    display: none !important;
  }
  .split-right-form {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    box-sizing: border-box;
  }
  .form-content-inner {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }
  .brand-logo-img {
    height: 48px;
    max-width: 220px;
    margin: 0 auto;
  }
  .saleskip-brand-heading {
    margin-bottom: 24px;
  }
  .saleskip-auth-header {
    margin-bottom: 24px;
  }
  .auth-welcome-title {
    font-size: 26px;
    font-weight: 800;
  }
  .auth-welcome-sub {
    font-size: 13.5px;
    line-height: 1.5;
  }
  .saleskip-clean-input {
    height: 48px;
    font-size: 16px; /* Chống zoom tự động trên iOS Safari */
    border-radius: 9px;
  }
  .btn-saleskip-submit {
    height: 48px;
    font-size: 15px;
    border-radius: 9px;
  }
}

@media (max-width: 480px) {
  .split-right-form {
    padding: 32px 18px 40px;
  }
  .form-content-inner {
    max-width: 100%;
  }
  .brand-logo-img {
    height: 42px;
    max-width: 190px;
  }
  .auth-welcome-title {
    font-size: 23px;
  }
  .auth-welcome-sub {
    font-size: 13px;
  }
}

/* ==========================================================================
   USER PROFILE MODAL & AVATAR PICKER
   ========================================================================== */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.profile-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  border: 3px solid #c82127;
  box-shadow: 0 4px 14px rgba(200, 33, 39, 0.25);
  background: #1e293b;
  overflow: hidden;
}
.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-avatar-actions {
  flex: 1;
  min-width: 0;
}
.profile-presets-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.profile-preset-item {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.18s ease;
  overflow: hidden;
  background: #1e293b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
.profile-preset-item:hover {
  transform: scale(1.12);
  border-color: #c82127;
}
.profile-preset-item.active {
  border-color: #c82127;
  box-shadow: 0 0 0 2px rgba(200, 33, 39, 0.35);
  transform: scale(1.08);
}
.profile-preset-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-section-divider {
  border-top: 1px solid var(--border);
  margin: 18px 0 12px;
  padding-top: 6px;
}
.profile-section-heading {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-heading);
  text-transform: none;
  letter-spacing: normal;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

/* ==========================================================================
   MOBILE RESPONSIVE & DRAWER SIDEBAR — INTER OFFICE CRM
   ========================================================================== */

/* Backdrop overlay cho mobile drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
body.sidebar-mobile-open .sidebar-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Tablet & Smaller Devices (<= 1024px) */
@media (max-width: 1024px) {
  .btn-sidebar-toggle {
    display: inline-flex !important;
  }
  .app-layout {
    position: relative;
    overflow-x: hidden;
  }
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 275px;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }
  body.sidebar-mobile-open .sidebar {
    transform: translateX(0) !important;
  }
  body.sidebar-mobile-open {
    overflow: hidden;
  }
  .main-wrapper {
    width: 100% !important;
    min-width: 0 !important;
  }
  .topbar {
    padding: 0 16px;
    height: 56px;
  }
  .topbar-admin-btn {
    display: none !important; /* Ẩn nút WP-Admin trên tablet & mobile để chữ Dashboard luôn hiển thị trọn vẹn */
  }
  .content-container {
    padding: 16px 16px 40px;
  }
  .dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }
  .dash-actions {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .dash-actions .btn {
    height: 36px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    justify-content: center !important;
    width: 100% !important;
    text-align: center !important;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  .kpi-grid .kpi-card:nth-child(5) {
    grid-column: 1 / -1 !important;
  }
  .dash-alert-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile & Small Tablets (<= 767px) */
@media (max-width: 767px) {
  .topbar {
    padding: 0 12px;
    height: 52px;
  }
  .view-title {
    font-size: 15px;
  }
  .content-container {
    padding: 12px 12px 36px;
  }
  .dash-actions .btn {
    height: 34px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
  }
  .dash-charts-grid,
  .dash-row2-grid,
  .dash-bottom-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filter-group {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

/* Phones (<= 480px) */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .kpi-grid .kpi-card:nth-child(5) {
    grid-column: 1 / -1 !important;
  }
  .dash-alert-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .topbar-date-btn {
    padding: 0 8px;
    height: 30px;
    font-size: 11.5px;
  }
  .topbar-date-btn span {
    max-width: 75px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .date-filter-dropdown {
    width: calc(100vw - 32px);
    right: -10px;
  }
  .modal-box {
    width: 95% !important;
    max-height: 90vh;
    padding: 16px;
  }
}

/* ==========================================================================
   SEARCHABLE COMBOBOX COMPONENT (Dự án & Nhân sự)
   ========================================================================== */
.searchable-combobox {
  position: relative;
  width: 100%;
}
.combobox-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.combobox-trigger:hover {
  border-color: var(--ink-faint);
}
.combobox-trigger.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.combobox-text {
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.combobox-text.placeholder {
  color: var(--ink-faint);
  font-weight: 400;
}
.combobox-arrow {
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}
.combobox-trigger.active .combobox-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}
.combobox-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  overflow: hidden;
  animation: comboboxFadeIn 0.15s ease-out;
}
@keyframes comboboxFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.combobox-search-box {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.combobox-search-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}
.combobox-search-input::placeholder {
  color: var(--ink-faint);
}
.combobox-clear-search {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 4px;
}
.combobox-clear-search:hover {
  color: var(--crit);
}
.combobox-options-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.combobox-option-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.12s ease;
}
.combobox-option-item:hover,
.combobox-option-item.highlighted {
  background: var(--primary-soft);
}
.combobox-option-item.selected {
  background: rgba(200, 33, 39, 0.08);
  font-weight: 600;
}
.combobox-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  text-align: left;
}
.combobox-option-title {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox-option-meta {
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.combobox-option-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  font-weight: 600;
}
.combobox-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.6;
}

/* ===== FIRST CONTACT & LEAD ACKNOWLEDGE STYLES ===== */
.lead-action-banner {
  background: linear-gradient(135deg, #fffdf8 0%, #fff7ed 100%);
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(224, 43, 36, 0.06);
}

.fc-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.fc-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.fc-option-card:hover {
  border-color: var(--ink-soft);
  transform: translateY(-1px);
}

.fc-option-card.active {
  border-color: var(--primary);
  background: rgba(224, 43, 36, 0.04);
  box-shadow: 0 0 0 2px rgba(224, 43, 36, 0.15);
}

.fc-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.fc-option-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.fc-option-desc {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.fc-section-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

/* Multiselect Combobox (Users / PM / Design) - Modern Pill & Avatar UI (No Emoji) */
.fc-multiselect-wrap {
  position: relative;
  user-select: none;
  width: 100%;
}
.fc-multiselect-trigger {
  min-height: 42px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 8px;
  transition: border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}
.fc-multiselect-trigger:hover {
  border-color: #94a3b8;
}
.fc-multiselect-wrap.open .fc-multiselect-trigger {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}
.fc-multiselect-trigger .combobox-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}
.fc-multiselect-wrap.open .fc-multiselect-trigger .combobox-arrow {
  transform: rotate(180deg);
  color: #0284c7;
}

/* Dropdown Menu Container - No Double Scrollbars */
.fc-multiselect-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  z-index: 99999;
  max-height: 340px;
  overflow: hidden !important; /* Triệt tiêu hoàn toàn scrollbar của menu cha */
  padding: 0;
  box-sizing: border-box;
  animation: fcMenuFadeDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fcMenuFadeDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fc-multiselect-wrap.open .fc-multiselect-menu {
  display: flex;
  flex-direction: column;
}

/* Search Box Wrap */
.fc-multiselect-search-wrap {
  padding: 8px 10px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.fc-search-inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.fc-search-icon {
  position: absolute;
  left: 10px;
  color: #94a3b8;
  pointer-events: none;
  flex-shrink: 0;
}
.fc-multiselect-search-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
  background: #f8fafc;
  color: #0f172a;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.fc-multiselect-search-input::placeholder {
  color: #94a3b8;
}
.fc-multiselect-search-input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* Scrollable Member List - Single Clean Scrollbar */
.fc-multiselect-list {
  max-height: 260px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  flex: 1 1 auto;
  box-sizing: border-box;
  overscroll-behavior: contain;
}
.fc-multiselect-list::-webkit-scrollbar {
  width: 5px;
}
.fc-multiselect-list::-webkit-scrollbar-track {
  background: transparent;
}
.fc-multiselect-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.fc-multiselect-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Group Header */
.fc-multiselect-group-header {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
  margin-top: 6px;
  user-select: none;
}
.fc-multiselect-group-header:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}
.fc-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fc-group-count {
  font-size: 10.5px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  padding: 1px 6px;
  border-radius: 9999px;
}

/* Member Item */
.fc-multiselect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #1e293b;
  transition: background 0.12s ease;
  user-select: none;
}
.fc-multiselect-item:hover {
  background: #f8fafc;
}
.fc-multiselect-item.selected {
  background: #f0f9ff;
}
.fc-item-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}
.fc-item-avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.fc-item-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.fc-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.fc-multiselect-item.selected .fc-item-name {
  font-weight: 600;
  color: #0369a1;
}
.fc-item-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  flex-shrink: 0;
  line-height: 1.3;
}
.fc-item-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  background: #ffffff;
}
.fc-item-check .fc-check-icon {
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
}
.fc-multiselect-item.selected .fc-item-check {
  background: #0284c7;
  border-color: #0284c7;
}
.fc-multiselect-item.selected .fc-item-check .fc-check-icon {
  opacity: 1;
  transform: scale(1);
}

/* Selected Tags (Pills) inside Trigger */
.fc-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px 2px 3px;
  border-radius: 9999px;
  transition: background 0.15s, border-color 0.15s;
  max-width: 100%;
}
.fc-tag:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
.fc-tag-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}
.fc-tag-avatar-img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}
.fc-tag-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.fc-tag-remove {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  margin-left: -1px;
}
.fc-tag-remove:hover {
  background: #cbd5e1;
  color: #0f172a;
}

/* ==========================================================================
   ENHANCED TYPOGRAPHY & TABULAR NUMBERS (NO SLASHED ZEROS)
   ========================================================================== */
[style*="font-mono"], .font-mono, td[style*="font-mono"], span[style*="font-mono"] {
  font-family: 'Inter', sans-serif !important;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   RESPONSIVE MOBILE & DETAIL PAGE GRIDS
   ========================================================================== */
.kpi-grid.cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.detail-two-col-layout {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 20px;
  align-items: start;
}

.grid-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1024px) {
  .kpi-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .detail-two-col-layout {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .grid-two-col {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  .kpi-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
  }
  
  .kpi-grid.cols-4 .kpi-card {
    padding: 14px 12px;
    min-height: 82px;
  }
  
  .kpi-grid.cols-4 .kpi-value {
    font-size: 20px;
  }
  
  .kpi-grid.cols-4 .kpi-label {
    font-size: 11px;
    line-height: 1.3;
  }

  .table-responsive {
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  .data-table th, .data-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Prevent awkward word/code breaking in tables */
.data-table td a,
.data-table td .font-mono,
.data-table td:first-child,
.data-table td:nth-child(2) {
  white-space: nowrap;
}

/* ==========================================================================
   UI-UX-PRO-MAX SAAS STANDARDS: EMPTY STATES & REDUCED MOTION
   ========================================================================== */

/* 1. SaaS Empty State Box */
.crm-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.crm-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.crm-empty-icon svg {
  width: 26px;
  height: 26px;
}

.crm-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.crm-empty-desc {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 380px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.crm-empty-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 2. Skeleton Loading Effect */
.crm-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: crmSkeletonShimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

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

/* 3. Accessibility: Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   4. OPTIMIZED DATA TABLE STYLES: CUSTOMER AVATAR, PROGRESS BARS, CSAT
   ========================================================================== */
.customer-cell-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.table-avatar-initial {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.customer-cell-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.customer-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.35;
}

.customer-subtitle {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.phone-link {
  color: var(--primary);
  font-weight: 600;
  font-family: var(--font-mono);
  text-decoration: none;
}

.phone-link:hover {
  text-decoration: underline;
}

.star-rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fef08a;
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.progress-bar-wrap {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  min-width: 70px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.35s ease;
}

.data-table th {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.3px;
  padding: 10px 10px;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.data-table td {
  padding: 10px 10px;
  vertical-align: middle;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* ===== LEAD DETAIL REDESIGNED HEADER (PHƯƠNG ÁN 1) ===== */
.lead-detail-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.lead-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.lead-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.lead-back-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.lead-breadcrumb-sep {
  color: var(--border-dark);
  font-size: 12px;
  user-select: none;
}

.lead-code-crumb {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

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

/* More Actions Dropdown */
.lead-more-actions-wrap {
  position: relative;
}

.lead-more-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 210px;
  z-index: 100;
  overflow: hidden;
  padding: 4px;
}

.lead-more-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}
.lead-more-item:hover {
  background: var(--surface-2);
}
.lead-more-item-danger {
  color: var(--crit);
}
.lead-more-item-danger:hover {
  background: rgba(200, 33, 39, 0.08);
}

/* Hàng 2: Profile Hero Card */
.lead-detail-profile-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  width: 100%;
  box-sizing: border-box;
}

.lead-profile-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lead-avatar-circle {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(200, 33, 39, 0.12) 0%, rgba(200, 33, 39, 0.04) 100%);
  color: var(--primary);
  border: 1px solid rgba(200, 33, 39, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
  user-select: none;
}

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

.lead-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.lead-company-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
}

.lead-meta-row {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 12.5px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.lead-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Stage 1 Property Grid (Phương án 2) */
.stage1-grid-p2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 768px) {
  .stage1-grid-p2 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .stage1-grid-p2 > div {
    grid-column: span 1 !important;
  }
}
}