/* --- 1. RESET & BASE STYLES --- */
:root {
    --primary: #4F46E5;
    --primary-light: #EEF2FF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --dark: #1E293B;
    --gray-bg: #F8FAFC;
    --border: #E2E8F0;
    --text-main: #334155;
    --text-muted: #64748B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}
.slider-locked {
    background-color: #e2e8f0 !important; /* Màu xám nhạt */
    cursor: not-allowed;
}
body {
    background-color: var(--gray-bg);
    color: var(--text-main);
    line-height: 1.6;
}

/* --- 2. LAYOUT: SIDEBAR & MAIN CONTENT --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0F172A;
    color: white;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-logo {
    padding: 0 20px 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

/* Navigation Menu */
.nav-menu {
    flex: 1;
}

.nav-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: 0.3s;
    font-size: 14px;
    font-weight: 500;
    color: #94A3B8;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}
@keyframes pulse-yellow {
    0% { transform: scale(1); filter: drop-shadow(0 0 0px #FADB14); }
    50% { transform: scale(1.3); filter: drop-shadow(0 0 15px #FADB14); }
    100% { transform: scale(1); filter: drop-shadow(0 0 0px #FADB14); }
}

.pulse-google:hover {
    transform: translateY(-2px);
    transition: 0.3s;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.2) !important;
}
.nav-item.active {
    border-right: 4px solid var(--primary);
}

.sub-menu {
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 0;
}

.sub-nav-item {
    padding: 10px 20px 10px 50px;
    font-size: 13px;
    color: #94A3B8;
    cursor: pointer;
    transition: 0.2s;
}

.sub-nav-item:hover, .sub-nav-item.active {
    color: white;
}

/* --- 3. COMPONENTS: CARDS & GRIDS --- */
.pro-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.content-header {
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
}

.content-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* --- 4. FORMS & BUTTONS --- */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    outline: none;
    transition: 0.3s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn {
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: 0.3s;
    font-size: 14px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--gray-bg); }

/* --- 5. SWITCH / TOGGLE --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #CBD5E1;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- 6. STOCK BOARD & STATS --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Giữ 4 cột */
    gap: 10px;
    margin-bottom: 15px;
}

/* Card nhỏ gọn hơn */
.stat-card {
    padding: 12px; /* Giảm padding */
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 80px; /* Cố định chiều cao thấp */
}


.stat-title {
    font-size: 11px !important; /* Thu nhỏ nhãn */
    text-transform: uppercase;
}
.stat-value {
    font-size: 1.1rem !important; /* Thu nhỏ chữ số */
    margin: 2px 0;
}
.stat-sub { font-size: 10px; opacity: 0.8; }

.card-purple { background: #F5F3FF; color: #7C3AED; }
.card-green { background: #ECFDF5; color: #059669; }
.card-orange { background: #FFFBEB; color: #D97706; }
.card-blue { background: #EFF6FF; color: #2563EB; }
.card-gray { background: #F8FAFC; color: #64748B; border: 1px solid var(--border); }

/* --- 7. MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.close-modal {
    position: absolute;
    top: 20px; right: 20px;
    font-size: 24px; cursor: pointer; color: var(--text-muted);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    padding: 12px;
    background: var(--gray-bg);
}

/* --- 8. ANIMATIONS --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* --- 9. CLIENT SIDE: GIFT BOX & PORTAL --- */
.gift-container {
    perspective: 1000px;
    width: 100px;
    height: 100px;
}

.gift-box {
    position: relative;
    width: 100px; height: 100px;
    background: #EF4444;
    transform-style: preserve-3d;
    transition: 0.5s;
    animation: wobble 2s infinite ease-in-out;
}

.gift-lid {
    position: absolute;
    width: 110px; height: 30px;
    background: #F87171;
    top: -20px; left: -5px;
    z-index: 2;
    transition: 0.5s;
}

.gift-box.open .gift-lid {
    transform: translateY(-40px) rotateX(45deg);
    opacity: 0;
}

.gift-box.open {
    animation: none;
}

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

.btn-premium-cta {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 15px;
    border: none;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
    cursor: pointer;
    width: 100%;
}

/* --- 10. RESPONSIVE --- */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-logo span, .nav-item span, .sidebar-footer div { display: none; }
    .main-content { margin-left: 80px; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 15px; }
}
/* Layout chia 2 cột trong Main Content */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 350px; /* Cột chính chiếm hết phần còn lại, cột phải 350px */
    gap: 25px;
    align-items: start;
}

/* Cột phải cố định để theo dõi */
.finance-sidebar {
    position: sticky;
    top: 30px; /* Dính ở trên khi cuộn trang */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Điều chỉnh cho mobile: Chồng lên nhau */
@media (max-width: 1200px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .finance-sidebar {
        position: static;
    }
}
/* Layout khi hiện cột tài chính (2 cột) */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 25px;
    align-items: start;
}

/* Layout khi ẩn cột tài chính (Full-width) */
.full-width-layout {
    display: block;
    max-width: 1000px; /* Giới hạn độ rộng để form không bị quá bè ra màn hình lớn */
    margin: 0 auto;    /* Căn giữa */
}

.main-center-area {
    min-width: 0; /* Tránh lỗi vỡ layout khi nội dung bên trong quá rộng */
}
/* Khung cuộn nội bộ cho danh sách chiến dịch để không bị vỡ chiều cao màn hình */
#campaignList {
    max-height: calc(100vh - 450px); /* Tự động tính toán để không phải cuộn trang web */
    overflow-y: auto;
    padding-right: 5px;
}

/* Tùy chỉnh thanh cuộn cho mượt và nhỏ gọn */
#campaignList::-webkit-scrollbar { width: 5px; }
#campaignList::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* Các khung (Frames) gọn gàng */
.module-frame {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.module-title {
    font-size: 11px;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Nút phân loại siêu nhỏ (Compact Switcher) */
.compact-task-item {
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    text-align: center;
    transition: 0.3s;
}
.compact-task-item.active {
    border-color: #4F46E5;
    background: #F5F3FF;
}

/* Khung đóng gói module */
.module-frame {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.module-title {
    font-size: 11px;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Nút phân loại compact */
.compact-task-item {
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    text-align: center;
    transition: 0.3s;
    background: #F8FAFC;
}

.compact-task-item:hover {
    background: #F1F5F9;
}

.compact-task-item.active {
    border-color: #4F46E5;
    background: #F5F3FF;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.1);
}

/* Chấm xanh nhấp nháy cho trạng thái Live */
.pulse-green {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    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 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Thanh cuộn nội bộ nhỏ gọn */
#campaignList::-webkit-scrollbar { width: 5px; }
#campaignList::-webkit-scrollbar-track { background: transparent; }
#campaignList::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
#campaignList::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* 1. Ẩn nút mũi tên tăng giảm của ô nhập số (Tiền & SL) */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

input[type="number"] {
  -moz-appearance: textfield; /* Cho trình duyệt Firefox */
    appearance: textfield;      /* THÊM DÒNG NÀY: Thuộc tính tiêu chuẩn để hết báo lỗi */

}

/* 2. Hiệu ứng khi focus vào ô nhập tiền */
.indi-temp-money:focus, 
.indi-temp-qty:focus {
    border-color: #4F46E5 !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}
/* Ẩn thanh cuộn cho khung Mobile Preview nhưng vẫn cho phép cuộn */
#liveCataloguePreview {
    -ms-overflow-style: none;  /* Cho trình duyệt IE và Edge */
    scrollbar-width: none;     /* Cho trình duyệt Firefox */
}

#liveCataloguePreview::-webkit-scrollbar {
    display: none;             /* Cho trình duyệt Chrome, Safari và Opera */
}
/* --- SETTINGS TAB UPGRADE --- */
.settings-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr; /* Cột trái rộng hơn chút để nhập liệu */
    gap: 25px;
    align-items: start;
}

.setup-option-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid #E2E8F0;
    background: white;
    color: #64748B;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
}

.setup-option-btn.active {
    background: #EEF2FF;
    border-color: #4F46E5;
    color: #4F46E5;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

.qr-standee-preview {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.qr-standee-preview::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 6px;
    background: linear-gradient(90deg, #4F46E5, #EC4899);
}

.pixel-input-group {
    display: flex;
    align-items: center;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 0 10px;
    margin-bottom: 10px;
}
.pixel-input-group i { width: 20px; text-align: center; }
.pixel-input-group input { border: none; background: transparent; height: 40px; font-size: 12px; }

@media (max-width: 900px) {
    .settings-grid { grid-template-columns: 1fr; }
}

/* --- COMPACT SETTINGS STYLE --- */
.settings-container {
    padding: 10px 20px; /* Giảm padding tổng */
}

/* Header thu nhỏ */
.settings-container .content-header {
    margin-bottom: 15px; 
}
.settings-container .content-header h1 {
    font-size: 20px; /* Thu nhỏ tiêu đề */
}

/* Card thu nhỏ */
.pro-card-clean {
    margin-bottom: 12px !important; /* Giảm khoảng cách giữa các card */
}

.card-header-icon {
    padding: 10px 15px; /* Giảm padding header card */
}
.card-header-icon i {
    font-size: 16px; /* Icon nhỏ lại */
}
.card-header-icon h3 {
    font-size: 14px; /* Chữ to vừa phải */
}

.card-body-form {
    padding: 12px 15px; /* Co không gian nhập liệu */
}

/* Input & Label thu nhỏ */
.pro-label {
    font-size: 10px; /* Label nhỏ nhưng đậm */
    margin-bottom: 4px;
}

.pro-input {
    height: 34px; /* Giảm chiều cao từ 44px xuống 34px */
    font-size: 13px;
    padding: 0 10px;
}

.form-group {
    margin-bottom: 8px; /* Giảm khoảng cách giữa các ô nhập */
}

/* Khối QR thu nhỏ */
.qr-standee-preview {
    padding: 10px;
    transform: scale(0.9); /* Thu nhỏ cả khối QR 10% */
    transform-origin: top center;
    margin-bottom: -20px; /* Bù đắp khoảng trống do scale */
}

/* Pixel rows thu nhỏ */
.pixel-row {
    margin-bottom: 5px;
}
.pixel-tag {
    padding: 6px 10px;
    width: 100px;
    font-size: 11px;
}
.pro-input-flat {
    height: 32px;
    font-size: 12px;
}

/* Nút Triển khai */
.dep-btn {
    height: 38px;
    font-size: 11px;
}
/* --- CSS CHO GIAO DIỆN CÀI ĐẶT COMPACT --- */

.pro-card-compact {
    background: white;
    border-radius: 14px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 0px; /* Khoảng cách được điều chỉnh bằng gap của grid */
    overflow: hidden;
}

/* Label tiêu đề nhỏ phía trên ô nhập */
.pro-label-compact {
    font-size: 11px;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.5px;
}

/* Ô nhập liệu chuẩn hiện đại */
.pro-input-compact {
    width: 100% !important; /* Đảm bảo ô nhập chiếm hết độ rộng hàng */
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #CBD5E1;
    background: #F8FAFC;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    color: #1E293B;
    box-sizing: border-box; /* Quan trọng để không bị tràn khung */
}

.pro-input-compact:focus {
    border-color: #4F46E5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Định dạng các dòng Pixel bám đuôi */
.pixel-row-compact {
    display: flex;
    align-items: center;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    background: white;
}

/* Nút Triển khai (QR/Mikrotik) */
.dep-btn-compact {
    background: transparent;
    color: #64748B;
    transition: 0.2s;
    border: 1px solid transparent;
}

.dep-btn-compact.active {
    background: white !important;
    color: #4F46E5 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid #E2E8F0 !important;
}

/* Khung Standee QR Code */
.qr-standee-preview {
    width: 100%;
    max-width: 320px;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 15px;
    padding: 25px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: relative;
    text-align: center;
}

/* Hiệu ứng mượt cho các hướng dẫn ẩn/hiện */
#fbGuide, #ttGuide, #ggGuide {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tối ưu Grid cho Settings */
.settings-grid-compact {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 20px;
}
/* Nút bóng đèn hỗ trợ Pixel */
.help-bulb-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: #EEF2FF; /* Màu xanh nhạt nhẹ */
    color: #4F46E5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.2s ease;
}

.help-bulb-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    filter: brightness(0.95);
}

.help-bulb-btn i {
    animation: glow-bulb 2s infinite alternate;
}

@keyframes glow-bulb {
    from { opacity: 0.6; }
    to { opacity: 1; text-shadow: 0 0 5px currentColor; }
}
@keyframes slideUp {
    from { transform: translate(-50%, 50px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

#cartWrapper {
    display: none; /* Mặc định ẩn */
    animation: slideUp 0.4s ease-out;
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;

}
/* Hiệu ứng cho ô dán link catalogue */
.product-item-row div:has(.prod-link):focus-within {
    background-color: #EEF2FF !important;
    border-color: #6366F1 !important;
    border-style: solid !important;
}

.product-item-row div:has(.prod-link):hover {
    border-color: #94A3B8;
}
.fa-times:hover {
    transform: scale(1.2);
    transition: 0.2s;
}
/* Khung chứa danh sách sản phẩm có chiều cao cố định */
.product-inventory-list {
    max-height: 450px; /* Độ cao tối đa trước khi xuất hiện thanh cuộn */
    overflow-y: auto;
    padding-right: 10px;
    scroll-behavior: smooth;
}

/* Tùy chỉnh thanh cuộn cho chuyên nghiệp */
.affiliate-product-list::-webkit-scrollbar {
    width: 6px;
}
.affiliate-product-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.affiliate-product-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.affiliate-product-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
/* Hiệu ứng khi nhấn vào ô nhập liệu sản phẩm */
.prod-name:focus {
    border-color: #4F46E5 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
/* Thêm vào style.css */
.prod-sku, .prod-name {
    -webkit-appearance: none; /* Khử style mặc định của Safari/iOS */
    appearance: none;
    outline: none;
    border: 1px solid #E2E8F0 !important; /* Buộc hiện viền */
}

/* Đảm bảo khi không focus vẫn nhìn thấy viền nhẹ */
.prod-name {
    background-color: #ffffff !important;
}

.prod-sku {
    background-color: #F1F5F9 !important;
}
/* Tooltip Style - Bản nâng cấp hiển thị ngang */
.has-tooltip:hover .insight-tooltip {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-10px);
}

.insight-tooltip {
    position: absolute;
    bottom: 110%; /* Đẩy lên cao hơn icon một chút */
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(15, 23, 42, 0.98); /* Nền tối gần như tuyệt đối */
    color: #cbd5e1;
    padding: 8px 12px; /* Padding gọn gàng */
    border-radius: 8px; /* Bo góc nhẹ hơn cho hiện đại */
    font-size: 11px;
    width: auto;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    display: none;
    z-index: 999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    text-align: left; /* Căn lùi về trái cho tiêu đề */
}

/* Các con số nhấn mạnh */
.insight-tooltip b {
    color: #fff;
    margin-left: 2px;
    font-family: monospace; /* Dùng font số cho dễ đọc nhanh */
}


/* Mũi tên nhọn của tooltip */
.insight-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1E293B transparent transparent transparent;
}

/* Màu chữ cho các con số cho nổi bật trên nền tối */
.insight-tooltip b {
    color: #fff;
    margin-left: 2px;
}
/* Style cho bộ chọn lịch dưới footer của Box Túi tiền */
.footer-date-input {
    border: 1px solid #E2E8F0 !important;
    background: #F8FAFC !important;
    font-size: 10px !important;
    color: #475569 !important;
    border-radius: 6px !important;
    padding: 2px 4px !important;
    width: 46%; /* Chia đôi hàng ngang */
    outline: none;
    cursor: pointer;
    font-family: monospace;
}

.footer-date-input:focus {
    border-color: #4F46E5 !important;
    background: white !important;
}

/* Tối ưu icon lịch mặc định của trình duyệt */
.footer-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    filter: grayscale(1);
    margin-left: -10px;
}
/* Hiệu ứng bay từ phải sang cho Chrome/Android */
@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Hiệu ứng bay từ phải sang dành riêng cho Safari/iPhone/Mac */
@-webkit-keyframes fadeInRight {
    from { opacity: 0; -webkit-transform: translateX(15px); }
    to { opacity: 1; -webkit-transform: translateX(0); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translateX(-50%) scale(0.3); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
    70% { transform: translateX(-50%) scale(0.9); }
    100% { transform: translateX(-50%) scale(1); }
}

.promo-step-badge {
    pointer-events: none; /* Khách bấm xuyên qua nhãn để vào nút chọn được */
    border-style: solid;
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes pulse-glow {
    0% { transform: scale(1); box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 10px 30px rgba(16, 185, 129, 0.6); }
    100% { transform: scale(1); box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4); }
}
/* ============================================================
   BỘ GIAO DIỆN HIỆU SUẤT CAO CẤP (SaaS STYLE)
   ============================================================ */

/* 1. Tổng thể Modal */
#reportModal .modal-content {
    max-height: 95vh;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ngăn chặn cuộn ở cấp độ modal */

}

#modalBodyContainer {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 100px); /* Trừ đi chiều cao của Header modal */
    overflow: hidden !important; /* Không cho cả khung to cuộn */
    padding: 0; /* Xóa padding để nội dung dính sát biên nếu cần */
}


.filter-pill {
    border: none;
    padding: 6px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    transition: 0.2s;
}

/* 2. Header Modal */
#modalTitle {
    background: #ffffff;
    padding: 20px 25px !important;
    margin: 0 !important;
    border-bottom: 1px solid #e2e8f0;
}

/* 3. Khu vực 4 Card tóm tắt */
#accDashboard {
    flex-shrink: 0; /* Không cho phép bị co lại */
    padding: 20px 25px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.funnel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Card tóm tắt kiểu mới */
.stat-card-pro {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 18px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card-pro:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

/* Icon trong Card */
.stat-card-pro i {
    font-size: 18px;
    margin-bottom: 5px;
}

.stat-label-pro {
    font-size: 10px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value-pro {
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
    -webkit-background-clip: text; /* Cho Chrome, Safari */
    background-clip: text;         /* Dòng này sẽ làm mất dấu gạch vàng */
    -webkit-text-fill-color: transparent;
}

/* 4. Bảng chi tiết - Style hàng nổi (Floating Rows) */
.history-table {
    min-width: 850px; 
    border-collapse: separate !important;
    border-spacing: 0 10px !important; /* Tạo khoảng cách giữa các hàng */
    padding: 0 25px 25px 25px;
}

.history-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc; /* Phải trùng màu nền Header */
    box-shadow: 0 1px 0 #E2E8F0; /* Đường kẻ mảnh bên dưới */
}

.history-table tbody tr {
    background: #ffffff !important;
    border-radius: 15px !important;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.history-table tbody tr:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.history-table td {
    padding: 15px 12px !important;
    border: none !important;
    vertical-align: middle !important;
}

/* Bo góc cho hàng */
.history-table td:first-child { border-radius: 15px 0 0 15px; }
.history-table td:last-child { border-radius: 0 15px 15px 0; }

/* 5. Icon liên hệ */
.contact-icon-group { display: flex; gap: 5px; justify-content: center; }
.contact-mini {
    width: 22px; height: 22px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; opacity: 0.2; filter: grayscale(1); transition: 0.3s;
}
.contact-mini.active { opacity: 1; filter: grayscale(0); transform: scale(1.1); }

/* 6. Badge Hiệu suất rực rỡ */
.badge-perf {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 13px;
    text-align: right;
}
/* Tối ưu Card tóm tắt nhỏ gọn (Giống hình 2 bạn muốn) */
.compact-card-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 15px 25px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.stat-card-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.stat-card-mini i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
}

.stat-card-mini .val {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    display: block;
}

.stat-card-mini .lbl {
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Nút chuyển đổi Tab Switcher */
.tab-switcher {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    margin: 10px 25px;
    width: fit-content;
}

.tab-btn {
    padding: 6px 15px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    color: #64748b;
    transition: 0.2s;
}

.tab-btn.active {
    background: #fff;
    color: #4f46e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Container cho Chart */
.chart-view-container {
    padding: 0 25px 25px;
}
.magazine-premium-card:hover .mag-img-container img {
    transform: scale(1.1);
}
.magazine-premium-card:hover .light-sweep {
    left: 150%;
    transition: 0.8s ease-in-out;
}
/* Nền cho Catalogue Cafe */
.catalogue-container {
    min-height: 100dvh; /* Sử dụng dvh thay vì vh */
    transition: background 0.3s ease; /* Thêm hiệu ứng chuyển màu cho mượt */

}

/* Hiệu ứng đổ bóng card */
.product-card-sensor:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(62, 39, 35, 0.1) !important;
}

/* Header mượt mà hơn */
#catHeaderArea {
    padding-top: env(safe-area-inset-top); /* Tránh bị đè bởi giờ/pin của iPhone */
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


/* Container kiểu Masonry cho Menu */
.premium-masonry-container, 
.coffee-masonry-container {
    display: grid !important;
    /* Ép 2 cột bằng nhau tuyệt đối, không cho phép nội dung đẩy rộng cột */
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; 
    gap: 10px !important; /* Giảm nhẹ khoảng cách trên mobile */
    padding: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    /* Xóa bỏ column-count cũ để tránh xung đột */
    column-count: auto !important; 
}



.coffee-card-masonry {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border-radius: 25px;
    position: relative;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: none !important;
}


/* Nút cộng màu nâu đặc trưng ở góc */
.add-btn-corner {
    position: absolute;
    top: 0;
    right: 0;
    background: #3e2723; /* Màu nâu đậm */
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 0 25px 0 15px; /* Bo góc theo khung cha */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
}

/* Icon hạt cafe thay cho sao */
.coffee-bean {
    width: 12px;
    height: 12px;
    background: #d7ccc8; /* Màu hạt nhạt */
    mask: url('https://cdn-icons-png.flaticon.com/512/924/924514.png') no-repeat center;
    -webkit-mask: url('https://cdn-icons-png.flaticon.com/512/924/924514.png') no-repeat center;
    mask-size: contain;
    -webkit-mask-size: contain;
    display: inline-block;
    margin-right: 2px;
}
.coffee-bean.active {
    background: #5d4037; /* Màu hạt đậm */
}
.coffee-masonry-container {
    column-count: 2; /* Chia 2 cột */
    column-gap: 15px; /* Khoảng cách giữa 2 cột */
    padding: 15px;
    display: block; /* Masonry không dùng flex/grid */
}

/* Quan trọng: Card bên trong Masonry */
.coffee-card-masonry {
    break-inside: avoid; /* Ngăn không cho thẻ bị cắt đôi khi nhảy cột */
    display: inline-block; /* Hoặc block */
    width: 100%; /* Luôn chiếm hết chiều rộng cột được chia */
    margin-bottom: 15px;
}
/* Container Masonry bản Premium */
.premium-masonry-container {
    column-count: 2;
    column-gap: 12px;
    padding: 12px;
    display: block;
}

/* Thẻ Card Masonry Premium */
.premium-card-masonry {
    display: flex !important;           /* Dùng flex để nội dung bên trong sắp xếp dọc */
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.04);
    border: 1px solid #F1F5F9;
    position: relative;
}


/* Nút Share ở góc trên bên trái */
.share-btn-corner {
    position: absolute;
    top: 0;
    left: 0;
    background: #efebe9; /* Màu nền xám nâu nhạt nhẹ nhàng */
    color: #5d4037;      /* Màu icon nâu cafe */
    width: 35px;
    height: 35px;
    border-radius: 25px 0 15px 0; /* Bo tròn góc trên bên trái, các góc khác vuông để ôm khít card */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 5;
    border-right: 1px solid rgba(0,0,0,0.05);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: 0.2s;
}

.share-btn-corner:hover {
    background: #d7ccc8;
    transform: scale(1.05);
}

/* Đảm bảo nút Add bên phải vẫn giữ đúng style */
.add-btn-corner {
    position: absolute;
    top: 0;
    right: 0;
    background: #3e2723;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 0 25px 0 15px; /* Đối xứng với nút Share */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    z-index: 5;
}
.chart-columns-wrap {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    height: 300px;
    padding: 50px 20px 80px 20px; /* Chừa khoảng trống bên dưới cho icon */
    overflow-x: auto;
    background: #fff;
    border-radius: 16px;
}
/* Nút thêm vào giỏ mặc định cho phong cách Spatial */
.add-btn-corner, .btn-cart-default {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #d4f04d !important; /* Dùng màu Lime phát sáng cho dấu + */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s all ease;
}

.add-btn-corner:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.1);
}
.col-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 50px;
}

.bar-main {
    width: 24px;
    background: linear-gradient(to top, #4F46E5, #818CF8);
    border-radius: 6px 6px 2px 2px;
    position: relative;
    transition: all 0.4s ease;
}

/* Hiệu ứng khi hover vào cột */
.bar-main:hover {
    filter: brightness(1.2);
    transform: scaleX(1.1);
}

/* Nhãn Icon & Ảnh dưới chân cột */
.col-footer {
    position: absolute;
    bottom: -65px; /* Đẩy xuống dưới cột */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.footer-thumb {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.footer-icon {
    font-size: 12px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
}

/* Tooltip tùy chỉnh */
.bar-main .custom-tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    width: 180px;
    z-index: 100;
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
    pointer-events: none;
    opacity: 0;
    transition: 0.2s;
}

.bar-main:hover .custom-tooltip {
    visibility: visible;
    opacity: 1;
    bottom: 120%;
}
/* Khung chứa biểu đồ */
.chart-columns-wrap {
    display: flex;
    align-items: flex-end; /* Gốc cột nằm ở dưới */
    gap: 12px;
    height: 320px; /* BẮT BUỘC: Phải có chiều cao cụ thể */
    padding: 40px 20px 100px 20px; /* Chừa chỗ cho số ở trên và ảnh ở dưới */
    overflow-x: auto;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    margin: 20px 0;
}

.col-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 55px;
    height: 100%; /* Chiếm hết chiều cao khung để tính % cột chính xác */
    justify-content: flex-end; /* Đẩy mọi thứ xuống đáy */
}

/* Thanh cột chính */
.bar-main {
    width: 28px;
    background: linear-gradient(to top, #4F46E5, #818CF8);
    border-radius: 8px 8px 3px 3px;
    position: relative;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    min-height: 2px; /* Để giá trị 0 vẫn thấy 1 vạch mỏng */
}

.bar-main:hover {
    filter: brightness(1.1);
    transform: scaleX(1.1);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}

/* Con số trên đầu cột */
.bar-value-top {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 800;
    color: #4F46E5;
    white-space: nowrap;
}

/* Thumbnail và Icon dưới chân */
.col-footer {
    position: absolute;
    bottom: -85px; /* Đẩy xuống vùng đệm */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.footer-thumb {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
            .pulse-dot { animation: pulse-green 1.5s infinite; }
            @keyframes pulse-green {
                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 6px rgba(16, 185, 129, 0); }
                100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
            }

.footer-icon-mini {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    margin-top: -12px; /* Đè lên ảnh một chút cho nghệ thuật */
    border: 2px solid #fff;
}
/* Tooltip toàn cục không bị phụ thuộc vào container cuộn */
#chart-global-tooltip {
    position: fixed; /* Cố định với màn hình */
    display: none;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none; /* Không cản trở chuột */
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    min-width: 180px;
    animation: fadeIn 0.2s ease-out;
}

.tooltip-header {
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
    text-transform: uppercase;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.tooltip-row b {
    color: #fff;
}
/* Tầng View (Nền nhạt hơn) */
.bar-segment-view {
    background: #E0E7FF; /* Blue 100 */
    width: 100%;
    position: absolute;
    bottom: 0;
    border-radius: 4px;
    z-index: 1;
}

/* Tầng Click (Màu vàng/cam thể hiện sự quan tâm) */
.bar-segment-click {
    background: #F59E0B; /* Amber 500 */
    width: 100%;
    position: absolute;
    bottom: 0;
    border-radius: 4px;
    z-index: 2;
    transition: 0.3s;
}

/* Tầng Contact/Lead (Màu xanh lá - Thành công) */
.bar-segment-contact {
    background: #10B981; /* Emerald 500 */
    width: 100%;
    position: absolute;
    bottom: 0;
    border-radius: 4px;
    z-index: 3;
    transition: 0.3s;
}

/* Chú thích biểu đồ */
.chart-legend {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 11px;
    font-weight: 700;
}
.legend-item { display: flex; align-items: center; gap: 5px; color: #64748B; }
.legend-box { width: 10px; height: 10px; border-radius: 3px; }
/* Màu chuẩn các App Chat */
.bar-zalo { background: #0068FF; }
.bar-messenger { background: #0084FF; }
.bar-telegram { background: #0088cc; }
.bar-whatsapp { background: #25D366; }

/* Màu chuẩn Nền tảng thiết bị */
.bar-ios { background: #000000; }
.bar-android { background: #34A853; }
.bar-pc { background: #64748B; }

/* Layout cho biểu đồ liên hệ */
.contact-chart-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
}

#chart-global-tooltip {
    position: fixed;
    display: none;
    background: rgba(15, 23, 42, 0.95); /* Màu slate đậm */
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 12px;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    min-width: 180px;
    line-height: 1.6;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Hiệu ứng Zoom nhẹ cho các cột để tạo cảm giác chuyên nghiệp */
.bar-interaction-wrapper:hover, .bar-platform-wrapper:hover {
    transform: scaleX(1.05);
    filter: brightness(1.1);
    z-index: 100;
}
.filter-pill, .view-pill {
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    transition: 0.2s all ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-pill {
    font-size: 12px;
    font-weight: 700;
}
/* Container chứa bảng */
/* 3. Khu vực nội dung thay đổi (Bảng/Biểu đồ): Nơi đặt thanh cuộn */
#catalogue-report-content-container {
    flex: 1;
    overflow-y: auto; 
    /* SỬA DÒNG NÀY: Cho phép chứa nội dung rộng hơn nó */
    overflow-x: auto !important; 
    padding: 0 25px 25px 25px;
    position: relative;
    min-height: 0;
}
/* Thêm style để thanh cuộn ngang trông đẹp và mảnh hơn */
#catalogue-report-content-container::-webkit-scrollbar {
    height: 6px; /* Độ dầy thanh cuộn ngang */
    width: 6px;
}

#catalogue-report-content-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

/* 4. Giữ tiêu đề bảng dính chặt khi cuộn */
#catalogue-report-content-container thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.05);
}

/* Thanh cuộn cho khung nội dung Modal */
#modalBodyContainer::-webkit-scrollbar {
    width: 6px;
}
#modalBodyContainer::-webkit-scrollbar-track {
    background: transparent;
}
#modalBodyContainer::-webkit-scrollbar-thumb {
    background: #CBD5E1; 
    border-radius: 10px;
}
#modalBodyContainer::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}


/* Đảm bảo bảng không bị tràn khung */
.history-table {
    min-width: 800px; /* Giữ độ rộng để không bị bóp méo chữ */
}
/* Khung chứa biểu đồ cố định - Không cuộn */
.chart-fixed-container {
    width: 100%;
    height: 420px;
    background: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-sizing: border-box;
}

/* Khu vực vẽ cột - Dàn đều nội dung */
.chart-draw-area {
    width: 100%;
    height: 300px;
    display: flex;
    position: relative;
    padding-left: 60px; /* Chừa lề cho trục Y */
    padding-bottom: 40px; /* Chừa lề cho nhãn */
    justify-content: space-around; /* Dàn đều các cột */
    align-items: flex-end;
    box-sizing: border-box;
}

/* Trục Y cố định bên trái */
.chart-y-axis {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 40px; /* Khớp với draw area */
    width: 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
    border-right: 1px solid #F1F5F9;
    padding-right: 10px;
}
.diff-box-modern {
    padding: 15px;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    transition: 0.3s;
    background: #F8FAFC;
    color: #64748B;
}

.diff-box-modern .check-icon {
    opacity: 0;
    transition: 0.3s;
}

.diff-box-modern.active {
    border-color: #F59E0B;
    background: #FFFBEB;
    color: #D97706;
}

.diff-box-modern.active .check-icon {
    opacity: 1;
}

.diff-box-modern:hover {
    background: #F1F5F9;
}
/* Chèn đoạn này vào file style.css */
@keyframes pulse-radar {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

.radar-ping {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    pointer-events: none;
    animation: pulse-radar 2s infinite;
}
@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
.pulse-red {
    animation: pulse-red 1s infinite;
}
/* ============================================================
   GIAO DIỆN HẠCH TOÁN & SỔ CÁI (MODAL)
   ============================================================ */

/* 1. Hệ thống Tab điều hướng */
.acc-tab-btn {
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    color: #64748B;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.acc-tab-btn:hover {
    color: #1E293B;
    background: rgba(0,0,0,0.03);
}

.acc-tab-btn.active {
    background: white;
    color: #4F46E5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

/* 2. Thẻ KPI (5 thẻ trên cùng) */
.acc-kpi-card {
    padding: 15px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.acc-kpi-card:hover {
    transform: translateY(-2px);
}

.acc-kpi-card .lbl {
    font-size: 9px;
    font-weight: 800;
    color: #64748B;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.acc-kpi-card .val {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

/* 3. Biểu đồ thanh ngang (iPhone Storage Style) */
/* Class này giúp thanh màu có hiệu ứng bóng đổ và bo góc mượt */
#accPermanentChart .storage-bar-segment {
    height: 100%;
    transition: width 1.2s cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
}

/* Hiệu ứng nháy đỏ khi hết ngân sách */
@keyframes pulse-red-border {
    0% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: inset 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
}

.exhausted-flash {
    animation: pulse-red-border 2s infinite;
    border: 1.5px solid #EF4444 !important;
}

/* 4. Xử lý bảng và cột dữ liệu */
.history-table th {
    font-weight: 800 !important;
    letter-spacing: 0.5px;
    padding: 15px 12px !important;
}

.truncate-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
    font-weight: 700;
    color: #1E293B;
    cursor: help;
}

/* 5. Trạng thái chiến dịch (Pills) */
.status-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 8px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-running { 
    background: #DCFCE7; 
    color: #15803D; 
}
.status-running::before {
    content: '';
    width: 6px; height: 6px;
    background: #22C55E;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-green 2s infinite;
}

.status-paused { background: #FEF3C7; color: #92400E; }
.status-deleted { background: #F1F5F9; color: #64748B; opacity: 0.8; }

/* 6. Hiệu ứng Pulse cho chấm xanh */
@keyframes pulse-green {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Tooltip tùy chỉnh khi hover vào tên chiến dịch */
.truncate-name:hover::after {
    content: attr(title);
    position: absolute;
    background: #1E293B;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    z-index: 1000;
    white-space: normal;
    width: 250px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    margin-top: 25px;
}
/* Truncate cho Sổ cái */
.truncate-ledger {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Độ rộng tối đa trước khi hiện ... */
    display: inline-block;
    vertical-align: middle;
    cursor: help;
}

/* Tooltip mặc định của trình duyệt đã có qua thuộc tính title, 
   nhưng chúng ta tối ưu màu sắc để người dùng dễ chú ý */
.truncate-ledger:hover {
    color: #4F46E5;
    text-decoration: underline;
}

/* Badge cho các loại giao dịch */
.badge-type {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
}
.type-inject { background: #ECFDF5; color: #10B981; border: 1px solid #BBF7D0; } /* Nạp tiền */
.type-claim { background: #FFF1F2; color: #E11D48; border: 1px solid #FECACA; }  /* Khách trúng */
.type-revoke { background: #F1F5F9; color: #64748B; border: 1px solid #E2E8F0; } /* Thu hồi/Xóa */
/* Container cho biểu đồ thanh ngang */
#accPermanentChart {
    background: #ffffff;
    border-radius: 12px;
    padding: 12px 15px;
    border: 1px solid #E2E8F0;
}

/* Thanh bar chính */
.storage-progress-container {
    width: 100%;
    height: 8px; /* Giảm từ 16px xuống 8px - Rất tinh tế */
    background: #F1F5F9;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    border: none; /* Bỏ border để nhìn thanh thoát hơn */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* Label chú thích nhỏ dưới bar */
.storage-legend {
    display: flex;
    gap: 12px;
    margin-top: 6px; /* Giảm khoảng cách với thanh bar */
    font-size: 9px;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
}


.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-item .dot {
    width: 6px;
    height: 6px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
/* Container chứa bảng cuộn */
#accScrollArea {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px 25px 25px;
}

/* Cố định Head của bảng */
#accTableHeader th {
    position: sticky;
    top: 0;
    background: #F8FAFC; /* Phải khớp màu nền phía sau */
    z-index: 100;
    padding: 15px 12px;
    border-bottom: 2px solid #E2E8F0;
    color: #64748B;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
}

/* Đảm bảo table border không đè head */
.history-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}
/* Khống chế tên chiến dịch trong bảng đối soát */
.accounting-name-wrapper {
    max-width: 220px; /* Độ rộng vừa phải để bảng cân đối */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Tạo dấu ... */
    display: block;
    font-weight: 700;
    color: #1E293B;
    cursor: help; /* Hiệu ứng chuột để biết có thể xem thêm */
}

/* Tooltip mặc định khi hover */
.accounting-name-wrapper:hover {
    color: #4F46E5;
}
/* Container bọc chart để bắt sự kiện hover */
.budget-bar-wrapper {
    position: relative;
    cursor: help;
    padding: 10px 0; /* Giảm từ 20px xuống 10px */
    min-height: auto; 
}



/* Khung Tooltip chi tiết */
.budget-tooltip {
    position: absolute;
    /* Căn giữa tuyệt đối theo tâm của wrapper */
    top: 50%; 
    left: 50%;
    /* Dịch chuyển ngược lại 50% kích thước bản thân và tạo hiệu ứng phóng nhẹ */
    transform: translate(-50%, -50%) scale(0.9); 
    
    background: rgba(15, 23, 42, 0.98); 
    color: white;
    padding: 18px;
    border-radius: 16px;
    width: 300px;
    z-index: 1000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Hiệu ứng mượt */
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
}


.budget-bar-wrapper:hover .budget-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}


/* Các dòng trong tooltip */
.tt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}
.tt-row:last-child { margin-bottom: 0; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.1); }

.tt-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; display: inline-block; }
.tt-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.tt-per { font-size: 10px; opacity: 0.6; margin-left: 5px; }
/* Tab con nhỏ gọn */
.acc-tab-btn-mini {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    color: #64748B;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.acc-tab-btn-mini.active { background: white; color: #4F46E5; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

/* Stats Belt - Thanh thông số mảnh */
.stats-mini { display: flex; flex-direction: column; gap: 2px; }
.stats-mini .lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; color: #94A3B8; }
.stats-mini .val { font-size: 16px; font-weight: 900; color: #1E293B; }
.stats-mini-sep { width: 1px; height: 25px; background: #E2E8F0; }

/* Nút Excel nhỏ */
.btn-mini-success {
    width: 32px; height: 32px; border-radius: 8px; background: #10B981; color: #fff;
    border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Header bảng chuyên nghiệp */
.table-head-pro th {
    background: #F8FAFC; color: #64748B; font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #E2E8F0;
}

/* Tối ưu thanh scroll */
#accScrollArea::-webkit-scrollbar { width: 6px; }
#accScrollArea::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
/* Stats Belt - Thanh thông số mảnh kiểu SaaS */
.stats-belt-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}


.stats-belt-item .lbl {
    font-size: 9px;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.stats-belt-item .val {
    font-size: 16px;
    font-weight: 900;
    color: #1E293B;
}


.stats-belt-sep {
    width: 1px;
    height: 25px;
    background: #E2E8F0;
}

/* Tối ưu Header Table */
.history-table th {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    padding: 12px 15px !important;
}

/* Nút Tab nhỏ gọn */
.acc-tab-btn-mini {
    border: none;
    background: transparent;
    padding: 6px 15px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    color: #64748B;
    transition: 0.2s;
}

.acc-tab-btn-mini.active {
    background: white;
    color: #4F46E5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.acc-tab-btn-mini:hover {
    color: #1E293B;
}
.btn-excel-mini {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #10B981;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.btn-excel-mini:hover {
    background: #059669;
    transform: scale(1.05);
}
/* Thẻ thông số có thể bấm được */
.stats-belt-item.clickable {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: 0.2s;
}
.stats-belt-item.clickable:hover {
    background: #F8FAFC;
    transform: translateY(-1px);
}

/* Nút viên thuốc (Status Pills) */
.status-pill-btn {
    border: 1px solid #E2E8F0;
    background: white;
    color: #64748B;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.status-pill-btn:hover {
    border-color: #4F46E5;
    color: #4F46E5;
}

.status-pill-btn.active {
    background: #4F46E5;
    color: white;
    border-color: #4F46E5;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}
.source-pill-btn {
    border: none;
    background: transparent;
    color: #64748B;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
}

.source-pill-btn.active {
    background: white;
    color: #4F46E5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
/* Hiệu ứng đèn nhấp nháy xung quanh vòng quay */
@keyframes wheel-glow {
    0% { box-shadow: 0 0 10px rgba(79, 70, 229, 0.2); }
    50% { box-shadow: 0 0 20px rgba(79, 70, 229, 0.5); }
    100% { box-shadow: 0 0 10px rgba(79, 70, 229, 0.2); }
}

#previewWheel {
    animation: wheel-rotate-demo 20s linear infinite;
}

@keyframes wheel-rotate-demo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* Hiệu ứng hàng mới rơi từ trên xuống */
@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Class áp dụng animation */
.prize-item-row {
    animation: fadeInDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Làm đẹp thanh cuộn cho khu vực danh sách quà tặng */
#prizeScrollBox::-webkit-scrollbar {
    width: 6px;
}
#prizeScrollBox::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 10px;
}
#prizeScrollBox::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}
#prizeScrollBox::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}
/* --- TỐI ƯU CHO MOBILE (IPHONE) --- */
@media (max-width: 767px) {
    /* 1. Ẩn sidebar để lấy không gian (cho nhân viên) */
    .sidebar {
        display: none !important;
    }

    /* 2. 🛡️ QUAN TRỌNG: Ẩn cột quảng cáo bên trái ở trang chủ */
    /* Để nhân viên mở máy lên là thấy ô đăng nhập ngay, không phải vuốt xuống */
    .left-panel.hide-mobile {
        display: none !important;
    }

    /* 3. Đưa khối Đăng nhập/Đăng ký lên làm tâm điểm */
    /* Ép container cha chuyển từ hàng ngang (flex) sang hàng dọc */
    div[style*="height: 100vh; display: flex;"] {
        display: block !important;
        background: #f8fafc !important; /* Nền xám nhạt cho giống App */
        overflow-y: auto !important;
    }

    /* 4. Tối ưu lại vùng chứa form Đăng nhập */
    div[style*="flex: 1; background: white;"] {
        padding: 40px 20px !important;
        background: transparent !important; /* Để lộ nền xám nhạt */
    }

    /* Bo tròn trắng khối đăng nhập cho đẹp (Mobile-First) */
    div[style*="max-width: 360px;"] {
        background: white !important;
        padding: 35px 25px !important;
        border-radius: 28px !important;
        box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important;
        margin: 0 auto !important;
        width: 100% !important;
    }

    /* 5. Cho phép vùng chính POS chiếm 100% màn hình */
    .main-content {
        margin-left: 0 !important;
        padding: 15px !important;
        width: 100% !important;
    }

    /* 6. Hiện Logo mini khi dùng điện thoại */
    .show-mobile {
        display: block !important;
    }

    /* 7. Các tùy chỉnh nút bấm và input POS cũ của sếp giữ nguyên */
    .main-center-area { margin-top: 20px !important; }
    .main-center-area > div { max-width: 100% !important; padding: 30px 15px !important; border-radius: 20px !important; }
    .cta-btn, .btn-primary { height: 60px !important; font-size: 16px !important; }
    #voucherCheckInputLarge { height: 70px !important; font-size: 36px !important; letter-spacing: 5px !important; }
}

/* Màu cho Thu hồi thực tế (Đỏ đậm) */
.badge-type.type-revoke-real {
    background: #FFF1F2;
    color: #BE185D;
    border: 1px solid #FECACA;
}
/* Màu cho Vốn dự kiến (Cam) */
.badge-type.type-scheduled {
    background: #FFFBEB;
    color: #D97706;
    border: 1px solid #FEF3C7;
}
/* --- HIỆU ỨNG TAB BỊ KHÓA TRÊN SIDEBAR --- */
.sub-nav-item.locked-tab {
    position: relative;
    overflow: hidden;
    color: #64748B !important; /* Màu chữ mờ đi */
}

.sub-nav-item.locked-tab:hover {
    background: rgba(241, 245, 249, 0.1) !important;
    cursor: not-allowed;
}

/* Làm mờ icon của tab bị khóa (trừ icon ổ khóa) */
.sub-nav-item.locked-tab i:not(.fa-lock) {
    opacity: 0.4;
}

/* Hiệu ứng rung nhẹ khi di chuột vào tab bị khóa để báo hiệu không bấm được */
.sub-nav-item.locked-tab:active {
    animation: shake 0.2s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.partner-section-wrapper {
    max-width: 1300px; /* Tăng độ rộng tối đa */
    margin: 0 auto;
    padding: 20px;
}

/* Hiệu ứng thẻ số dư cao cấp */
.balance-card-premium {
    transition: all 0.3s ease;
    border: none !important;
}

.balance-card-premium:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.25) !important;
}

/* Style cho bảng lịch sử */
.log-table-container {
    background: white;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

/* Nút sao chép link to và rõ ràng hơn */
.copy-link-box {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
/* Tìm và cập nhật lại class này */
.partner-main-layout {
    display: grid;
    grid-template-columns: 1fr 350px; /* Chia 2 cột rõ ràng */
    gap: 25px;
    width: 100%;
    max-width: none !important;
    align-items: start;
}
.partner-side-panel {
    position: sticky;
    top: 30px;
}
.partner-left-area {
    min-width: 0; /* Chống vỡ layout trên mobile */
}

.kyc-form-panel {
    background: white;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    padding: 25px;
    /* Đảm bảo nội dung luôn hiển thị */
    display: block !important; 
    visibility: visible !important;
    opacity: 1 !important;
}


/* Đảm bảo wrapper không giới hạn chiều rộng */
.affiliate-wrapper {
    width: 100%;
    max-width: none !important; 
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
.fa-envelope {
    animation: bounce 2s infinite;
}
#realFullNameAff {
    text-transform: uppercase;
}
/* --- 11. KYC PREVIEW STYLES --- */
.kyc-preview-mini {
    width: 32px; 
    height: 32px; 
    border-radius: 6px; 
    border: 1px solid var(--border); 
    background: #F8FAFC; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    flex-shrink: 0; 
    font-size: 12px; 
    color: #CBD5E1;
}

.kyc-preview-mini img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}
/* Layout chia 2 vùng khi vào tab KYC */
.kyc-layout-container {
    display: flex;
    gap: 25px;
    height: 100%;
}

.kyc-table-area {
    flex: 1; /* Bảng bên trái chiếm hết không gian còn lại */
    transition: 0.3s;
}

/* Panel đối soát bên phải (Y hệt hình) */
.kyc-inspector-panel {
    width: 380px;
    background: var(--card);
    border-radius: 24px;
    border: 1px solid var(--border);
    display: none; /* Mặc định ẩn, chỉ hiện khi bấm soi */
    flex-direction: column;
    animation: fadeInRight 0.3s ease;
}

.inspector-header {
    padding: 25px;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}

.inspector-body {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
}

.info-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-bottom: 5px; }
.info-value { font-size: 16px; font-weight: 800; color: var(--text-main); margin-bottom: 20px; }
.info-value.id-highlight { color: var(--warning); }
.info-value.bank-highlight { color: var(--success); }

/* Khung hình ảnh CCCD */
.cccd-viewer-box {
    width: 100%;
    aspect-ratio: 3/2;
    background: #080a11;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.cccd-viewer-box img { width: 100%; height: 100%; object-fit: contain; }

.img-toggle-btns {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.img-toggle-btn {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 11px; font-weight: 700; cursor: pointer;
}
.img-toggle-btn.active { color: var(--text-main); border-bottom: 2px solid var(--primary); }

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

#kycInspector {
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}
/* Panel bên phải - Fix chiều cao bằng màn hình */
#kycInspector {
    width: 400px;
    background: #111827;
    border-radius: 24px;
    border: 1px solid var(--border);
    display: none;
    flex-direction: column; /* Quan trọng: Chia Header và Body theo chiều dọc */
    height: calc(100vh - 160px); 
    position: sticky;
    top: 20px;
    overflow: hidden; /* Không cho cả cục cuộn */
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
}

/* Phần nội dung ở giữa - Cho phép cuộn */
#inspectorContent {
    padding: 20px 25px;
    flex: 1;
    overflow-y: auto; /* Chỉ vùng này được cuộn */
    scrollbar-width: thin;
}

/* Footer chứa nút - Cố định ở đáy */
#inspectorActions {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: #161e2d;
    display: flex;
    gap: 10px;
    flex-shrink: 0; /* Không cho vùng này bị co lại */
}
/* Màu dành riêng cho gói được tặng (GIFTED) */
.status-gifted-bg {
    background: rgba(139, 92, 246, 0.1) !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

/* Màu chữ tím đậm */
.status-gifted-text {
    color: #8B5CF6 !important;
}

/* Nút nâng cấp riêng cho hội viên được tặng */
.btn-gifted {
    background: #8B5CF6 !important;
}

/* --- TỐI ƯU THANH TRƯỢT BẢNG CHO ADMIN --- */
.table-responsive {
    max-height: calc(100vh - 420px); /* Tự động tính toán chiều cao để không tràn màn hình */
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Giữ cố định tiêu đề (Header) khi cuộn dữ liệu */
#mainTable thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #161e2d; /* Màu chuẩn của var(--card) để che nội dung bên dưới */
    box-shadow: 0 1px 0 var(--border); /* Đường kẻ mảnh bên dưới tiêu đề */
}

/* Làm đẹp thanh trượt cho đồng bộ giao diện Dark Mode */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Tự động chia cột dựa trên số lượng thẻ stat-card thực tế */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.search-box {
    background: var(--bg);
    border: 1px solid var(--border);
    color: #fff;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 12px;
    outline: none;
    transition: 0.3s;
}

.search-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.pulse-dot {
    width: 6px;
    height: 6px;
    background: #10b981; /* Màu xanh lá */
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
    animation: pulse-green 1.5s infinite;
}

@keyframes pulse-green {
    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 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
#statsGrid {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
    /* Tự động co giãn: tối thiểu 160px mỗi thẻ */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
}
/* Tìm ô input tìm kiếm trong Catalogue */
#clientSearchInput {
    /* 1. Tạo hiệu ứng kính mờ */
    background-color: rgba(255, 255, 255, 0.6) !important; /* Nền trắng trong suốt 60% */
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    
    /* 2. Màu chữ: Phải là màu tối để nổi trên nền sáng */
    color: #1e293b !important; 
    font-weight: 600;
    
    /* 3. Viền tinh tế */
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 14px;
    outline: none;
    transition: all 0.3s ease;
}

/* 4. Màu chữ gợi ý (Placeholder) */
#clientSearchInput::placeholder {
    color: #64748b !important; /* Màu xám đậm hơn chút cho rõ */
    opacity: 0.8;
}

/* 5. Hiệu ứng khi bấm vào (Focus) */
#clientSearchInput:focus {
    background-color: rgba(255, 255, 255, 0.9) !important; /* Hiện rõ nền hơn khi gõ */
    border-color: #ff4d4d !important; /* Viền đỏ theo tông Flash Sale */
    box-shadow: 0 0 0 4px rgba(255, 77, 77, 0.1) !important;
    color: #000000 !important; /* Chữ đen tuyền khi đang gõ cho cực rõ */
}


.stat-card .sub-label {
    margin-top: 4px;
    line-height: 1.2;
    letter-spacing: 0.2px;
}
@keyframes wobble {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}
/* --- TỐI ƯU HIỆU NĂNG CHO 1.000 SẢN PHẨM --- */
.product-card-sensor {
    /* Trình duyệt chỉ vẽ (render) món này khi khách cuộn tới gần */
    content-visibility: auto;
    
    /* Cung cấp kích thước tạm thời để thanh cuộn không bị "nhảy" */
    contain-intrinsic-size: 300px; 
    
    /* Đảm bảo các thuộc tính không bị ảnh hưởng khi ẩn/hiện */
    contain: layout style paint;
}
/* Style cho nút ADD ở trạng thái bình thường trong theme tối */
.product-card-sensor div[onclick*="addToCart"], 
.product-card-sensor div[onclick*="cartAction"] {
    background: rgba(255, 255, 255, 0.08); /* Nền kính mờ */
    color: #d4f04d; /* Màu chữ xanh chanh phát sáng */
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s all ease;
}
#cartWrapper {
    background: rgba(15, 23, 31, 0.7) !important; /* Nền tối mờ */
    backdrop-filter: blur(20px) saturate(180%); /* Hiệu ứng kính mờ đặc trưng Apple */
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1) !important; /* Viền kính mảnh */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
}
/* Hiệu ứng khi hover (di chuột vào) */
.product-card-sensor div[onclick*="addToCart"]:hover {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(212, 240, 77, 0.2);
}
/* Hiệu ứng mượt mà khi món ăn xuất hiện */
.product-card-sensor:not([style*="display: none"]) {
    animation: fadeIn 0.4s ease forwards;
}
        @keyframes floating {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }
        .floating-icon { animation: floating 3s ease-in-out infinite; }
        
        /* Logo dưới cùng: Trắng mờ tinh tế */
        .trust-logo-footer {
            filter: brightness(0) invert(1);
            opacity: 0.5;
            max-height: 18px;
            width: auto;
        }

        /* Tối ưu layout để không phải cuộn */
        .left-panel {
            flex: 1.8; 
            background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%); 
            padding: 25px 50px; 
            color: white; 
            display: flex; 
            flex-direction: column; 
            justify-content: center; 
            position: relative; 
            overflow: hidden;
        }

        .feature-card {
            background: rgba(255,255,255,0.08); 
            padding: 15px 20px; 
            border-radius: 16px; 
            border: 1px solid rgba(255,255,255,0.1); 
            backdrop-filter: blur(10px);
        }
.trust-text-item {
    font-size: 11px;
    font-weight: 800;
    color: white;
    opacity: 0.5; /* Làm mờ nhẹ giống style logo trắng */
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.trust-text-item i {
    font-size: 14px; /* Icon to hơn chữ một chút cho cân đối */
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

#cartCountBadge {
    animation: bounce 2s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); /* Tạo hiệu ứng phát sáng nhẹ cho chấm đỏ */
}
/* --- DEMO ANIMATION LUỒNG: SCAN -> SHOP --- */

/* 1. Hiệu ứng quét laser */
@keyframes laserScan {
    0%, 100% { top: 0%; opacity: 0; }
    30%, 70% { opacity: 1; }
    50% { top: 100%; }
}
.scan-line {
    animation: laserScan 2s infinite ease-in-out;
}

/* 2. Chuyển đổi giữa Màn hình Quét và Màn hình Shop */
@keyframes viewSwitch {
    0%, 35% { opacity: 1; transform: scale(1); z-index: 5; } /* Màn hình QR hiện */
    40%, 100% { opacity: 0; transform: scale(1.1); z-index: 3; } /* Màn hình QR ẩn */
}
.demo-qr-view {
    animation: viewSwitch 8s infinite;
}

@keyframes shopFadeIn {
    0%, 35% { opacity: 0; }
    40%, 95% { opacity: 1; }
    100% { opacity: 0; }
}
.demo-shop-view {
    animation: shopFadeIn 8s infinite;
}

/* 3. Hiệu ứng sản phẩm trượt lên (Scroll) */
@keyframes catalogueScroll {
    0%, 45% { transform: translateY(0); }
    60%, 75% { transform: translateY(-60px); } /* Trượt lên xem món dưới */
    90%, 100% { transform: translateY(0); }
}
.product-slider {
    animation: catalogueScroll 8s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

/* 4. Con trỏ tay hướng dẫn trượt */
@keyframes handSwipe {
    0%, 50% { opacity: 0; transform: translateY(0); }
    55% { opacity: 1; }
    70% { transform: translateY(-40px); opacity: 0; }
    100% { opacity: 0; }
}
.demo-hand {
    animation: handSwipe 8s infinite;
}

/* Style cho các thẻ sản phẩm mini */
.mini-card {
    background: white;
    border-radius: 4px;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 0.5px solid #eee;
}
.mini-img {
    width: 100%;
    height: 30px;
    background: #E2E8F0;
    border-radius: 2px;
    margin-bottom: 3px;
}
.mini-line {
    height: 2px;
    background: #E2E8F0;
    margin-bottom: 2px;
    border-radius: 10px;
}

.flag-icon {
    width: 16px;
    height: 12px;
    border-radius: 2px; /* Bo góc nhẹ */
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    filter: brightness(0.9);
    transition: all 0.2s ease;
}

.flag-icon:hover {
    transform: scale(1.3);
    filter: brightness(1.1);
    z-index: 10;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}
@media print {
    /* 1. Xóa sổ mọi thứ trên trang */
    body * {
        visibility: hidden;
        background: none !important; /* Không in màu nền của app */
    }

    /* 2. Chỉ chọn đúng khung Standee để hiển thị */
    /* Lưu ý: Sếp kiểm tra class này có bao bọc toàn bộ khung trắng của Standee không nhé */
    .qr-standee-preview, .qr-standee-preview * {
        visibility: visible;
    }

    /* 3. Đưa Standee ra giữa trang in và xóa viền */
    .qr-standee-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: block !important;
        border: none !important;
        box-shadow: none !important;
        padding: 40px 0;
        text-align: center;
    }

    /* 4. Phóng to mã QR (Dùng cả img và canvas vì thư viện QR có thể tạo 1 trong 2) */
    #qrPreviewBox img, #qrPreviewBox canvas {
        width: 350px !important;
        height: 350px !important;
        margin: 0 auto;
    }

    /* 5. Ẩn 2 cái nút con (In mã này, Lấy QR menu) trong bản in */
    .qr-standee-preview .btn, 
    .qr-standee-preview button,
    .qr-standee-preview span[onclick] {
        display: none !important;
    }

    /* 6. Chỉnh tên shop to, đậm, đen tuyền */
    .qr-standee-preview div {
        font-size: 28pt !important;
        font-weight: 900 !important;
        color: #000 !important;
        margin-top: 20px !important;
    }
}

/* Hiệu ứng hào quang nhịp điệu cho Icon Kênh */
@keyframes channel-glow {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 var(--pulse-color); 
    }
    70% { 
        transform: scale(1.1); 
        /* Tạo vầng sáng lan tỏa xung quanh */
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); 
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); 
    }
}

.pulse-channel {
    animation: channel-glow 2s infinite ease-in-out;
    /* Đảm bảo icon luôn nổi bật */
    z-index: 10;
}

/* Hiệu ứng khi di chuột vào (Hover) sẽ nháy nhanh hơn để gây chú ý */
.pulse-channel:hover {
    animation-duration: 1s;
    filter: brightness(1.2);
}

/* 1. Hiệu ứng nhịp đập tỏa sáng cho toàn bộ khung nút */
.pulse-google {
    transition: 0.3s;
    /* Kích hoạt vòng tròn ánh sáng lan tỏa */
    animation: google-halo-pulse 2s infinite;
    position: relative;
}

@keyframes google-halo-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        /* Tỏa ra 10px rồi mờ dần */
        box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* 2. Hiệu ứng Ngôi sao lấp lánh (Twinkle) - Giữ ý tưởng của sếp */
.pulse-google i.fa-star {
    animation: star-twinkle 1.5s infinite ease-in-out;
    color: #FADB14;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.2));
}

@keyframes star-twinkle {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.3); filter: brightness(1.2) drop-shadow(0 0 5px #FADB14); }
}

/* 3. Phản hồi khi di chuột (Hover) */
.pulse-google:hover {
    background: rgba(255,255,255,0.25) !important;
    transform: translateY(-2px) scale(1.02);
    animation: none; /* Dừng pulse khi đang tương tác để khách nhìn rõ */
}

/* 4. Phản hồi khi chạm (Active) - Quan trọng cho Mobile */
.pulse-google:active {
    transform: scale(0.95);
    opacity: 0.9;
}
/* Hiệu ứng ngôi sao lấp lánh nhẹ */
.pulse-google i.fa-star {
    animation: star-twinkle 1.5s infinite ease-in-out;
}

@keyframes star-twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}

/* Hiệu ứng nảy của icon Ghim vị trí */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

