/* =========================================================
   CỐT LÕI CSS - AURORA 3D GLASS THEME
   ========================================================= */
:root { 
    --primary: #667eea; 
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    /* Nền trong suốt để lộ hiệu ứng cực quang bên dưới */
    --bg-body: transparent; 
    --bg-sidebar: rgba(255, 255, 255, 0.5); 
    --bg-card: rgba(255, 255, 255, 0.45); 
    --text-main: #1e293b; 
    --text-sub: #475569; 
    --price-bg: rgba(102, 126, 234, 0.15); 
    --price-text: #667eea; 
    --border-color: rgba(255, 255, 255, 0.5); 
    
    /* Bóng đổ Kính 3D: Sâu bên dưới, phát sáng bên trên */
    --shadow-3d: 0 20px 40px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05), inset 0 6px 15px rgba(255, 255, 255, 0.8), inset 0 -4px 10px rgba(255, 255, 255, 0.2);
    --shadow-3d-hover: 0 25px 50px rgba(0,0,0,0.15), inset 0 6px 15px rgba(255, 255, 255, 0.9), inset 0 -4px 10px rgba(255, 255, 255, 0.3);
    --shadow-inset-deep: inset 0 4px 8px rgba(0, 0, 0, 0.05), inset 0 -4px 8px rgba(255, 255, 255, 0.9);
    
    --brand-green: #10b981; 
    --brand-gradient: linear-gradient(145deg, #34d399 0%, #059669 100%);
    --court-active: rgba(16, 185, 129, 0.15); 
    --court-idle: rgba(255, 255, 255, 0.45); 
}

[data-theme="dark"] { 
    /* Dải ngân hà phiên bản ban đêm */
    --primary: #a1c4fd; 
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #a1c4fd 100%); 
    --bg-body: transparent; 
    --bg-sidebar: rgba(15, 23, 42, 0.6); 
    --bg-card: rgba(30, 41, 59, 0.6); 
    --text-main: #f8fafc; 
    --text-sub: #cbd5e1; 
    --price-bg: rgba(161, 196, 253, 0.15); 
    --price-text: #a1c4fd; 
    --border-color: rgba(255, 255, 255, 0.1); 
    
    --shadow-3d: 0 20px 40px rgba(0,0,0,0.4), inset 0 2px 5px rgba(255,255,255,0.1), inset 0 -2px 5px rgba(0,0,0,0.2);
    --shadow-3d-hover: 0 25px 50px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.15);
    --shadow-inset-deep: inset 0 4px 8px rgba(0,0,0,0.4), inset 0 -2px 4px rgba(255,255,255,0.05);
    
    --brand-green: #10b981; 
    --brand-gradient: linear-gradient(145deg, #10b981 0%, #047857 100%);
    --court-active: rgba(16, 185, 129, 0.25); 
    --court-idle: rgba(30, 41, 59, 0.6); 
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* HIỆU ỨNG NỀN AURORA ĐỘNG CHO BODY */
body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background: linear-gradient(-45deg, #ff9a9e, #fecfef, #a1c4fd, #c2e9fb);
    background-size: 400% 400%;
    animation: aurora-flow 15s ease infinite;
    margin: 0; 
    height: 100vh; 
    display: flex; 
    overflow: hidden; 
    color: var(--text-main); 
    transition: color 0.4s ease; 
}

[data-theme="dark"] body {
    background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #020617);
    background-size: 400% 400%;
    animation: aurora-flow 15s ease infinite;
}

@keyframes aurora-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =========================================================
   SIDEBAR & MAIN CONTENT (GLASSMORPHISM)
   ========================================================= */
.sidebar { 
    width: 260px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border-color); 
    padding: 25px 15px; 
    display: flex; 
    flex-direction: column; 
    z-index: 100; 
    flex-shrink: 0; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
}

.main { 
    flex: 1; 
    padding: 20px; 
    padding-bottom: 120px; 
    display: none; 
    flex-direction: column; 
    height: 100vh; 
    overflow-y: auto !important; 
    overflow-x: hidden !important; 
    -webkit-overflow-scrolling: touch; 
}
.main.active { display: flex !important; }

/* =========================================================
   UI COMPONENTS - 3D GLASS STYLE
   ========================================================= */
.card { 
    background: var(--bg-card); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 22px; 
    border-radius: 28px; 
    border-top: 2px solid rgba(255, 255, 255, 0.8);
    border-left: 2px solid rgba(255, 255, 255, 0.6);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-3d); 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s; 
    overflow: visible !important; 
    height: auto !important;
}
[data-theme="dark"] .card {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.card:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--shadow-3d-hover); 
}

/* Ô Nhập Liệu (Lõm sâu vào kính) */
.input-box { 
    width: 100%; 
    padding: 14px 18px; 
    background: rgba(255, 255, 255, 0.5); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    color: var(--text-main); 
    outline: none; 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: var(--shadow-inset-deep); 
    font-weight: 600; 
}
[data-theme="dark"] .input-box { background: rgba(0, 0, 0, 0.2); }
.input-box:focus { 
    background: rgba(255, 255, 255, 0.8); 
    border-color: transparent; 
    box-shadow: var(--shadow-inset-deep), 0 0 0 3px rgba(161, 196, 253, 0.5); 
}
[data-theme="dark"] .input-box:focus { 
    background: rgba(0, 0, 0, 0.4); 
    box-shadow: var(--shadow-inset-deep), 0 0 0 3px rgba(161, 196, 253, 0.3); 
}

/* NÚT BẤM VẬT LÝ 3D CÓ ĐẾ TẠO ĐỘ LÚN */
.btn { 
    width: 100%; padding: 14px; border-radius: 16px; border: none; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.15s; 
    color: var(--text-sub); 
    background: rgba(255, 255, 255, 0.7); 
    box-shadow: 0 6px 0 rgba(200, 205, 215, 0.6), 0 10px 15px rgba(0, 0, 0, 0.05), inset 0 2px 5px rgba(255, 255, 255, 1); 
    border: 1px solid rgba(255, 255, 255, 0.8);
}
[data-theme="dark"] .btn { 
    background: rgba(30, 41, 59, 0.8); 
    box-shadow: 0 6px 0 #0f172a, 0 10px 15px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.1); color: var(--text-main); 
}

.btn:hover { 
    filter: brightness(1.05); transform: translateY(-2px); 
    box-shadow: 0 8px 0 rgba(200, 205, 215, 0.6), 0 12px 20px rgba(0, 0, 0, 0.08), inset 0 2px 5px rgba(255, 255, 255, 1); 
}
[data-theme="dark"] .btn:hover { 
    box-shadow: 0 8px 0 #0f172a, 0 12px 20px rgba(0, 0, 0, 0.6), inset 0 2px 5px rgba(255, 255, 255, 0.15); 
}

.btn:active { 
    transform: translateY(6px); 
    box-shadow: 0 0 0 rgba(200, 205, 215, 0.6), 0 2px 5px rgba(0, 0, 0, 0.05) !important; 
    filter: brightness(0.95); 
}
[data-theme="dark"] .btn:active { box-shadow: 0 0 0 #0f172a, 0 2px 5px rgba(0, 0, 0, 0.3) !important; }

/* Nút Thanh Toán (Primary) */
.btn-pay { 
    background: var(--primary-gradient); color: white; border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 6px 0 #4a2f68, 0 10px 20px rgba(118, 75, 162, 0.3), inset 0 2px 5px rgba(255, 255, 255, 0.4); text-shadow: 0 1px 2px rgba(0,0,0,0.2); 
}
[data-theme="dark"] .btn-pay { box-shadow: 0 6px 0 #1e1b4b, 0 10px 20px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 0.2); }

.btn-pay:hover { 
    filter: brightness(1.1); transform: translateY(-2px); 
    box-shadow: 0 8px 0 #4a2f68, 0 15px 25px rgba(118, 75, 162, 0.4), inset 0 2px 5px rgba(255, 255, 255, 0.5); 
}
[data-theme="dark"] .btn-pay:hover { box-shadow: 0 8px 0 #1e1b4b, 0 15px 25px rgba(0, 0, 0, 0.6), inset 0 2px 5px rgba(255, 255, 255, 0.3); }

.btn-pay:active { transform: translateY(6px); box-shadow: 0 0 0 #4a2f68, 0 2px 5px rgba(118, 75, 162, 0.3) !important; }
[data-theme="dark"] .btn-pay:active { box-shadow: 0 0 0 #1e1b4b, 0 2px 5px rgba(0, 0, 0, 0.4) !important; }

.btn-sm { padding: 8px 16px; width: auto; font-size: 13px; border-radius: 10px; }

/* =========================================================
   BẢNG & MENU BÊN TRÁI
   ========================================================= */
.table-responsive { width: 100%; overflow-x: auto !important; overflow-y: visible !important; -webkit-overflow-scrolling: touch; margin-top: 10px; min-height: 200px; }
.table-wrapper { 
    border-radius: 16px; border: 1px solid var(--border-color); overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); background: var(--bg-card); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); 
}
.table-modern { width: 100%; min-width: 950px; border-collapse: separate; border-spacing: 0; table-layout: fixed !important; }
.table-modern th { text-align: left; padding: 14px 16px; border-bottom: 2px solid var(--border-color); color: var(--text-sub); font-size: 11px; text-transform: uppercase; font-weight: 800; background: rgba(255, 255, 255, 0.3); letter-spacing: 0.5px; white-space: nowrap; position: sticky; top: 0; z-index: 10; }
[data-theme="dark"] .table-modern th { background: rgba(0, 0, 0, 0.2) !important; color: var(--text-sub) !important; }
.table-modern td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); vertical-align: middle !important; font-size: 14px; transition: 0.2s; color: var(--text-main) !important; white-space: normal !important; word-wrap: break-word !important; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tr:hover td { background-color: rgba(255, 255, 255, 0.4); }
[data-theme="dark"] .table-modern tr:hover td { background-color: rgba(0, 0, 0, 0.3); }
[data-theme="dark"] .table-wrapper { border-color: rgba(255,255,255,0.1) !important; }
[data-theme="dark"] .table-modern td { border-bottom: 1px solid rgba(255,255,255,0.05) !important; }

/* Chiều rộng cột */
.w-date { width: 130px !important; }
.w-name { width: 180px !important; }
.w-type { width: 100px !important; text-align: center !important; }
.w-money { width: 140px !important; text-align: right !important; }
.w-note { width: auto !important; } 
.w-action { width: 70px !important; text-align: center !important; }

/* Menu bên trái */
.logo { font-family: 'Outfit'; font-weight: 900; font-size: 24px; background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-align: center; margin-bottom: 30px; text-transform: uppercase; }
.menu-item { padding: 12px 15px; margin-bottom: 5px; border-radius: 12px; cursor: pointer; color: var(--text-sub); font-weight: 600; display: flex; gap: 15px; align-items: center; font-size: 15px; transition: 0.2s; flex-shrink: 0; }
.menu-item i { color: var(--primary); font-size: 18px; }
.menu-item:hover { background: rgba(255, 255, 255, 0.6); color: var(--primary); }
[data-theme="dark"] .menu-item:hover { background: rgba(0,0,0,0.3); }
.menu-item.active { background: var(--primary-gradient); color: white; box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
.menu-item.active i { color: white; }
.menu-item.hidden { display: none !important; }

/* =========================================================
   UI BÁN HÀNG (POS MENU 3D)
   ========================================================= */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px; padding: 10px; }

.product-card { 
    background: rgba(255, 255, 255, 0.45); border: 1px solid var(--border-color); border-radius: 24px; padding: 18px 12px; 
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    box-shadow: 0 5px 0 rgba(200, 205, 215, 0.5), 0 10px 15px rgba(0,0,0,0.05), inset 0 3px 6px rgba(255,255,255,0.8); 
    border-top: 1px solid rgba(255,255,255,0.9); border-left: 1px solid rgba(255,255,255,0.7);
    position: relative; height: 160px;
}
[data-theme="dark"] .product-card { 
    background: rgba(30, 41, 59, 0.6); border-color: rgba(255,255,255,0.1);
    box-shadow: 0 5px 0 #0f172a, 0 10px 15px rgba(0,0,0,0.4), inset 0 2px 5px rgba(255,255,255,0.1); 
    border-top: 1px solid rgba(255,255,255,0.15); border-left: 1px solid rgba(255,255,255,0.1); 
}

.product-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 8px 0 rgba(200, 205, 215, 0.5), 0 15px 25px rgba(0,0,0,0.1), inset 0 3px 6px rgba(255,255,255,0.9); 
}
[data-theme="dark"] .product-card:hover { box-shadow: 0 8px 0 #0f172a, 0 15px 25px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.2); }

.product-card:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 rgba(200, 205, 215, 0.5), 0 2px 5px rgba(0,0,0,0.05);
}
[data-theme="dark"] .product-card:active { box-shadow: 0 0 0 #0f172a, 0 2px 5px rgba(0,0,0,0.3); }

.p-icon-wrapper { 
    width: 60px; height: 60px; background: rgba(255, 255, 255, 0.5); border-radius: 20px; 
    display: flex; justify-content: center; align-items: center; font-size: 30px; 
    margin-bottom: 12px; transition: 0.3s; box-shadow: var(--shadow-inset-deep);
    border: 1px solid var(--border-color);
}
[data-theme="dark"] .p-icon-wrapper { background: rgba(0, 0, 0, 0.2); }
.product-card:hover .p-icon-wrapper { transform: scale(1.1); box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); color: var(--primary); }

.product-card .p-name { 
    font-weight: 800; font-size: 13px; color: var(--text-main); text-align: center; 
    line-height: 1.3; margin-bottom: 10px; height: 34px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
    text-transform: uppercase; letter-spacing: 0.5px;
}

.product-card .p-price { 
    background: rgba(255, 255, 255, 0.7); color: var(--primary); padding: 5px 12px; border-radius: 12px; 
    font-size: 13px; font-weight: 900; width: 90%; text-align: center; border: 1px solid var(--border-color);
    box-shadow: var(--shadow-inset-deep); font-style: italic; letter-spacing: -0.5px;
}
[data-theme="dark"] .product-card .p-price { background: rgba(0, 0, 0, 0.3); color: var(--primary); }

.fund-box { background: var(--brand-gradient); color: white; padding: 25px; border-radius: 24px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4), inset 0 2px 0 rgba(255,255,255,0.2); position: relative; overflow: hidden; }
.fund-box::after { content: ''; position: absolute; right: -20px; top: -50px; width: 150px; height: 150px; background: rgba(255,255,255,0.1); border-radius: 50%; transform: rotate(-45deg); display: block; }

/* =========================================================
   THẺ TAB NHỎ TRONG BÁN HÀNG & BILL
   ========================================================= */
.pos-tabs, .bill-tabs { display: flex; gap: 12px; margin-bottom: 20px; padding-bottom: 10px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; max-width: 100%; }
.pos-tab-btn, .bill-tab-btn { 
    padding: 10px 20px; border: 1px solid var(--border-color); background: rgba(255,255,255,0.5); 
    border-radius: 14px; font-weight: 800; color: var(--text-main); cursor: pointer; transition: 0.3s; 
    display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); text-transform: uppercase; font-size: 13px; letter-spacing: 0.5px; 
}
[data-theme="dark"] .pos-tab-btn, [data-theme="dark"] .bill-tab-btn { background: rgba(0,0,0,0.2); }
.pos-tab-btn:hover, .bill-tab-btn:hover { color: var(--primary); transform: translateY(-2px); }
.pos-tab-btn:active, .bill-tab-btn:active { box-shadow: var(--shadow-inset-deep); transform: translateY(1px); }
.pos-tab-btn.active, .bill-tab-btn.active { 
    background: var(--primary-gradient); color: white; border: none; 
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.4); text-shadow: 0 1px 2px rgba(0,0,0,0.2); 
}
.pos-badge { background: #ef4444; color: white; font-size: 9px; padding: 1px 5px; border-radius: 10px; margin-left: 2px; display: none; }

/* =========================================================
   LỊCH THU TIỀN VÀ SỔ NỢ (STICKY NOTES)
   ========================================================= */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-cell { position: relative; min-height: 80px; background: rgba(255,255,255,0.4); border: 1px solid var(--border-color); border-radius: 12px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; transition: 0.2s; backdrop-filter: blur(5px); }
[data-theme="dark"] .day-cell { background: rgba(0,0,0,0.2); }
.day-cell:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.day-cell.locked { border-color: #10b981; background: rgba(16, 185, 129, 0.15); }
.day-cell.withdrawn { opacity: 0.8; background: rgba(100, 116, 139, 0.1); }

/* Sticky Notes (Sổ nợ) */
.sticky-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; padding: 10px; }
.sticky-note { position: relative; background: #fef08a; padding: 20px 10px 10px 10px; min-height: 180px; box-shadow: 2px 4px 8px rgba(0,0,0,0.15); font-family: 'Patrick Hand', cursive; color: #422006; display: flex; flex-direction: column; justify-content: space-between; transform: rotate(-1deg); transition: transform 0.2s; border-radius: 2px; }
.sticky-note:nth-child(2n) { background: #dcfce7; transform: rotate(1deg); } 
.sticky-note:nth-child(3n) { background: #fce7f3; transform: rotate(-2deg); } 
.sticky-note:nth-child(5n) { background: #e0f2fe; transform: rotate(1deg); } 
.sticky-note:hover { transform: scale(1.02) rotate(0deg); z-index: 10; box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.tape-section { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 40%; height: 25px; background: rgba(255, 255, 255, 0.3); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.note-header { font-size: 18px; font-weight: 900; text-transform: uppercase; text-align: center; border-bottom: 2px dashed rgba(0,0,0,0.1); padding-bottom: 5px; margin-bottom: 5px; margin-top: 10px; }
.note-body { font-size: 14px; line-height: 1.3; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; margin-bottom: 5px; opacity: 0.9; }
.note-money { font-size: 24px; font-weight: 900; color: #dc2626; text-align: center; margin: 5px 0; letter-spacing: -1px; }
.note-date { font-size: 10px; text-align: right; opacity: 0.6; margin-bottom: 10px; font-family: sans-serif; }
.note-actions { display: flex; gap: 5px; justify-content: center; }
.note-btn { border: none; background: rgba(255,255,255,0.5); padding: 5px 10px; border-radius: 20px; cursor: pointer; font-weight: bold; font-size: 12px; color: #333; transition: 0.2s; }
.note-btn:hover { background: white; }
.note-btn.pay { color: #16a34a; }
.note-btn.del { color: #ef4444; }

/* Dashboard Thống kê */
.wallet-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }
.wallet-card { background: rgba(255, 255, 255, 0.45); border-radius: 16px; box-shadow: var(--shadow-3d); padding: 20px; border: 1px solid var(--border-color); transition: 0.2s; backdrop-filter: blur(10px); }
[data-theme="dark"] .wallet-card { background: rgba(30, 41, 59, 0.6); }
.wallet-card.deposit { border-top: 4px solid #16a34a; }
.wallet-card.withdraw { border-top: 4px solid #ef4444; }
.wallet-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.wallet-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed var(--border-color); }
.wallet-header h3 { margin: 0; font-size: 16px; text-transform: uppercase; letter-spacing: 0.5px; }

/* =========================================================
   GIAO DIỆN BILL & FORM
   ========================================================= */
.bill-wrapper { background-color: var(--bg-card); color: var(--text-main); padding: 30px; border-radius: 28px; box-shadow: var(--shadow-3d); max-width: 900px; margin: 0 auto; border: 1px solid var(--border-color); transition: 0.3s; backdrop-filter: blur(16px); }
.bill-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px double var(--brand-green); padding-bottom: 20px; margin-bottom: 30px; flex-wrap: wrap; gap: 10px; }
.bill-brand h1 { margin: 0; color: var(--brand-green); font-size: 24px; font-weight: 800; text-transform: uppercase; }
.bill-brand p { margin: 5px 0 0; color: var(--text-sub); font-size: 13px; font-weight: 500; }
.bill-title { font-size: 32px; font-weight: 900; color: var(--border-color); text-transform: uppercase; letter-spacing: 5px; opacity: 0.5; }
.bill-info-box { background: rgba(255,255,255,0.3); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; margin-bottom: 30px; display: flex; flex-direction: column; gap: 15px; }
[data-theme="dark"] .bill-info-box { background: rgba(0,0,0,0.2); }
.bill-input-group { display: flex; gap: 20px; flex-wrap: wrap; }
.bill-input { border: none; border-bottom: 2px solid var(--border-color); background: transparent; padding: 5px 0; font-weight: 700; color: var(--text-main); outline: none; width: 100%; transition: 0.3s; }
.bill-input:focus { border-bottom-color: var(--brand-green); }
.bill-label { font-size: 11px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; margin-bottom: 5px; display: block; }
.bill-table-container { width: 100%; overflow-x: auto; padding-bottom: 10px; }
.bill-table { width: 100%; min-width: 700px; border-collapse: separate; border-spacing: 0 8px; }
.bill-table th { background: var(--brand-green); color: white; padding: 12px; font-size: 12px; text-transform: uppercase; font-weight: 800; letter-spacing: 0.5px; border: none; white-space: nowrap; }
.bill-table th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.bill-table th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.cell-input { width: 100%; padding: 8px 5px; border: 1px solid var(--border-color); border-radius: 6px; font-weight: 600; text-align: center; outline: none; background: rgba(255,255,255,0.5); color: var(--text-main); transition: 0.2s; font-size: 13px; box-shadow: var(--shadow-inset-deep); }
[data-theme="dark"] .cell-input { background: rgba(0,0,0,0.3); }
.cell-input:focus { border-color: var(--brand-green); box-shadow: var(--shadow-inset-deep), 0 0 0 3px rgba(5, 150, 105, 0.2); }
.cell-input.left { text-align: left; padding-left: 10px; }
.bill-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 20px; border-top: 2px dashed var(--border-color); flex-wrap: wrap; gap: 20px; }
.bill-total-label { font-size: 16px; font-weight: 800; color: var(--text-sub); text-transform: uppercase; letter-spacing: 2px; }
.bill-total-amount { font-size: 42px; font-weight: 900; color: var(--brand-green); font-style: italic; text-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); letter-spacing: -1px; }
.bill-content { display: none; } 
.bill-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Nút Cộng Trừ Số lượng (QTY BUTTONS 3D) */
.qty-group { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.3); padding: 4px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: var(--shadow-inset-deep); }
[data-theme="dark"] .qty-group { background: rgba(0,0,0,0.2); }
.btn-qty { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 10px; cursor: pointer; font-weight: 900; font-size: 18px; color: var(--text-main); transition: 0.2s; user-select: none; background: rgba(255,255,255,0.7); box-shadow: 0 4px 0 rgba(200, 205, 215, 0.5), 0 5px 10px rgba(0, 0, 0, 0.05); }
[data-theme="dark"] .btn-qty { background: rgba(30, 41, 59, 0.8); box-shadow: 0 4px 0 #0f172a, 0 5px 10px rgba(0, 0, 0, 0.3); }
.btn-minus { color: #ef4444; } 
.btn-plus { color: #10b981; } 
.btn-qty:active { transform: translateY(4px); box-shadow: 0 0 0 rgba(200, 205, 215, 0.5); } 
[data-theme="dark"] .btn-qty:active { box-shadow: 0 0 0 #0f172a; }
.qty-input-box { width: 45px !important; text-align: center; font-weight: 900; border: none !important; background: transparent !important; font-size: 16px; padding: 0 !important; margin: 0 !important; font-style: italic; color: var(--primary) !important; text-shadow: 0 1px 1px rgba(0,0,0,0.1); box-shadow: none !important; }
.btn-trash { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: #ef4444; background: rgba(255,255,255,0.7); border-radius: 10px; margin-left: 10px; cursor: pointer; box-shadow: 0 4px 0 rgba(200, 205, 215, 0.5); transition: 0.2s; border: none; }
[data-theme="dark"] .btn-trash { background: rgba(30, 41, 59, 0.8); box-shadow: 0 4px 0 #0f172a; }
.btn-trash:active { transform: translateY(4px); box-shadow: 0 0 0 transparent; }

/* Filter & Layout Items */
.setup-grid { display: flex; flex-direction: column; gap: 15px; }
.setup-item { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.4); padding: 10px; border-radius: 12px; border: 1px solid var(--border-color); }
[data-theme="dark"] .setup-item { background: rgba(0,0,0,0.2); }
.setup-label { font-size: 12px; font-weight: 700; width: 60px; color: var(--text-sub); }
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; align-items: center; flex-wrap: wrap; overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-width: 100%; }
.split-input { display: flex; gap: 12px; }

/* Các thành phần hệ thống khác */
.toast { position: fixed; top: 20px; right: 20px; background: var(--bg-card); padding: 15px 25px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); border-left: 5px solid #10b981; animation: slideIn 0.3s; z-index: 10000; font-weight: 700; border: 1px solid var(--border-color); backdrop-filter: blur(10px); }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.sortable-ghost { opacity: 0.4; border: 2px dashed var(--primary); background: rgba(16, 185, 129, 0.1); }
#mem-pagination, #log-pagination { background: rgba(255,255,255,0.4); padding: 4px; border-radius: 12px; border: 1px solid var(--border-color); backdrop-filter: blur(5px); }
[data-theme="dark"] #mem-pagination, [data-theme="dark"] #log-pagination { background: rgba(0,0,0,0.2); }
#tab-wallet .table-modern tr:hover td, #tab-bill .table-modern tr:hover td, #tab-reports .table-modern tr:hover td { background-color: transparent !important; }
.calendar-header .btn { background: var(--primary-gradient) !important; color: white !important; border: none !important; box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3); }

/* Capture Mode (Trắng Đen cho Ảnh Chụp) */
.capture-mode { background-color: #ffffff !important; background-image: none !important; color: #000000 !important; box-shadow: none !important; border: 1px solid #000 !important; color-scheme: light !important; }
.capture-mode input, .capture-mode select { color: #000000 !important; font-weight: 800 !important; background-color: #ffffff !important; text-shadow: 0 0 0 #000; border: none !important; border-bottom: 1px dashed #ccc !important; -webkit-text-fill-color: #000000 !important; }
.capture-mode .amount-cell { color: #000000 !important; font-weight: 900 !important; }
.capture-mode ::placeholder { color: transparent !important; }
.capture-mode input[type="date"]::-webkit-calendar-picker-indicator, .capture-mode select { filter: invert(0); }

/* Chỉnh Lịch (Calendar Picker Icon) */
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; transition: 0.2s; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; transform: scale(1.1); }
[data-theme="dark"] input::-webkit-calendar-picker-indicator { filter: invert(1) brightness(0.9); }
#filter-date-picker, input[type="date"] { position: relative; z-index: 9999; }

/* Trả lại thanh cuộn dọc cho báo cáo */
#tab-reports { overflow-y: auto !important; }

/* Nút Float Action Button (Mobile) */
#fab-cart { display: none; position: fixed; bottom: 80px; right: 20px; width: 55px; height: 55px; background: var(--primary-gradient); color: white; border-radius: 50%; box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4); justify-content: center; align-items: center; font-size: 22px; z-index: 1500; }

/* =========================================================
   📱 TỐI ƯU HÓA GIAO DIỆN MOBILE & TABLET (RESPONSIVE)
   ========================================================= */

/* 1. Thanh cuộn tàng hình (Vuốt mượt như App) */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.5); border-radius: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Khai báo Mobile Header */
.mobile-header { display: none; padding: 10px 15px; justify-content: space-between; align-items: center; background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); position: fixed; top: 0; left: 0; right: 0; z-index: 2000; height: 60px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
[data-theme="dark"] .mobile-header { background: rgba(30, 41, 59, 0.6); }
.theme-toggle { cursor: pointer; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.5); border: 1px solid var(--border-color); backdrop-filter: blur(5px); }
[data-theme="dark"] .theme-toggle { background: rgba(0, 0, 0, 0.3); }
.menu-toggle-btn { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; font-size: 20px; color: var(--text-main); cursor: pointer; }
.sidebar-close-btn { display: none; position: absolute; top: 15px; right: 15px; width: 30px; height: 30px; background: rgba(255,255,255,0.5); border-radius: 50%; align-items: center; justify-content: center; color: var(--text-sub); cursor: pointer; border: 1px solid var(--border-color); }
[data-theme="dark"] .sidebar-close-btn { background: rgba(0,0,0,0.3); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 4900; opacity: 0; visibility: hidden; transition: 0.3s; backdrop-filter: blur(3px); }
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* 2. TABLET & IPAD (Dưới 1024px) */
@media (max-width: 1024px) {
    .mobile-header { display: flex !important; }
    .menu-toggle-btn { display: flex; }
    .sidebar-overlay { display: block; }
    
    .sidebar { 
        position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 280px; 
        transform: translateX(-100%); border-right: none; 
        box-shadow: 5px 0 25px rgba(0,0,0,0.15); z-index: 5000; 
        overflow-y: auto !important; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 80px !important;
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar-close-btn { display: flex !important; }
    
    .main { padding: 75px 15px 20px 15px !important; }
    
    .bill-panel { 
        position: fixed !important; inset: 0 !important; top: auto !important;
        height: 85vh !important; width: 100% !important; 
        transform: translateY(110%); z-index: 5000;
        border-radius: 28px 28px 0 0 !important; 
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    } 
    .bill-panel.show { transform: translateY(0) !important; } 
    
    #fab-cart { display: flex !important; bottom: 25px; right: 20px; width: 65px; height: 65px; font-size: 24px; z-index: 4000; } 
    
    .pos-grid { grid-template-columns: repeat(2, 1fr) !important; } 
    .bill-wrapper { padding: 15px; border:none; box-shadow:none; }
    .bill-header { flex-direction:column; align-items:center; text-align:center; }
    .wallet-grid { grid-template-columns: 1fr !important; }
    
    /* Chống bóp méo bảng */
    .table-modern, .table-modern tbody, .table-modern tr, .table-modern td, .table-modern th, .table-modern thead { display: table !important; width: 100% !important; }
    .table-modern tr { display: table-row !important; margin-bottom: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
    .table-modern td { display: table-cell !important; text-align: left; padding: 10px !important; border-bottom: 1px solid var(--border-color) !important; }
    .table-modern thead { display: table-header-group !important; } 
}

/* 3. ĐIỆN THOẠI (Dưới 768px) */
@media (max-width: 768px) {
    /* Chống Zoom Input trên iOS */
    input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], select { font-size: 16px !important; }
    
    /* Tối ưu kích thước POS Grid */
    .pos-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .product-card { height: auto !important; min-height: 135px; padding: 12px 8px !important; border-radius: 20px !important; }
    .p-icon-wrapper { width: 45px !important; height: 45px !important; font-size: 22px !important; margin-bottom: 8px !important; }
    .product-card .p-name { font-size: 12px !important; height: 32px !important; margin-bottom: 5px !important; }
    .product-card .p-price { font-size: 12px !important; padding: 4px 8px !important; width: 95% !important; }
    
    /* Vuốt Tab mượt mà */
    .pos-tabs, .bill-tabs { padding-bottom: 8px; }
    .pos-tab-btn, .bill-tab-btn { padding: 8px 12px !important; font-size: 13px !important; border-radius: 12px; }
    
    /* Calendar gọn gàng */
    .calendar-grid { gap: 6px !important; margin-bottom: 10px !important; }
    .day-name { font-size: 11px; padding: 5px 0; background: transparent; border: none; text-align: center; font-weight: 800; color: var(--text-sub); }
    .day-cell { min-height: 70px !important; padding: 6px !important; border-radius: 10px !important; }
    .day-cell span { font-size: 12px !important; }
    .day-cell div { font-size: 9px !important; font-weight: 700 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; letter-spacing: -0.5px; }
    .calendar-header h3 { font-size: 16px !important; }
    .calendar-header .btn { padding: 5px 10px !important; }
    
    /* Sổ Nợ 2 cột */
    .sticky-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .sticky-note { min-height: 150px !important; padding: 12px 8px 8px 8px !important; }
    .note-header { font-size: 14px !important; margin-top: 5px !important; }
    .note-money { font-size: 16px !important; }
    .note-btn { padding: 4px 8px !important; font-size: 11px !important; }
    
    /* Bottom Sheet Modals */
    #edit-order-modal, #collection-modal, #edit-debt-modal, #quick-debt-modal, #inv-trans-modal, #edit-inv-modal, #split-inv-modal {
        align-items: flex-end !important; padding: 0 !important;
    }
    #edit-order-modal .card, #collection-modal .card, #edit-debt-modal .card, #quick-debt-modal .card, #inv-trans-modal .card, #edit-inv-modal .card, #split-inv-modal .card {
        width: 100% !important; max-width: 100% !important;
        border-radius: 28px 28px 0 0 !important; margin: 0 !important;
        max-height: 85vh !important; overflow-y: auto !important;
        -webkit-overflow-scrolling: touch; padding-bottom: 40px !important;
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    
    /* Bộ lọc Form (Full width trên mobile) */
    .filter-bar { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; overflow: visible !important; }
    .filter-bar select, .filter-bar input, .split-input { width: 100% !important; }
    .filter-bar > *, .filter-bar .input-box, .filter-bar .btn { flex-shrink: 0; width: auto !important; margin-bottom: 0 !important; white-space: nowrap; }
    
    /* Nút trang to ra */
    #mem-pagination .btn, #log-pagination .btn { padding: 8px 15px !important; }

    /* Dashboard Thống Kê (Vuốt Ngang) */
    .wallet-container { grid-template-columns: 1fr; gap: 15px; }
    .wallet-grid {
        display: flex !important; flex-direction: row !important;
        overflow-x: auto !important; flex-wrap: nowrap !important;
        gap: 12px !important; padding-bottom: 10px;
        -webkit-overflow-scrolling: touch; 
    }
    .wallet-grid .card { min-width: 220px; flex-shrink: 0; margin-bottom: 0 !important; }
    
    /* Fix khung báo cáo bị bóp nghet */
    #report-card-container { flex: 1 1 auto !important; min-height: 60vh !important; max-height: none !important; overflow: visible !important; }
}

/* 4. MÀN HÌNH LAPTOP TRỞ LÊN (Chống ẩn mảng nút Excel) */
@media (min-width: 769px) {
    .filter-bar { flex-wrap: wrap !important; overflow: visible !important; }
    .wallet-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; overflow: visible !important; }
}