/* ===================================================================
   CRM MINI MAP - CORE STYLESHEET (DARK & LIGHT THEME)
   Tách bạch 2 Giao diện: CRM Quản trị & Bản đồ Toàn cảnh
   Thiết kế cao cấp Zinc Slate, tối ưu trải nghiệm và tốc độ 60 FPS
   =================================================================== */

:root {
    /* Font & Radius Thống Nhất Chuẩn Mực */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --radius-btn: 10px;           /* Bo tròn chuẩn mực thống nhất cho tất cả button */
    --radius-btn-sm: 8px;        /* Bo tròn cho các nút nhỏ, chip thao tác */

    /* Transition & Shadows */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.35);
    --shadow-glow-cyan: 0 0 24px rgba(6, 182, 212, 0.3);
    --shadow-glow-purple: 0 0 24px rgba(139, 92, 246, 0.3);

    /* Màu sắc đại diện thương hiệu & Phễu CRM */
    --cyan: #06b6d4;
    --cyan-hover: #0891b2;
    --emerald: #10b981;
    --emerald-hover: #059669;
    --amber: #f59e0b;
    --purple: #8b5cf6;
    --purple-hover: #7c3aed;
    --rose: #f43f5e;
    --rose-hover: #e11d48;
}

/* ==========================================
   THEME MÀU TỐI (DARK MODE - MẶC ĐỊNH)
   ========================================== */
html[data-theme="dark"],
html:not([data-theme="light"]) {
    --bg-page: #09090b;
    --bg-surface: #121215;
    --bg-surface-elevated: #18181c;
    --bg-surface-hover: #222228;
    --bg-input: #1a1a20;
    --border-color: #27272e;
    --border-focus: #3f3f4c;
    --text-primary: #f4f4f6;
    --text-secondary: #a1a1b0;
    --text-muted: #717182;
    --glass-bg: rgba(18, 18, 22, 0.88);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* ==========================================
   THEME MÀU SÁNG (LIGHT MODE)
   ========================================== */
html[data-theme="light"] {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(0, 0, 0, 0.08);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.012em;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.45;
    overflow-x: hidden;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

a {
    color: var(--cyan);
    text-decoration: none;
}

/* Container chính của App */
#app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* =======================================================
   KIẾN TRÚC 2 WORKSPACE ĐỘC LẬP (CRM vs MAP)
   ======================================================= */
.workspace-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.workspace-view.active {
    display: flex !important;
    flex-direction: column;
}

/* =======================================================
   GIAO DIỆN 1: CRM WORKSPACE (BẢNG QUẢN TRỊ CRM)
   ======================================================= */
#crm-workspace {
    background-color: var(--bg-page);
    display: flex;
    flex-direction: column;
}

/* Header CRM Siêu Tinh Gọn (Sticky Glassmorphic Navbar) */
.crm-top-navbar {
    height: 52px;
    padding: 0 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Hiệu ứng khi nội dung cuộn bên dưới (Scroll theo tinh tế) */
.crm-top-navbar.is-scrolled {
    background: rgba(9, 9, 11, 0.94);
    border-bottom-color: rgba(6, 182, 212, 0.25);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] .crm-top-navbar.is-scrolled {
    background: rgba(255, 255, 255, 0.94);
    border-bottom-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
}

.crm-top-navbar-main {
    display: contents;
}

.crm-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    order: 1;
}

.text-desktop-only {
    display: inline;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
    user-select: none;
}

.brand-icon-box {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    border-radius: var(--radius-btn-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.3);
    flex-shrink: 0;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}

.badge-pro-status {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.badge-pro {
    background: linear-gradient(135deg, var(--purple), #ec4899);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.crm-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    order: 3;
}

/* NÚT CHUYỂN SANG BẢN ĐỒ TOÀN CẢNH (ĐỒNG BỘ ĐẸP MẮT) */
.btn-switch-map {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.45);
    border-radius: var(--radius-btn);
    color: var(--cyan);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.15);
}

.btn-switch-map:hover {
    background: var(--cyan);
    border-color: var(--cyan);
    color: #09090b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.btn-switch-map:active {
    transform: scale(0.97);
}

.map-badge-count {
    background: var(--cyan);
    color: #09090b;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-btn-sm);
    transition: all var(--transition-fast);
}

.btn-switch-map:hover .map-badge-count {
    background: #09090b;
    color: #ffffff;
}

/* NÚT THÊM KHÁCH HÀNG TRÊN HEADER (ĐỒNG BỘ 100% VỚI NÚT XEM BẢN ĐỒ) */
.btn-add-header {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 13px;
    background: var(--cyan);
    border: 1px solid var(--cyan);
    border-radius: var(--radius-btn);
    color: #09090b;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

.btn-add-header:hover {
    background: var(--cyan-hover);
    border-color: var(--cyan-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-add-header:active {
    transform: scale(0.97);
}

/* Nút Primary & Secondary */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--cyan);
    color: #09090b;
    font-size: 0.84rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: var(--cyan-hover);
    color: #ffffff;
    box-shadow: var(--shadow-glow-cyan);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-focus);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--rose);
    font-size: 0.84rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: var(--rose);
    color: #ffffff;
}

.theme-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-btn);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-icon-btn:hover {
    color: var(--cyan);
    border-color: var(--cyan);
}

/* Thanh Tabs Điều Hướng CRM Siêu Tinh Gọn (Segmented Pill Control) */
.crm-tabs-bar {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
    order: 2;
}

.crm-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.crm-tab-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="light"] .crm-tab-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

.crm-tab-link.active {
    background: var(--cyan);
    color: #09090b;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.crm-tab-link.active svg {
    stroke: #09090b;
}

.tab-badge-pill {
    background: rgba(0, 0, 0, 0.18);
    color: #09090b;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    line-height: 1.2;
}

.crm-tab-link:not(.active) .tab-badge-pill {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
}

/* Thân nội dung CRM Workspace (Cuộn mượt mà) */
.crm-body-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.crm-subview {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeIn 0.2s ease;
}

.crm-subview.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   DÃY THỐNG KÊ PHỄU (PIPELINE STAT CARDS)
   ========================================== */
.pipeline-stats-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.pipeline-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
}

.pipeline-stat-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
    background: var(--bg-surface-elevated);
}

.pipeline-stat-card.active {
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px var(--cyan);
    background: var(--bg-surface-elevated);
}

.stat-number {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.74rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Thanh Tìm Kiếm CRM */
.crm-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.crm-search-box {
    flex: 1;
    max-width: 540px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    color: var(--text-muted);
    transition: border-color var(--transition-fast);
}

.crm-search-box:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.crm-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
}

.sheet-clear-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-clear-btn:hover {
    color: var(--text-primary);
}

.crm-toolbar-action-group {
    display: contents;
}

.btn-export-toolbar,
.btn-import-toolbar,
.btn-sample-toolbar {
    padding: 8px 14px;
    font-size: 0.84rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    border-radius: var(--radius-btn);
}

.crm-sort-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 2px 10px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.crm-sort-box:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
    color: var(--cyan);
}

.crm-sort-box select {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0;
}

.crm-sort-box select option {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.crm-tag-dropdown-box {
    max-width: 180px;
}

.crm-tag-dropdown-box select {
    max-width: 145px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Thanh Đang Lọc Tag */
.crm-active-tag-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-btn);
    padding: 6px 12px;
    margin-bottom: 12px;
    font-size: 0.82rem;
}

.active-tag-hint {
    color: var(--text-secondary);
}

.active-tag-chip {
    background: var(--cyan);
    color: #09090b;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
}

.btn-clear-tag-filter {
    background: transparent;
    border: none;
    color: var(--rose);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: auto;
    padding: 3px 6px;
    border-radius: var(--radius-btn-sm);
    transition: all var(--transition-fast);
}

.btn-clear-tag-filter:hover {
    background: rgba(244, 63, 94, 0.12);
}

/* Dải Tag Cloud Động (Tự Động Xuống Dòng - Không Kéo Ngang Gây Lỗi Tràn Màn Hình) */
.crm-tags-cloud-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0 10px;
    margin-bottom: 6px;
    overflow-x: visible;
}

.crm-tags-cloud-bar:empty {
    display: none;
}

.crm-tags-list-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.crm-tags-actions-bar {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.crm-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn-sm);
    padding: 4px 9px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.crm-tag-chip:hover {
    border-color: var(--cyan);
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.crm-tag-chip.active {
    background: var(--cyan);
    border-color: var(--cyan);
    color: #09090b;
    font-weight: 600;
}

.crm-tag-count {
    font-size: 0.7rem;
    opacity: 0.75;
}

/* Khung dropdown bọc nút +X thẻ khác */
.crm-tag-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Nút mở rộng / thu gọn danh sách thẻ */
.crm-tag-chip.crm-tag-expand-btn {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan);
    font-weight: 600;
}

.crm-tag-chip.crm-tag-expand-btn:hover {
    background: var(--cyan);
    color: #09090b;
    border-color: var(--cyan);
}

.crm-tag-chip.crm-tag-expand-btn.active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

/* Popover Dropdown nổi hiển thị các thẻ còn lại */
.crm-tag-popover-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 120;
    min-width: 270px;
    max-width: 360px;
    background: var(--zinc-900, #121215);
    border: 1px solid var(--border-color, #27272a);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    animation: popoverFadeIn 0.16s ease-out;
}

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

.crm-tag-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 7px;
    margin-bottom: 7px;
    border-bottom: 1px solid var(--border-color, #27272a);
}

.popover-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popover-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}

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

.crm-tag-popover-body {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    padding: 2px 2px 6px;
}

.crm-tag-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid var(--border-color, #27272a);
}

.btn-popover-toggle-expand,
.btn-popover-manage {
    background: transparent;
    border: none;
    font-size: 0.72rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.btn-popover-toggle-expand {
    color: var(--cyan);
}

.btn-popover-toggle-expand:hover {
    background: rgba(6, 182, 212, 0.12);
}

.btn-popover-manage {
    color: var(--purple, #a855f7);
}

.btn-popover-manage:hover {
    background: rgba(168, 85, 247, 0.12);
}

/* Nút Quản Lý Thẻ */
.crm-tag-chip.crm-tag-manage-btn {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.28);
    color: var(--purple, #a855f7);
    font-weight: 600;
    gap: 5px;
}

.crm-tag-chip.crm-tag-manage-btn:hover {
    background: var(--purple, #a855f7);
    color: #ffffff;
    border-color: var(--purple, #a855f7);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Huy hiệu thẻ phụ trên Card khách hàng */
.tag-pill-more {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 600;
    cursor: default;
}

/* Danh sách Thẻ trong Tag Manager Modal */
.tag-manager-list-container {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
    background: var(--bg-surface-elevated);
}

.tag-manager-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    transition: all var(--transition-fast);
}

.tag-manager-item:hover {
    border-color: var(--cyan);
}

.tag-manager-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

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

.tag-manager-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-surface-elevated);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

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

.export-format-card:hover {
    border-color: var(--cyan) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================
   LƯỚI THẺ KHÁCH HÀNG (CUSTOMER GRID)
   ========================================== */
.crm-customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.customer-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--cyan);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.customer-card-item.stage-lead {
    border-left-color: var(--cyan);
}

.customer-card-item.stage-scheduled {
    border-left-color: var(--amber);
}

.customer-card-item.stage-met {
    border-left-color: var(--emerald);
}

.customer-card-item.stage-won {
    border-left-color: var(--purple);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06) 0%, var(--bg-surface) 100%);
}

.customer-card-item.stage-followup {
    border-left-color: var(--rose);
}

.customer-card-item:hover {
    border-color: var(--border-focus);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    background: var(--bg-surface-elevated);
}

.stage-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

.pulse-amber {
    background: var(--amber);
    box-shadow: 0 0 6px var(--amber);
    animation: pulseAmber 1.8s infinite;
}

@keyframes pulseAmber {
    0%, 100% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px var(--amber); }
}

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

.customer-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.customer-name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stage-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-pill {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.card-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.action-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: var(--radius-btn-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-chip-btn:hover {
    background: var(--cyan);
    color: #09090b;
    border-color: var(--cyan);
}

.action-chip-btn-map {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan);
    font-weight: 600;
}

.action-chip-btn-map:hover {
    background: var(--cyan);
    color: #09090b;
}

.action-chip-btn-call {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--emerald);
    font-weight: 600;
}
.action-chip-btn-call:hover {
    background: var(--emerald);
    color: #ffffff;
    border-color: var(--emerald);
}

.action-chip-btn-zalo {
    background: rgba(0, 104, 255, 0.1);
    border-color: rgba(0, 104, 255, 0.25);
    color: #38bdf8;
    font-weight: 600;
}
.action-chip-btn-zalo:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.action-chip-btn-pin {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
    color: var(--amber);
}
.action-chip-btn-pin:hover {
    background: var(--amber);
    color: #09090b;
    border-color: var(--amber);
}

/* ==========================================
   SUBVIEW CHI TIẾT KHÁCH HÀNG (DETAIL LAYOUT)
   ========================================== */
.detail-top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.detail-main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 860px;
}

.detail-hero-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.detail-quick-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.sheet-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: var(--radius-btn);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tile-call {
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.tile-call:hover { background: var(--emerald); color: #fff; }

.tile-zalo {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
}
.tile-zalo:hover { background: var(--cyan); color: #fff; }

.tile-map {
    background: rgba(139, 92, 246, 0.12);
    color: var(--purple);
    border: 1px solid rgba(139, 92, 246, 0.25);
}
.tile-map:hover { background: var(--purple); color: #fff; }

.tile-nav {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}
.tile-nav:hover { background: var(--amber); color: #fff; }

/* ==========================================
   SUBVIEW NHẬT KÝ & LỊCH HẸN
   ========================================== */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.crm-meetings-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 900px;
}

/* Thanh Toolbar Lọc Nhật Ký (Tabs + Date Picker) */
.meetings-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.meetings-filter-toolbar .meetings-filter-tabs {
    margin-bottom: 0;
    padding-bottom: 0;
}

.meeting-date-picker-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.meeting-date-input-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 4px 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    transition: all var(--transition-fast);
}

.meeting-date-input-box:focus-within {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.meeting-date-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.meeting-date-input-box input[type="date"] {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
}

.meeting-date-input-box input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.8);
    opacity: 0.8;
}

.btn-clear-date-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    color: var(--rose);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear-date-filter:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: var(--rose);
}

/* Thanh Phân Loại Lịch Hẹn */
.meetings-filter-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.meeting-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 7px 14px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.meeting-filter-btn:hover {
    border-color: var(--cyan);
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.meeting-filter-btn.active {
    background: rgba(6, 182, 212, 0.12);
    border-color: var(--cyan);
    color: var(--cyan);
    font-weight: 600;
}

.meeting-filter-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.meeting-filter-btn.active .meeting-filter-badge {
    background: var(--cyan);
    color: #09090b;
}

.meeting-filter-badge.badge-today {
    background: rgba(245, 158, 11, 0.2);
    color: var(--amber);
}

.meeting-filter-badge.badge-overdue {
    background: rgba(244, 63, 94, 0.2);
    color: var(--rose);
}

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

.dot-today {
    background: var(--amber);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
    animation: pulseDot 1.8s infinite;
}

.dot-overdue {
    background: var(--rose);
}

.dot-upcoming {
    background: var(--cyan);
}

@keyframes pulseDot {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Badge trạng thái cuộc hẹn */
.meeting-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-btn-sm);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-overdue-tag {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose);
    border: 1px solid rgba(244, 63, 94, 0.35);
}

.badge-today-tag {
    background: rgba(245, 158, 11, 0.18);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-upcoming-tag {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-completed-tag {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Nút Đã Gặp Khách 1-Chạm */
.action-chip-btn-met {
    background: rgba(16, 185, 129, 0.12) !important;
    color: var(--emerald) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-weight: 600;
}

.action-chip-btn-met:hover {
    background: var(--emerald) !important;
    color: #fff !important;
}

/* ==========================================
   MODAL NHẬP CSV / EXCEL
   ========================================== */
.import-sample-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.import-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface-elevated);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.import-drop-zone:hover,
.import-drop-zone.dragover {
    border-color: var(--cyan);
    background: rgba(6, 182, 212, 0.04);
}

.drop-zone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: var(--radius-md);
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    display: flex;
    align-items: center;
    justify-content: center;
}

.import-dup-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    background: var(--bg-surface-elevated);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.import-dup-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: var(--text-primary);
    cursor: pointer;
}

.import-preview-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.preview-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.preview-stats-badges {
    display: flex;
    gap: 6px;
}

.preview-stat-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.preview-stat-badge.stat-valid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--emerald);
}

.preview-stat-badge.stat-invalid {
    background: rgba(244, 63, 94, 0.2);
    color: var(--rose);
}

.preview-table-wrapper {
    max-height: 190px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    text-align: left;
}

.import-preview-table th {
    background: var(--bg-surface);
    color: var(--text-muted);
    padding: 8px 10px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.import-preview-table td {
    padding: 7px 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.import-preview-table tr:last-child td {
    border-bottom: none;
}

/* ==========================================
   SUBVIEW CÀI ĐẶT & DỮ LIỆU
   ========================================== */
.settings-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 920px;
}

.settings-card-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-card-box.full-width {
    grid-column: 1 / -1;
}

.settings-box-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-box-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-actions-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* =======================================================
   GIAO DIỆN 2: MAP WORKSPACE (BẢN ĐỒ TOÀN CẢNH)
   100% Fullscreen, thoáng đãng, kính mờ Glassmorphism
   ======================================================= */
#map-workspace {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #09090b;
}

#crm-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Top Floating Bar trên Bản Đồ */
.map-top-bar {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 74px; /* Chừa khoảng cho cụm nút góc phải */
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none; /* Các nút con có pointer-events: auto */
}

/* NÚT QUAY LẠI BẢNG CRM (RÕ RÀNG & TIỆN LỢI) */
.btn-back-to-crm {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-back-to-crm:hover {
    background: var(--cyan);
    color: #09090b;
    border-color: var(--cyan);
    transform: translateX(-2px);
}

.map-quick-search-box {
    pointer-events: auto;
    flex: 1;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    color: var(--text-muted);
    box-shadow: var(--shadow-md);
}

.map-quick-search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
}

.map-count-pill {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Dải Lọc Giai Đoạn Nổi Trên Bản Đồ (Map Stage Filter Bar) */
.map-stage-filter-bar {
    position: absolute;
    top: 68px;
    left: 16px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    pointer-events: auto;
    max-width: calc(100% - 90px);
}

.map-stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--glass-bg, rgba(18, 18, 21, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color, #27272a);
    border-radius: var(--radius-full, 9999px);
    color: var(--text-secondary, #a1a1aa);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.map-stage-chip:hover {
    color: var(--text-primary);
    border-color: var(--cyan);
    background: var(--bg-surface-elevated);
    transform: translateY(-1px);
}

.map-stage-chip.active {
    background: var(--cyan);
    border-color: var(--cyan);
    color: #09090b;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
}

.map-stage-chip.active .m-chip-badge {
    background: #09090b;
    color: var(--cyan);
}

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

.m-chip-dot.dot-lead { background: var(--cyan); }
.m-chip-dot.dot-won { background: var(--purple); }
.m-chip-dot.dot-met { background: var(--emerald); }

.m-chip-badge {
    font-size: 0.66rem;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* Cụm Phím Nổi Điều Khiển Góc Phải Bản Đồ */
.map-floating-capsule {
    position: absolute;
    right: 16px;
    top: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    padding: 4px;
}

.capsule-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.capsule-btn:hover {
    color: var(--cyan);
    background: var(--bg-surface-elevated);
}

.capsule-btn:active {
    transform: scale(0.92);
}

.capsule-divider {
    width: 24px;
    height: 1px;
    background: var(--border-color);
    margin: 2px 0;
}

/* THẺ NỔI MINI TÓM TẮT KHÁCH KHI CHẠM MARKER (Bottom Floating Mini Card) */
.map-floating-mini-card {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 440px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 16px 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    z-index: 600;
    animation: slideUpMiniCard 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpMiniCard {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.mini-card-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mini-card-close-btn:hover {
    color: var(--text-primary);
}

.mini-card-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.mini-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: var(--radius-btn-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.mini-btn:hover {
    background: var(--cyan);
    color: #09090b;
    border-color: var(--cyan);
}

/* =======================================================
   MARKER EFFECT & CUSTOM PINS TRÊN BẢN ĐỒ
   ======================================================= */
.crm-div-marker {
    background: transparent;
    border: none;
}

.custom-map-pin {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.map-pin-svg {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
    transition: all 0.2s ease;
}

.custom-map-pin:hover {
    transform: translateY(-7px) scale(1.15);
    z-index: 999 !important;
}

.custom-map-pin:hover .map-pin-svg {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
}

.custom-map-pin.pin-selected {
    transform: translateY(-8px) scale(1.22);
    z-index: 1000 !important;
}

/* Sóng xung Radar (Sonar Beacon Ring) cho ghim */
.pin-sonar-ring {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.pin-sonar-selected {
    border: 2.5px solid var(--cyan, #06b6d4);
    box-shadow: 0 0 12px var(--cyan, #06b6d4);
    animation: pinSonarAnim 1.5s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

.pin-sonar-scheduled {
    border: 2px solid var(--amber, #f59e0b);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
    animation: pinSonarAnim 1.9s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

.pin-sonar-followup {
    border: 2px solid var(--rose, #f43f5e);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.6);
    animation: pinSonarAnim 1.7s infinite cubic-bezier(0, 0.2, 0.8, 1);
}

@keyframes pinSonarAnim {
    0% {
        transform: translateX(-50%) scale(0.65);
        opacity: 0.95;
    }
    100% {
        transform: translateX(-50%) scale(2.6);
        opacity: 0;
    }
}

/* Hào quang lấp lánh cho khách Đã chốt (Won) */
.pin-aura-won {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.45) 0%, rgba(245, 158, 11, 0.4) 60%, transparent 100%);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.7);
    animation: wonGlowPulse 2.4s infinite ease-in-out;
    pointer-events: none;
    z-index: -1;
}

@keyframes wonGlowPulse {
    0%, 100% { transform: translateX(-50%) scale(0.95); opacity: 0.7; }
    50% { transform: translateX(-50%) scale(1.35); opacity: 1; }
}

/* Thẻ tên khách hàng nổi dưới chân ghim (Mini Name Badge) */
.map-pin-name-badge {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color, #27272a);
    color: #f4f4f5;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
    pointer-events: none;
    transition: all 0.2s ease;
}

.custom-map-pin:hover .map-pin-name-badge {
    background: #09090b;
    border-color: var(--cyan);
    color: #22d3ee;
    transform: translateX(-50%) translateY(4px) scale(1.06);
}

/* =======================================================
   NÚT & KHAY DANH SÁCH KHÁCH HÀNG TRÊN BẢN ĐỒ (CAROUSEL)
   ======================================================= */
.btn-toggle-map-carousel {
    position: absolute;
    bottom: 24px;
    left: 16px;
    z-index: 550;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
}

.btn-toggle-map-carousel:hover {
    background: var(--cyan);
    color: #09090b;
    border-color: var(--cyan);
    transform: translateY(-2px);
}

.map-bottom-carousel-container {
    position: absolute;
    bottom: 20px;
    left: 16px;
    right: 16px;
    z-index: 560;
    background: var(--glass-bg, rgba(18, 18, 21, 0.92));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color, #27272a);
    border-radius: var(--radius-xl, 14px);
    padding: 12px 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    animation: slideUpCarousel 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.map-carousel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #27272a);
}

.carousel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.carousel-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

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

.map-carousel-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scroll-behavior: smooth;
}

.map-carousel-track::-webkit-scrollbar {
    height: 4px;
}

.map-carousel-track::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.map-carousel-card {
    min-width: 210px;
    max-width: 230px;
    background: var(--bg-surface, #121215);
    border: 1px solid var(--border-color, #27272a);
    border-left: 3.5px solid var(--cyan);
    border-radius: var(--radius-md, 8px);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.map-carousel-card.stage-scheduled { border-left-color: var(--amber); }
.map-carousel-card.stage-won { border-left-color: var(--purple); }
.map-carousel-card.stage-met { border-left-color: var(--emerald); }
.map-carousel-card.stage-followup { border-left-color: var(--rose); }

.map-carousel-card:hover {
    border-color: var(--cyan);
    transform: translateY(-2px);
    background: var(--bg-surface-elevated);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.map-carousel-card.active {
    border-color: var(--cyan);
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.35);
    background: var(--bg-surface-elevated);
}

.mcc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.74rem;
    flex-shrink: 0;
}

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

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

.mcc-stage {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    margin-top: 2px;
}

.mcc-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.mcc-fly-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.mcc-fly-btn:hover {
    background: var(--cyan);
    border-color: var(--cyan);
    transform: scale(1.1);
}

/* ==========================================
   MODAL DIALOG (THÊM/SỬA KHÁCH, GẶP GỠ, PRO)
   ========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

/* Đảm bảo Form bên trong Modal co giãn flexbox chuẩn mực, không đẩy footer ra ngoài */
.modal-dialog form,
.modal-dialog > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.modal-body {
    flex: 1;
    min-height: 0;
    padding: 20px 20px 30px 20px; /* Đệm dưới 30px đảm bảo không bao giờ bị nút Cập nhật che khuất */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    z-index: 10;
}

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

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

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.86rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Toast Container */
.crm-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.crm-toast {
    pointer-events: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--cyan);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 0.84rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.25s ease;
}

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

/* In-App Promo Banner */
.inapp-promo-banner {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 600px;
    margin: 0 auto;
    z-index: 550;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
}

/* ===================================================================
   MAP RADAR PRO - QUÉT VÙNG GOOGLE MAPS LỌC KHÁCH HÀNG TIỀM NĂNG
   Tham khảo thiết kế từ WP-SEO mục Tạo Bài
   =================================================================== */
.modal-dialog-radar {
    max-width: 900px;
    width: 95vw;
}

.radar-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.radar-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 20px 24px 20px;
}

/* Hộp thiết lập quét chuẩn phong cách WP-SEO */
.radar-setup-card {
    background: rgba(18, 18, 22, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.radar-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.radar-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-radar-gps-action {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--radius-btn-sm);
    padding: 2px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.btn-radar-gps-action:hover {
    background: var(--cyan);
    color: #09090b;
}

/* Dải chip gợi ý ngành nghề */
.radar-chips-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: -4px;
}

.radar-chips-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.radar-chips-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.radar-pill-chip {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radar-pill-chip:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.1);
    transform: translateY(-1px);
}

/* Hàng thực thi quét */
.radar-execute-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.radar-limit-group {
    flex: 1;
    max-width: 320px;
}

.btn-radar-start {
    background: #2563eb;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 10px 24px;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transition: all var(--transition-fast);
}

.btn-radar-start:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
}

.btn-radar-start:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Card kết quả quét */
.radar-results-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeInResults 0.25s ease;
}

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

.radar-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.radar-stats-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radar-stat-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.radar-stat-badge.stat-found {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.radar-stat-badge.stat-selected {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.btn-radar-import {
    background: var(--cyan) !important;
    color: #09090b !important;
    font-weight: 600 !important;
}

.btn-radar-import:hover {
    background: var(--cyan-hover) !important;
    color: #ffffff !important;
}

.btn-radar-import:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Bảng danh sách địa điểm */
.radar-table-container {
    max-height: 340px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.radar-places-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.radar-places-table th {
    background: var(--bg-surface);
    color: var(--text-muted);
    padding: 9px 12px;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.radar-places-table td {
    padding: 9px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.radar-places-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.radar-places-table tr.is-existing-lead td {
    background: rgba(16, 185, 129, 0.04);
}

.radar-cat-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
    white-space: nowrap;
}

.radar-pill-exist {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.radar-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--emerald);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.76rem;
}

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

.radar-map-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--cyan);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.74rem;
    background: rgba(6, 182, 212, 0.1);
    padding: 3px 8px;
    border-radius: var(--radius-btn-sm);
    border: 1px solid rgba(6, 182, 212, 0.25);
    transition: all var(--transition-fast);
}

.radar-map-link:hover {
    background: var(--cyan);
    color: #09090b;
}

/* Nút Radar trên Toolbar & Badges */
.btn-radar-toolbar {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(6, 182, 212, 0.9)) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border: 1px solid rgba(6, 182, 212, 0.4) !important;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.25) !important;
}

.btn-radar-toolbar:hover {
    background: linear-gradient(135deg, #2563eb, var(--cyan)) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4) !important;
}

.badge-pro-tag {
    font-size: 0.62rem;
    font-weight: 800;
    background: #fbbf24;
    color: #09090b;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    margin-left: 2px;
}

/* ==========================================
   PRO RESELLER & QUẢN LÝ 10 TÀI KHOẢN CON
   ========================================== */
.badge-reseller {
    background: linear-gradient(135deg, #f59e0b, #d97706, #8b5cf6);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
    font-weight: 800;
}

.badge-subaccount {
    background: linear-gradient(135deg, var(--cyan), #3b82f6);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.35);
}

.crm-staff-dropdown-box {
    max-width: 175px;
}

.crm-staff-dropdown-box select {
    max-width: 140px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Huy hiệu nhân viên phụ trách trên Card khách hàng */
.customer-staff-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--amber);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Thẻ Tiến độ Hạn mức 10 tài khoản con */
.reseller-quota-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.reseller-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.reseller-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6);
    border-radius: var(--radius-full);
    transition: width 0.35s ease;
}

/* Lưới Thẻ Nhân Viên Con (10 Sub-accounts Grid) */
.reseller-staff-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 2px;
}

.reseller-staff-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition-fast);
}

.reseller-staff-card:hover {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.reseller-staff-card.locked {
    opacity: 0.65;
    filter: grayscale(0.2);
}

.staff-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.staff-avatar-box {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #f59e0b, #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.staff-meta-role {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: var(--radius-btn-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    display: inline-block;
}

/* 3 Ô Thống kê KPI của từng nhân viên */
.staff-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.staff-kpi-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn-sm);
    padding: 6px 4px;
    text-align: center;
}

.staff-kpi-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.staff-kpi-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Hộp Mã Sub-Key kích hoạt */
.staff-subkey-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-btn-sm);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-family: monospace;
    color: var(--amber);
}

.btn-copy-subkey {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.7rem;
}

.btn-copy-subkey:hover {
    color: #fff;
}

/* Các phím hành động trên thẻ nhân viên */
.staff-actions-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.staff-btn {
    flex: 1;
    font-size: 0.72rem;
    padding: 5px 8px;
    border-radius: var(--radius-btn-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.staff-btn:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--cyan);
}

.staff-btn-view {
    color: var(--cyan);
    border-color: rgba(6, 182, 212, 0.35);
}

.staff-btn-del {
    color: var(--rose);
    border-color: rgba(244, 63, 94, 0.3);
}

.staff-btn-del:hover {
    background: rgba(244, 63, 94, 0.15);
    border-color: var(--rose);
}



/* ===================================================================
   SAAS MOBILE NAVIGATION & BOTTOM SHEET BASE (DESKTOP DEFAULT HIDDEN)
   =================================================================== */
.mobile-bottom-nav {
    display: none;
}

.modal-drag-handle {
    display: none;
}

/* ===================================================================
   STREAMLINED CUSTOMER CARD ENHANCEMENTS
   =================================================================== */
.card-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.customer-card-note {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-staff-subline {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.action-chip-btn-detail {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.map-floating-fab {
    display: none;
}
