/* ===================================================
   CocoMeo FnB POS Stylesheet - Deep Green Theme (Xanh Lá Đậm)
   With Large Readable Typography & Product Photos
   =================================================== */

:root {
    /* Deep Forest Green Palette */
    --kv-green-header: #14532d;   /* Deep Forest Green Header */
    --kv-green-dark: #166534;     /* Green 800 */
    --kv-green: #15803d;          /* Green 700 (Primary Action & Accent) */
    --kv-green-hover: #16a34a;    /* Green 600 */
    --kv-green-light: #dcfce7;    /* Green 100 */
    --kv-green-tint: #f0fdf4;     /* Green 50 */
    
    --kv-bg: #f3f5f8;
    --kv-white: #ffffff;
    --kv-border: #cbd5e1;
    --kv-border-light: #e2e8f0;
    
    --kv-text: #0f172a;
    --kv-text-sub: #475569;
    --kv-text-dim: #94a3b8;
    
    --kv-red: #ef4444;
    --kv-orange: #ea580c;
    --kv-amber: #d97706;
    
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 24px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
    background-color: var(--kv-bg);
    color: var(--kv-text);
    font-size: 15px; /* Bumped up font size */
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

/* ================= 1. TOP HEADER (DEEP GREEN) ================= */
.app-header {
    background-color: var(--kv-green-header);
    color: #ffffff;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-title span {
    font-weight: 600;
    font-size: 0.88rem;
    background: rgba(255, 255, 255, 0.22);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: #fef08a;
}

/* Branch Dropdown */
.branch-select-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.18);
    padding: 5px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.branch-select-container i {
    font-size: 0.95rem;
    color: #fef08a;
}

.branch-select {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
}

.branch-select option {
    color: #0f172a;
    background: #ffffff;
}

/* Nav Tabs in Header */
.system-nav {
    display: flex;
    gap: 8px;
}

.sys-tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sys-tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.sys-tab-btn.active {
    background: #ffffff;
    color: var(--kv-green-dark);
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.clock-badge {
    font-family: monospace;
    font-size: 0.98rem;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: #fef08a;
}

.cashier-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
}

/* ================= 2. MAIN WORKSPACE ================= */
.main-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
}

.tab-pane {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

.pos-workspace {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ================= 3. LEFT PANEL (61%): PHÒNG BÀN & THỰC ĐƠN ================= */
.pos-left-panel {
    width: 65.5%;
    height: 100%;
    background: #ffffff;
    border-right: 2px solid var(--kv-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Sub-Header: [Phòng bàn] [Thực đơn] & Tìm món F3 */
.pos-sub-header {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid var(--kv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    gap: 14px;
    flex-shrink: 0;
}

.left-toggle-buttons {
    display: flex;
    gap: 8px;
}

.btn-sub-toggle {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    color: var(--kv-text-sub);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-sub-toggle:hover {
    border-color: var(--kv-green);
    color: var(--kv-green);
}

.btn-sub-toggle.active {
    background: var(--kv-green);
    border-color: var(--kv-green);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(21, 128, 61, 0.35);
}

/* Search Box F3 */
.search-box-f3 {
    flex: 1;
    max-width: 340px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box-f3 i.fa-magnifying-glass {
    position: absolute;
    left: 14px;
    color: var(--kv-text-dim);
    font-size: 0.95rem;
}

.search-box-f3 input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    color: var(--kv-text);
    padding: 8px 36px 8px 38px;
    border-radius: var(--radius-pill);
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s;
}

.search-box-f3 input:focus {
    background: #ffffff;
    border-color: var(--kv-green);
    box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.2);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--kv-text-dim);
    cursor: pointer;
}

.pos-view-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ================= 4. VIEW PHÒNG BÀN (TABLES MATRIX) ================= */
.filter-bar-tables {
    padding: 10px 14px;
    background: var(--kv-green-tint);
    border-bottom: 1px solid var(--kv-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.area-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.area-pill {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    color: var(--kv-text);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.area-pill:hover {
    border-color: var(--kv-green);
}

.area-pill.active {
    background: var(--kv-green);
    color: #ffffff;
    border-color: var(--kv-green);
}

.status-radio-group {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--kv-text-sub);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.tables-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #ffffff;
}

.tables-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 18px 14px;
    align-content: start;
}

/* KIOTVIET ICONIC TABLE CARD WITH CHAIRS */
.kv-table-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.15s ease;
    user-select: none;
}

.kv-table-card:hover {
    transform: translateY(-2px);
}

.table-shape {
    width: 90px;
    height: 58px;
    border: 2px solid #94a3b8;
    border-radius: 16px;
    background: #ffffff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Chairs notches */
.table-shape::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 22px;
    right: 22px;
    height: 4px;
    background: #94a3b8;
    border-radius: 2px;
}
.table-shape::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 22px;
    right: 22px;
    height: 4px;
    background: #94a3b8;
    border-radius: 2px;
}

.table-name-label {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--kv-text);
    margin-top: 8px;
    text-align: center;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Selected Table (Deep Green) */
.kv-table-card.selected .table-shape {
    background: var(--kv-green) !important;
    border-color: var(--kv-green) !important;
    box-shadow: 0 4px 10px rgba(21, 128, 61, 0.4);
}
.kv-table-card.selected .table-shape::before,
.kv-table-card.selected .table-shape::after {
    background: var(--kv-green) !important;
}
.kv-table-card.selected .table-shape .inner-badge {
    color: #ffffff !important;
}
.kv-table-card.selected .table-name-label {
    color: var(--kv-green-dark);
    font-weight: 900;
}

/* Occupied Table */
.kv-table-card.status-occupied .table-shape {
    border-color: #f97316;
    background: #fff7ed;
}
.kv-table-card.status-occupied .table-shape::before,
.kv-table-card.status-occupied .table-shape::after {
    background: #f97316;
}
.kv-table-card.status-occupied .inner-amount {
    font-size: 0.8rem;
    font-weight: 800;
    color: #ea580c;
}

/* Footer Phòng bàn */
.phong-ban-footer {
    height: 42px;
    background: #f8fafc;
    border-top: 1px solid var(--kv-border);
    display: flex;
    align-items: center;
    padding: 0 18px;
    font-size: 0.88rem;
    color: var(--kv-text-sub);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
}

/* ================= 5. VIEW THỰC ĐƠN & NHÓM HÀNG 2 DÒNG ================= */
.category-tabs-bar {
    background: #ffffff;
    border-bottom: 2px solid var(--kv-border);
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 64px;
    max-height: 70px;
    overflow: hidden;
    flex-shrink: 0;
}

.cat-tabs-row {
    display: flex;
    gap: 4px;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cat-tabs-row::-webkit-scrollbar {
    display: none;
}

.cat-tab-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 2px 4px;
    border-radius: 6px;
    font-size: 0.70rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    height: 27px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    letter-spacing: -0.3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.cat-tab-btn:hover {
    border-color: #15803d;
    color: #15803d;
    background: #f0fdf4;
}

.cat-tab-btn.active {
    background: #14532d !important;
    color: #ffffff !important;
    border-color: #14532d !important;
    box-shadow: 0 2px 4px rgba(20, 83, 45, 0.3) !important;
}

.products-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
}

.products-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 12px;
    align-content: start;
}

/* PRODUCT CARD WITH REAL IMAGES */
.kv-product-card {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.kv-product-card:hover {
    border-color: var(--kv-green);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.12);
}

.kv-product-card:active {
    transform: scale(0.97);
}

.prod-preview-box {
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.prod-preview-box.has-image {
    background-color: #f1f5f9;
}

.prod-preview-text {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.1;
    text-transform: uppercase;
}

.prod-qty-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--kv-red);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.prod-details-box {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 56px;
    background: #ffffff;
    border-top: 1px solid var(--kv-border-light);
}

.prod-price {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--kv-green);
    text-align: center;
}

.prod-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--kv-text);
    text-align: center;
    margin-top: 3px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Footer Thực đơn */
.thuc-don-footer {
    height: 44px;
    background: #ffffff;
    border-top: 1px solid var(--kv-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    flex-shrink: 0;
}

.btn-back-tables {
    background: var(--kv-green-tint);
    border: 1px solid var(--kv-green);
    color: var(--kv-green-dark);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}
.btn-back-tables:hover {
    background: var(--kv-green-light);
}

.menu-pager {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--kv-text-sub);
}

.btn-pager {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================= 6. RIGHT PANEL (39%): PHẦN TÍNH RA TIỀN HÀNG ================= */
.pos-right-panel {
    width: 34.5%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Cart Top Bar */
.cart-top-bar {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid var(--kv-border);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    flex-shrink: 0;
}

.active-table-pill {
    background: var(--kv-green-tint);
    border: 1px solid var(--kv-green);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--kv-green-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.table-status-icon {
    font-size: 0.75rem;
    color: var(--kv-green);
}

.customer-search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.customer-search-box i.fa-magnifying-glass {
    position: absolute;
    left: 12px;
    color: var(--kv-text-dim);
    font-size: 0.85rem;
}

.customer-search-box input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    padding: 6px 32px 6px 34px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
}

.btn-add-customer {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--kv-green);
    font-size: 0.95rem;
    cursor: pointer;
}

.price-mode-badge {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--kv-text-sub);
    white-space: nowrap;
    background: #f8fafc;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--kv-border-light);
}

/* Cart Body Area */
.cart-body-area {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
    position: relative;
}

/* Empty State */
.empty-cart-kv {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    color: #94a3b8;
}

.empty-icon-box {
    width: 68px;
    height: 68px;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--kv-green);
    margin-bottom: 14px;
    background: var(--kv-green-tint);
}

.empty-cart-kv h4 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--kv-text);
    margin-bottom: 4px;
}

.empty-cart-kv p {
    font-size: 0.88rem;
    color: var(--kv-text-sub);
}

/* Cart Items Table */
.cart-items-table-container {
    width: 100%;
}

.cart-items-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-items-table th {
    background: #f8fafc;
    color: var(--kv-text-sub);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid var(--kv-border);
}

.cart-item-row td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--kv-border-light);
    vertical-align: middle;
    font-size: 0.88rem;
}

.item-info-col .item-title {
    font-weight: 700;
    color: var(--kv-text);
    line-height: 1.25;
}
.item-info-col .item-code {
    font-size: 0.75rem;
    color: var(--kv-text-dim);
}

.qty-control-kv {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-qty-kv {
    background: #f1f5f9;
    border: 1px solid var(--kv-border);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
}

.qty-val-kv {
    width: 26px;
    text-align: center;
    font-weight: 800;
    font-size: 0.95rem;
}

.item-price-col {
    color: var(--kv-text-sub);
    font-size: 0.88rem;
}

.item-total-col {
    font-weight: 800;
    color: var(--kv-green);
    font-size: 0.95rem;
}

.btn-del-item {
    background: transparent;
    border: none;
    color: var(--kv-red);
    cursor: pointer;
    font-size: 0.95rem;
    opacity: 0.75;
}
.btn-del-item:hover {
    opacity: 1;
}

/* Cart Bottom Area */
.cart-bottom-area {
    background: #ffffff;
    border-top: 1px solid var(--kv-border);
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    gap: 10px;
    flex-shrink: 0;
}

.cart-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
}

.cashier-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: var(--kv-green-dark);
}

.meta-tools {
    display: flex;
    gap: 8px;
}

.btn-meta-tool {
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    color: var(--kv-text);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.expandable-row {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--kv-border);
}

.expandable-row input {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
}

/* Financial Summary */
.cart-financial-summary {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px dashed var(--kv-border);
    padding-top: 8px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: var(--kv-text-sub);
}

.summary-val {
    font-weight: 700;
    color: var(--kv-text);
}

.total-line {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--kv-text);
    margin-top: 4px;
}

.total-label {
    font-weight: 900;
    color: var(--kv-text);
}

.total-val {
    color: var(--kv-green);
    font-size: 1.55rem;
    font-weight: 900;
}

/* Cash Tendered & Change - Thu nhỏ & Gọn gàng theo yêu cầu */
.cash-tendered-box {
    background: var(--kv-green-tint);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-cash-chips {
    display: flex;
    gap: 4px;
}

.cash-chip {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    color: var(--kv-text);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}
.cash-chip:hover {
    border-color: var(--kv-green);
    color: var(--kv-green);
}

.tendered-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.t-col {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--kv-text-sub);
}

.t-col input {
    width: 95px;
    height: 28px;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    padding: 2px 6px;
    font-size: 0.88rem;
    font-weight: 800;
    text-align: right;
    border-radius: var(--radius-sm);
    outline: none;
}

.change-amount-display {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--kv-green-dark);
}

/* Cụm nút thao tác giỏ hàng & In ấn nhanh K80 (2 nút In Tạm Tính & 1 nút F9 To) */
.cart-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}

.btn-kv-action {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 38px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-kv-print-kitchen {
    background: #fff7ed;
    color: #c2410c;
    border: 1.5px solid #ea580c;
}
.btn-kv-print-kitchen:hover {
    background: #ffedd5;
    transform: translateY(-1px);
}

.btn-kv-print-customer {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1.5px solid #2563eb;
}
.btn-kv-print-customer:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}

.btn-kv-print-temp {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1.5px solid #2563eb;
}

.btn-kv-checkout {
    grid-column: 1 / -1;
    height: 50px;
    font-size: 1.15rem;
    font-weight: 900;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.45);
    letter-spacing: 0.6px;
    border-radius: 8px;
}
.btn-kv-checkout:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(21, 128, 61, 0.55);
}

/* ================= 7. MANAGEMENT & DASHBOARD STYLES ================= */
.dashboard-wrapper {
    padding: 24px 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.kpi-card {
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    box-shadow: var(--shadow-sm);
}

.gradient-emerald { border-left: 5px solid #15803d; }
.gradient-cyan { border-left: 5px solid #06b6d4; }
.gradient-amber { border-left: 5px solid #f59e0b; }
.gradient-purple { border-left: 5px solid #8b5cf6; }

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--kv-green-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--kv-green);
}

.kpi-details { flex: 1; }
.kpi-title { font-size: 0.82rem; color: var(--kv-text-sub); font-weight: 800; text-transform: uppercase; }
.kpi-value { font-size: 1.55rem; font-weight: 900; color: var(--kv-text); margin: 2px 0; }
.kpi-sub { font-size: 0.75rem; color: var(--kv-text-dim); }

.analytics-row { display: flex; gap: 20px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

.analytics-card {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--kv-border-light);
    padding-bottom: 10px;
}
.card-head h3 { font-size: 1.05rem; font-weight: 800; color: var(--kv-text); }
.card-desc { font-size: 0.8rem; color: var(--kv-text-sub); }

.revenue-share-body { display: flex; align-items: center; gap: 24px; }
.chart-container { width: 200px; height: 200px; position: relative; flex-shrink: 0; }
.chart-container-bar { height: 240px; width: 100%; position: relative; }

.share-breakdown-list { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.share-item { display: flex; flex-direction: column; gap: 5px; }
.share-item-head { display: flex; justify-content: space-between; font-size: 0.9rem; }
.share-branch-name { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.share-dot { width: 10px; height: 10px; border-radius: 50%; }
.share-percentage { font-weight: 900; }
.share-value { font-size: 0.82rem; color: var(--kv-text-sub); }

.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; }

.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { background: #f8fafc; padding: 12px 14px; font-weight: 800; color: var(--kv-text-sub); border-bottom: 2px solid var(--kv-border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--kv-border-light); color: var(--kv-text); }
.percent-badge { background: var(--kv-green-tint); color: var(--kv-green-dark); padding: 4px 10px; border-radius: 12px; font-weight: 800; font-size: 0.84rem; border: 1px solid #bbf7d0; }

.top-list { display: flex; flex-direction: column; gap: 10px; }
.top-cat-item { display: flex; justify-content: space-between; padding: 10px 14px; background: #f8fafc; border-radius: var(--radius-sm); border: 1px solid var(--kv-border-light); }
.top-cat-name { font-weight: 800; font-size: 0.88rem; }
.top-cat-badge { font-size: 0.8rem; background: #ffffff; color: var(--kv-green); padding: 3px 8px; border-radius: var(--radius-sm); border: 1px solid var(--kv-border); font-weight: 700; }

/* Invoices tab */
.invoices-wrapper, .sync-wrapper { padding: 24px 30px; max-width: 1300px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 16px; }
.invoices-filter-bar { display: flex; justify-content: space-between; align-items: center; background: #ffffff; padding: 14px 18px; border-radius: var(--radius-md); border: 1px solid var(--kv-border); }
.invoices-table-container { background: #ffffff; border-radius: var(--radius-md); border: 1px solid var(--kv-border); }
.btn-refresh { background: var(--kv-green); color: #fff; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 800; cursor: pointer; }

/* Sync Tab */
.sync-hero { text-align: center; padding: 16px; }
.sync-hero-icon { font-size: 3rem; color: var(--kv-green); margin-bottom: 10px; }
.sync-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.sync-store-card { background: #ffffff; border: 1px solid var(--kv-border); border-radius: var(--radius-md); padding: 18px; position: relative; }
.store-badge { position: absolute; top: 14px; right: 14px; background: var(--kv-green-tint); color: var(--kv-green-dark); font-size: 0.75rem; font-weight: 800; padding: 3px 8px; border-radius: 4px; border: 1px solid #bbf7d0; }
.btn-sync-single { margin-top: 14px; background: #f1f5f9; color: var(--kv-green-dark); border: 1px solid var(--kv-border); padding: 9px; width: 100%; border-radius: var(--radius-sm); font-weight: 800; cursor: pointer; }
.btn-sync-single:hover { background: var(--kv-green); color: #fff; }
.btn-sync-all { background: var(--kv-green); color: #fff; border: none; padding: 14px 32px; border-radius: var(--radius-md); font-weight: 900; font-size: 1rem; cursor: pointer; box-shadow: 0 4px 12px rgba(21, 128, 61, 0.35); }
.sync-status-log { margin-top: 16px; background: #0f172a; color: #4ade80; padding: 14px; border-radius: var(--radius-sm); font-family: monospace; font-size: 0.88rem; text-align: left; }

/* Modal & Receipt */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #ffffff; border-radius: var(--radius-md); width: 90%; max-width: 460px; box-shadow: 0 12px 30px rgba(0,0,0,0.25); overflow: hidden; display: flex; flex-direction: column; }
.product-modal-enhanced { max-width: 580px !important; width: 95%; }

/* Bảng tự động tính thuế VAT trong modal thêm hàng hóa */
.product-vat-preview-box {
    margin-top: 10px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.vat-badge-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 700;
}
.badge-rate {
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    border: 1px solid #bae6fd;
}
.vat-calc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
}
.vat-calc-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.vat-calc-item .v-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 600;
}
.vat-calc-item .v-val {
    font-size: 0.95rem;
    font-weight: 800;
}
.vat-calc-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

/* Bộ chọn và tải ảnh từ máy tính / điện thoại */
.image-uploader-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 10px;
}
.image-preview-slot {
    width: 88px;
    height: 88px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    transition: all 0.2s;
}
.image-preview-slot:hover {
    border-color: var(--kv-green);
    transform: scale(1.02);
}
.image-preview-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.preview-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.68rem;
    text-align: center;
    padding: 4px;
    gap: 4px;
}
.preview-empty-state i {
    font-size: 1.6rem;
    color: #94a3b8;
}
.image-uploader-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.btn-choose-file {
    background: #ffffff;
    border: 1.5px solid var(--kv-green);
    color: var(--kv-green-dark);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    transition: all 0.2s;
}
.btn-choose-file:hover {
    background: var(--kv-green-tint);
    border-color: var(--kv-green-dark);
}
.btn-refresh-code {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 6px;
    padding: 0 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-refresh-code:hover {
    background: #e2e8f0;
    color: var(--kv-green-dark);
}
.modal-header { padding: 14px 18px; background: #f8fafc; border-bottom: 1px solid var(--kv-border); display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.close-modal-btn { background: transparent; border: none; font-size: 1.2rem; color: #64748b; cursor: pointer; }
.modal-body { padding: 18px; max-height: 75vh; overflow-y: auto; }
.modal-actions { padding: 12px 18px; background: #f8fafc; border-top: 1px solid var(--kv-border); display: flex; justify-content: flex-end; gap: 10px; }
.btn-print { background: var(--kv-green); color: #fff; border: none; padding: 8px 18px; border-radius: var(--radius-sm); font-weight: 800; cursor: pointer; }
.btn-close { background: #e2e8f0; color: #334155; border: none; padding: 8px 16px; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; }

/* Printable Receipt Paper */
.receipt-paper {
    background: #fff;
    color: #111827;
    padding: 16px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.45;
}
.receipt-store-header { text-align: center; }
.receipt-main-title { font-size: 18px; font-weight: 900; margin: 0 0 2px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.receipt-slogan { font-size: 11px; font-style: italic; color: #475569; margin: 0 0 8px 0; }
.receipt-contact-info { font-size: 11.5px; margin: 6px 0; line-height: 1.4; text-align: center; }
.receipt-contact-info p { margin: 2px 0; }
.receipt-sale-date-row { font-size: 12px; margin: 6px 0 2px 0; font-weight: 600; text-align: center; }
.receipt-bill-heading { font-size: 16px; font-weight: 900; margin: 6px 0 2px 0; letter-spacing: 1px; }
.receipt-code-highlight { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.receipt-meta { font-size: 12px; margin: 6px 0; }
.receipt-meta-line { display: flex; justify-content: space-between; margin: 3px 0; }
.receipt-divider { text-align: center; margin: 6px 0; letter-spacing: -1px; color: #475569; font-weight: bold; }
.receipt-items-table { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 12px; }
.receipt-items-table th { border-bottom: 1px dashed #475569; padding: 4px 2px; font-weight: 700; }
.receipt-items-table td { padding: 4px 2px; }
.receipt-totals { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.receipt-total-row { display: flex; justify-content: space-between; }
.receipt-grand-total { font-size: 15px; font-weight: 900; border-top: 1px dashed #111827; border-bottom: 1px dashed #111827; padding: 5px 0; margin: 4px 0; }
.receipt-footer { text-align: center; margin-top: 10px; font-size: 11.5px; }

/* ================= PRINT STYLES (IN K80 THEO THỨ TỰ: CHẾ BIẾN TRƯỚC, THANH TOÁN SAU - CHUẨN IN NHIỆT SIÊU NÉT) ================= */
@media print {
    /* "80mm auto" is invalid CSS and was silently dropped, so the printer's default paper (A4 or a fixed
       roll length) was used and the rest of each page printed blank. Before printing, pos-checkout.js
       gives each bill a named page exactly as tall as its content; this size is only the fallback. */
    @page {
        size: 80mm 297mm;
        margin: 0;
    }
    .kitchen-bill-paper { page: kitchen-bill; }
    .customer-receipt-paper { page: customer-bill; }
    
    html, body {
        width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        position: static !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Ẩn toàn bộ giao diện app POS để cô lập modal in */
    body > *:not(#receiptModal) {
        display: none !important;
    }

    #receiptModal {
        position: static !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
        width: 80mm !important;
    }

    .modal-content.receipt-modal-box {
        position: static !important;
        display: block !important;
        max-width: none !important;
        width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }

    .modal-header,
    .receipt-success-banner,
    .screen-bill-separator,
    #receiptModalActions {
        display: none !important;
    }

    .modal-body {
        padding: 0 !important;
        margin: 0 !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
        width: 80mm !important;
    }

    #masterPrintContainer {
        position: static !important;
        display: block !important;
        width: 80mm !important;
        margin: 0 auto !important;
        padding: 0 !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Trang 1: Bill chế biến (In trước - Tự động cắt khi có món pha chế) */
    .kitchen-bill-paper {
        position: static !important;
        display: block !important;
        width: 72mm !important;
        max-width: 72mm !important;
        margin: 0 auto !important;
        padding: 2mm 0 !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        color: #000000 !important;
        border: none !important;
        box-shadow: none !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Trang 2: Bill thanh toán cho khách (In tiếp theo sau bill chế biến) */
    .customer-receipt-paper {
        position: static !important;
        display: block !important;
        width: 72mm !important;
        max-width: 72mm !important;
        margin: 0 auto !important;
        padding: 2mm 0 !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        color: #000000 !important;
        border: none !important;
        box-shadow: none !important;
        page-break-before: auto !important;
        break-before: auto !important;
        page-break-after: auto !important;
        break-after: auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .thermal-cut-feed {
        display: block !important;
        height: 22mm !important;
        width: 100% !important;
    }

    /* Chế độ chỉ in bill chế biến */
    body.print-mode-kitchen-only .customer-receipt-paper {
        display: none !important;
    }
    body.print-mode-kitchen-only .kitchen-bill-paper {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* Chế độ chỉ in bill thanh toán */
    body.print-mode-customer-only .kitchen-bill-paper {
        display: none !important;
    }
    body.print-mode-customer-only .customer-receipt-paper {
        page-break-before: auto !important;
        break-before: auto !important;
    }
}

/* SCREEN VIEW STYLES FOR DUAL BILLS MODAL */
.receipt-body-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    max-height: 75vh;
    overflow-y: auto;
    padding: 16px 12px;
    background: #cbd5e1;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* MẪU IN NHIỆT K80 ĐẬM ĐEN RÕ CHỮ, CHỮ TO RÕ NÉT CĂN GIỮA KHỔ 80MM */
.thermal-bill-paper {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: Arial, 'Segoe UI', Tahoma, sans-serif !important;
    font-size: 13.5px;
    line-height: 1.4;
    width: 370px;
    max-width: 100%;
    padding: 18px 16px;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
    border: 1px solid #94a3b8;
    border-radius: 4px;
    margin: 0 auto;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

.thermal-receipt-center {
    text-align: center;
    color: #000000 !important;
}

.thermal-store-name {
    font-size: 18px;
    font-weight: 900;
    text-align: center;
    color: #000000 !important;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
}

.thermal-store-slogan, .thermal-store-info {
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    color: #000000 !important;
    line-height: 1.35;
}

.thermal-sale-time-row {
    font-size: 13.5px;
    font-weight: 800;
    color: #000000 !important;
    text-align: left;
    margin: 10px 0 6px 0;
}

.thermal-bill-title {
    font-size: 17.5px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.8px;
    color: #000000 !important;
    margin: 5px 0 3px 0;
}

.thermal-bill-code {
    font-size: 15px;
    font-weight: 900;
    text-align: center;
    color: #000000 !important;
    margin-bottom: 6px;
}

.thermal-meta-left {
    text-align: left;
    font-size: 13.5px;
    font-weight: 700;
    color: #000000 !important;
    line-height: 1.45;
}

.thermal-meta-row {
    display: flex;
    gap: 6px;
    color: #000000 !important;
}

.thermal-meta-row strong {
    font-weight: 800;
    color: #000000 !important;
}

.thermal-bold-large {
    font-size: 16px;
    font-weight: 900 !important;
    color: #000000 !important;
}

.thermal-dashed-line {
    border-bottom: 1.5px dashed #000000 !important;
    height: 0;
    width: 100%;
    margin: 6px 0;
    overflow: hidden;
    font-size: 0;
    color: transparent;
}

/* Header bảng món Bill Bán Hàng: Đơn giá - SL - Thành tiền (Căn đều full width) */
.thermal-sale-table-header {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 900;
    color: #000000 !important;
    padding: 4px 0;
    width: 100%;
}
.thermal-sale-table-header .col-price { width: 33%; text-align: left; }
.thermal-sale-table-header .col-qty { width: 18%; text-align: center; }
.thermal-sale-table-header .col-total { width: 49%; text-align: right; }

.thermal-sale-items {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.thermal-item-entry {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    width: 100%;
}

.thermal-item-name {
    font-size: 14.5px;
    font-weight: 900;
    color: #000000 !important;
    text-transform: uppercase;
    text-align: left;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
}

.thermal-item-nums {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 800;
    color: #000000 !important;
    width: 100%;
}
.thermal-item-nums .num-price { width: 33%; text-align: left; }
.thermal-item-nums .num-qty { width: 18%; text-align: center; }
.thermal-item-nums .num-total { width: 49%; text-align: right; }

/* Totals Block căn phải chuẩn KiotViet thực tế */
.thermal-totals-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    margin-top: 6px;
    gap: 4px;
}

.thermal-total-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    font-size: 13.5px;
    font-weight: 800;
    color: #000000 !important;
}

.thermal-total-row .t-label {
    min-width: 140px;
    text-align: right;
    margin-right: 15px;
    color: #000000 !important;
}

.thermal-total-row .t-val {
    min-width: 85px;
    text-align: right;
    color: #000000 !important;
}

.thermal-grand-total {
    margin: 5px 0;
}

.thermal-vat-note {
    font-size: 12.5px;
    font-weight: 700;
    font-style: italic;
}

.thermal-grand-total .t-label, .thermal-grand-total .t-val {
    font-size: 17px !important;
    font-weight: 900 !important;
    color: #000000 !important;
}

/* Khối thông tin HĐĐT VNPT TT78 */
.thermal-einvoice-block {
    margin-top: 4px;
    font-size: 12.5px;
    color: #000000 !important;
    width: 100%;
}

.thermal-einvoice-title {
    font-size: 13.5px;
    font-weight: 900;
    text-align: center;
    margin: 4px 0;
    color: #000000 !important;
}

.thermal-einvoice-row {
    font-size: 12.5px;
    font-weight: 700;
    color: #000000 !important;
    margin: 2px 0;
    line-height: 1.4;
    word-break: break-all;
}

/* Bill Chế Biến */
.thermal-kitchen-title {
    font-size: 20px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 2px;
    color: #000000 !important;
    margin: 2px 0 6px 0;
}

.thermal-kitchen-table-header {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 900;
    color: #000000 !important;
    padding: 4px 0;
    width: 100%;
}
.thermal-kitchen-table-header .col-mon { flex: 1; text-align: left; }
.thermal-kitchen-table-header .col-dvt { width: 55px; text-align: center; }
.thermal-kitchen-table-header .col-sl { width: 45px; text-align: right; }

.thermal-kitchen-items {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.thermal-kitem-entry {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    width: 100%;
}

.thermal-kitem-name {
    font-size: 15px;
    font-weight: 900;
    color: #000000 !important;
    text-transform: uppercase;
    text-align: left;
    margin-bottom: 2px;
}

.thermal-kitem-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 800;
    color: #000000 !important;
    width: 100%;
}
.thermal-kitem-sub .sub-code { flex: 1; text-align: left; }
.thermal-kitem-sub .sub-dvt { width: 55px; text-align: center; }
.thermal-kitem-sub .sub-qty { width: 45px; text-align: right; font-size: 17px; font-weight: 900; }

.thermal-footer {
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: #000000 !important;
    margin-top: 6px;
}

.thermal-cut-feed {
    height: 22mm;
    width: 100%;
}

.screen-bill-separator {
    display: flex;
    align-items: center;
    width: 370px;
    max-width: 100%;
    margin: 8px 0;
    gap: 8px;
}

.screen-bill-separator .sep-line {
    flex: 1;
    height: 1px;
    background: #94a3b8;
}

.screen-bill-separator .sep-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

.receipt-actions-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 14px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.btn-print-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-print-both {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-print-both:hover {
    background: linear-gradient(135deg, #047857, #065f46);
    transform: translateY(-1px);
}

.btn-print-kitchen {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.btn-print-kitchen:hover {
    background: #fde68a;
}

.btn-print-customer {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-print-customer:hover {
    background: #f1f5f9;
}

/* VAT BADGES IN CART */
.badge-vat-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: 0.2px;
}
.badge-vat-tag.vat-8 {
    background: #dcfce7;
    color: #15803d;
}
.badge-vat-tag.vat-10 {
    background: #ffedd5;
    color: #c2410c;
}

/* ===================================================
   NEW STYLES FOR REVISED USER REQUIREMENTS
   =================================================== */

/* 1. AUTHENTICATION & LOGIN OVERLAY */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.88), rgba(6, 78, 59, 0.95));
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.login-box {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: loginFadeIn 0.25s ease-out;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
    background: linear-gradient(135deg, var(--kv-green-header), var(--kv-green-dark));
    color: #ffffff;
    padding: 24px 20px 20px;
    text-align: center;
}

.login-logo-img {
    width: 52px;
    height: 52px;
    background: #ffffff;
    padding: 3px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    margin-bottom: 10px;
}

.login-header h2 {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: 0.88rem;
    color: #bbf7d0;
    margin-top: 2px;
}

.login-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--kv-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-field label i {
    color: var(--kv-green);
}

.login-field input {
    background: #f8fafc;
    border: 1.5px solid var(--kv-border);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    font-size: 0.95rem;
    color: var(--kv-text);
    outline: none;
    transition: all 0.2s;
}

.login-field input:focus {
    background: #ffffff;
    border-color: var(--kv-green);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.2);
}

.login-remember-row {
    display: flex;
    align-items: center;
    margin-top: -2px;
    margin-bottom: 2px;
}

.remember-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--kv-green-dark);
    cursor: pointer;
    user-select: none;
}

.remember-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--kv-green);
    cursor: pointer;
}

.remember-checkbox-label i {
    color: var(--kv-green);
    font-size: 0.9rem;
}

.login-error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
}

.btn-login-submit {
    background: linear-gradient(135deg, var(--kv-green), var(--kv-green-dark));
    color: #ffffff;
    border: none;
    padding: 13px;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(21, 128, 61, 0.45);
}

.quick-login-section {
    padding: 0 24px 24px;
    border-top: 1px solid var(--kv-border-light);
}

.quick-login-title {
    text-align: center;
    position: relative;
    margin: 14px 0 12px;
}

.quick-login-title span {
    background: #ffffff;
    padding: 0 10px;
    font-size: 0.8rem;
    color: var(--kv-text-dim);
    font-weight: 700;
}

.quick-accounts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-quick-acc {
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.btn-quick-acc:hover {
    background: var(--kv-green-tint);
    border-color: var(--kv-green);
}

.btn-quick-acc i {
    font-size: 1.15rem;
    color: var(--kv-green);
    width: 22px;
    text-align: center;
}

.btn-quick-acc div {
    display: flex;
    flex-direction: column;
}

.btn-quick-acc strong {
    font-size: 0.82rem;
    color: var(--kv-text);
}

.btn-quick-acc small {
    font-size: 0.72rem;
    color: var(--kv-text-sub);
}

.btn-quick-acc.acc-admin {
    grid-column: span 2;
    background: #fffbeb;
    border-color: #fde68a;
}

.btn-quick-acc.acc-admin i {
    color: #d97706;
}

/* User Profile in Header */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.16);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-role-tag {
    background: #fef08a;
    color: #854d0e;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}

.user-role-tag.role-cashier {
    background: #dcfce7;
    color: #166534;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
}

.branch-lock-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fef08a;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Logo CocoMeo trên nền trắng */
.brand-logo-white-badge {
    background: #ffffff;
    padding: 3px 12px 3px 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.brand-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
}

.brand-logo-img {
    width: 48px;
    height: 38px;
    object-fit: contain;
    border-radius: 4px;
}

.brand-logo-text {
    font-size: 1.08rem;
    font-weight: 900;
    color: #14532d; /* Deep Forest Green Logo Text on Crisp White */
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.brand-author-text {
    font-size: 0.65rem;
    font-weight: 700;
    color: #047857; /* Rich emerald subtitle */
    letter-spacing: -0.1px;
    white-space: nowrap;
}

.brand-sub-badge {
    font-size: 0.78rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.22);
    color: #fef08a;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* Nút Đồng Bộ Dữ Liệu Nhanh ở Header */
.btn-header-sync {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-sm);
    padding: 6px 13px;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.btn-header-sync:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.btn-header-sync:active {
    transform: translateY(0);
}
.btn-header-sync i {
    font-size: 0.95rem;
    transition: transform 0.2s;
}
.btn-header-sync .sync-pending-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ea580c;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 1px 6px;
    border-radius: 10px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Chế độ Online / Offline & Tự động đồng bộ */
.network-status-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 800;
    cursor: default;
    transition: all 0.3s ease;
}

.network-status-badge.online {
    background: rgba(34, 197, 94, 0.22);
    border: 1px solid rgba(74, 222, 128, 0.45);
    color: #bbf7d0;
}

.network-status-badge.offline {
    background: #ea580c;
    border: 1px solid #ffedd5;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4);
    animation: offlinePulse 1.6s infinite;
}

@keyframes offlinePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.88; transform: scale(1.03); }
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    box-shadow: 0 0 8px #4ade80;
}

.network-status-badge.offline .status-pulse-dot {
    background: #fef08a;
    box-shadow: 0 0 8px #fef08a;
}

.network-toast {
    position: fixed;
    top: 68px;
    right: 20px;
    z-index: 999999;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDownToast 0.3s ease-out;
}

@keyframes slideDownToast {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.network-toast.warning {
    background: #ea580c;
    color: #ffffff;
    border: 1px solid #f97316;
}

.network-toast.success {
    background: #15803d;
    color: #ffffff;
    border: 1px solid #16a34a;
}

/* 2. OPTIMIZED TABLE CARDS SIZE & SOFT BLUE PASTEL BACKGROUND */
.tables-matrix-large {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)) !important;
    gap: 14px 10px !important;
    padding: 14px !important;
}

.tables-matrix-large .table-shape {
    width: 108px !important;
    height: 66px !important;
    border-width: 2px !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
    /* Tên bàn ở trên, tổng tiền / "Chưa lưu" ở dưới */
    flex-direction: column;
    padding: 0 3px;
    line-height: 1.25;
}

.tables-matrix-large .table-shape > span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* NỀN MÀU XANH DƯƠNG NHẠT NHẠT Ở CÁC PHÒNG BÀN THEO YÊU CẦU */
.tables-matrix-large .table-shape.empty {
    background: #e0f2fe !important;
    border-color: #7dd3fc !important;
    color: #0369a1 !important;
}

.tables-matrix-large .table-shape.empty::before,
.tables-matrix-large .table-shape.empty::after {
    background: #7dd3fc !important;
    left: 24px !important;
    right: 24px !important;
    height: 4px !important;
}

.tables-matrix-large .table-shape.empty:hover {
    background: #bae6fd !important;
    border-color: #38bdf8 !important;
}

/* BÀN ĐANG ĐƯỢC CHỌN (ACTIVE / SELECTED) */
.tables-matrix-large .kv-table-card.is-selected .table-shape,
.tables-matrix-large .kv-table-card.selected .table-shape {
    background: #15803d !important;
    border-color: #166534 !important;
    box-shadow: 0 4px 14px rgba(22, 101, 52, 0.45) !important;
}

.tables-matrix-large .kv-table-card.is-selected .table-shape .table-name,
.tables-matrix-large .kv-table-card.selected .table-shape .table-name {
    color: #ffffff !important;
}

.tables-matrix-large .kv-table-card.is-selected .table-shape::before,
.tables-matrix-large .kv-table-card.is-selected .table-shape::after,
.tables-matrix-large .kv-table-card.selected .table-shape::before,
.tables-matrix-large .kv-table-card.selected .table-shape::after {
    background: #166534 !important;
    left: 24px !important;
    right: 24px !important;
    height: 4px !important;
}

/* BÀN ĐANG CÓ ĐƠN (đã lưu): cam đậm để khác hẳn bàn trống */
.tables-matrix-large .table-shape.occupied {
    background: #fdba74 !important;
    border-color: #ea580c !important;
}

.tables-matrix-large .table-shape.occupied:hover {
    background: #fb923c !important;
}

.tables-matrix-large .table-shape.occupied::before,
.tables-matrix-large .table-shape.occupied::after {
    background: #ea580c !important;
    left: 24px !important;
    right: 24px !important;
    height: 4px !important;
}

.tables-matrix-large .table-name {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.2px !important;
}

.tables-matrix-large .table-shape.empty .table-name {
    color: #1e3a8a !important;
}

.tables-matrix-large .table-shape.occupied .table-name {
    color: #7c2d12 !important;
}

/* BÀN CÓ MÓN CHƯA LƯU trên máy này: vàng, viền đứt */
.tables-matrix-large .table-shape.draft {
    background: #fef08a !important;
    border-color: #ca8a04 !important;
    border-style: dashed !important;
}

.tables-matrix-large .table-shape.draft::before,
.tables-matrix-large .table-shape.draft::after {
    background: #ca8a04 !important;
    left: 24px !important;
    right: 24px !important;
    height: 4px !important;
}

.tables-matrix-large .table-shape.draft .table-name {
    color: #713f12 !important;
}

.tables-matrix-large .kv-table-card.has-draft .table-shape.occupied {
    border-style: dashed !important;
}

.tables-matrix-large .table-draft {
    margin-top: 1px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fff;
    color: #854d0e;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.5;
}

.kv-table-card.has-draft:not(.is-occupied) .table-subgroup {
    color: #854d0e !important;
}

.tables-matrix-large .table-bill {
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    color: #7c2d12 !important;
    margin-top: 1px !important;
}

/* Ở DƯỚI TÊN CÁC PHÒNG BÀN TO RA MỘT CHÚT VÀ IN ĐẬM THEO YÊU CẦU */
.tables-matrix-large .table-subgroup {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #1e40af !important;
    margin-top: 3px !important;
    letter-spacing: -0.1px !important;
    text-align: center !important;
}

.kv-table-card.is-occupied .table-subgroup {
    color: #c2410c !important;
}

/* 3. ENLARGED PRODUCT CARDS */
.products-matrix-large {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 15px !important;
}

.products-matrix-large .kv-product-card {
    min-height: 200px !important;
    border-radius: var(--radius-md) !important;
}

.products-matrix-large .prod-preview-box {
    height: 115px !important;
}

.products-matrix-large .prod-info {
    padding: 10px 12px !important;
}

.products-matrix-large .prod-title {
    font-size: 0.96rem !important;
    font-weight: 700 !important;
    min-height: 40px !important;
    line-height: 1.25 !important;
}

.products-matrix-large .prod-price {
    font-size: 1.18rem !important;
    font-weight: 900 !important;
    color: var(--kv-green) !important;
}

/* 4. BILLING SECTION & PROMINENT TRANSFER TABLE */
.btn-top-transfer {
    background: #ecfdf5;
    border: 1.5px solid #10b981;
    color: #047857;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-top-transfer:hover {
    background: #10b981;
    color: #ffffff;
}

.btn-meta-tool.highlight-transfer {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

.highlight-table-name {
    color: var(--kv-green);
    font-size: 1.1rem;
}

/* 2-line Note Textarea */
.row-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--kv-text-sub);
    margin-bottom: 5px;
}

.note-textarea-2lines {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid var(--kv-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.92rem;
    resize: none;
    outline: none;
}

.note-textarea-2lines:focus {
    border-color: var(--kv-green);
}

/* Dual-mode Discount */
.discount-mode-selector {
    margin-bottom: 8px;
}

.discount-type-tabs {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.btn-discount-type {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--kv-text-sub);
    cursor: pointer;
}

.btn-discount-type.active {
    background: var(--kv-green);
    border-color: var(--kv-green);
    color: #ffffff;
}

.discount-inputs-subgroup {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-with-addon {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--kv-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.input-with-addon input {
    flex: 1;
    border: none !important;
    padding: 8px 10px !important;
    outline: none !important;
    font-size: 0.95rem !important;
}

.addon-badge {
    background: #f1f5f9;
    padding: 8px 12px;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--kv-text-sub);
    border-left: 1px solid var(--kv-border);
}

.quick-percent-chips {
    display: flex;
    gap: 6px;
}

.p-chip, .c-chip {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-sm);
    padding: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--kv-text);
}

.p-chip:hover, .c-chip:hover {
    border-color: var(--kv-green);
    color: var(--kv-green);
}

/* VAT 8% summary line */
.vat-summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.vat-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--kv-text);
    cursor: pointer;
}

.vat-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--kv-green);
}

.text-rose { color: #e11d48 !important; }
.text-amber { color: #d97706 !important; }

/* Prominent Total Line Right Above Checkout Bar */
.total-line-prominent {
    background: #f0fdf4 !important;
    border: 1.5px solid #86efac !important;
    border-radius: var(--radius-md) !important;
    padding: 10px 14px !important;
    margin-top: 6px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.total-label-box {
    display: flex;
    flex-direction: column;
}

.total-label-main {
    font-size: 1rem;
    font-weight: 900;
    color: #14532d;
    letter-spacing: -0.2px;
}

.total-label-sub {
    font-size: 0.75rem;
    color: #166534;
}

.total-val-huge {
    font-size: 1.85rem !important;
    font-weight: 900 !important;
    color: #15803d !important;
    letter-spacing: -0.5px !important;
    text-shadow: 0 1px 2px rgba(21, 128, 61, 0.15);
}

/* 5. MANAGEMENT TAB SUB-NAVIGATION & PRODUCT LIST & HOLIDAY SURCHARGE */
.manage-sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-manage-sub {
    background: #ffffff;
    border: 1.5px solid var(--kv-border);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--kv-text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-manage-sub.active {
    background: var(--kv-green);
    border-color: var(--kv-green);
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(21, 128, 61, 0.3);
}

.holiday-config-card {
    margin-bottom: 24px;
    border-left: 4px solid #f59e0b;
}

.holiday-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 1.2fr 1.5fr 1.5fr;
    gap: 14px;
    align-items: flex-end;
    background: #fffbeb;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid #fef3c7;
}

.holiday-form-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.holiday-form-grid label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #92400e;
}

.holiday-form-grid input {
    background: #ffffff;
    border: 1px solid #fde68a;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
}

.form-check-group {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    height: 38px;
}

.btn-save-holiday {
    background: #d97706;
    color: #ffffff;
    border: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-save-holiday:hover {
    background: #b45309;
}

/* Switch container */
.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-container input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider { background-color: #d97706; }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }

.holiday-list-container {
    margin-top: 16px;
}

.holiday-list-container h4 {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--kv-text);
    margin-bottom: 10px;
}

.holiday-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.holiday-card-item {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.holiday-card-item.active {
    border-color: #f59e0b;
    background: #fffbeb;
}

.holiday-card-info h5 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--kv-text);
}

.holiday-card-info p {
    font-size: 0.8rem;
    color: var(--kv-text-sub);
    margin-top: 2px;
}

.btn-del-holiday {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 6px;
}

/* Products Management Table */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-add-new-product {
    background: var(--kv-green);
    color: #ffffff;
    border: none;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(21, 128, 61, 0.3);
}

.btn-add-new-product:hover {
    background: var(--kv-green-dark);
}

.product-mgmt-filter-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--kv-border-light);
    margin-bottom: 14px;
}

.p-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
}

.p-filter-search {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.p-filter-search i {
    position: absolute;
    left: 12px;
    color: var(--kv-text-dim);
}

.p-filter-search input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    padding: 7px 12px 7px 34px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    outline: none;
}

.p-count-badge {
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    color: var(--kv-text-sub);
    white-space: nowrap;
}

.prod-tbl-img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    border: 1px solid var(--kv-border);
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 2px;
}

.modal-text-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.92rem;
    outline: none;
}

.modal-text-input:focus {
    border-color: var(--kv-green);
    background: #ffffff;
}

/* ================= REVENUE PERIOD CONTROLS & COMPARISONS ================= */
.revenue-period-header {
    background: #ffffff;
    border: 1px solid var(--kv-border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.period-toggle-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.btn-period-toggle {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.btn-period-toggle:hover {
    color: var(--kv-green);
}

.btn-period-toggle.active {
    background: var(--kv-green);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(20, 83, 45, 0.3);
}

.period-date-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper i {
    position: absolute;
    left: 10px;
    color: #64748b;
    pointer-events: none;
}

.date-input-wrapper input {
    background: #f8fafc;
    border: 1.5px solid var(--kv-border);
    border-radius: var(--radius-sm);
    padding: 7px 10px 7px 32px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--kv-text);
    outline: none;
    cursor: pointer;
}

.date-input-wrapper input:focus {
    border-color: var(--kv-green);
    background: #ffffff;
}

.quick-date-buttons {
    display: flex;
    gap: 5px;
}

.btn-quick-date {
    background: #f8fafc;
    border: 1px solid var(--kv-border);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-quick-date:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.period-status-badge {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
}

/* KPI Growth & Comparison */
.kpi-growth-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.kpi-growth-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 800;
}

.kpi-growth-badge.positive {
    background: #dcfce7;
    color: #15803d;
}

.kpi-growth-badge.negative {
    background: #fee2e2;
    color: #b91c1c;
}

/* Area Split Cards (Kid vs Cafe / Garden) */
.area-split-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 18px;
}

.branch-split-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--kv-border);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
}

.badge-branch-total {
    background: #14532d;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.92rem;
    font-weight: 900;
}

.split-card-body {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.split-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.split-stat-box {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.split-stat-box.kid-box {
    background: #fffbeb;
    border-color: #fde68a;
}

.split-stat-box.cafe-box {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.split-stat-box.garden-box {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.split-stat-header {
    font-size: 0.8rem;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kid-box .split-stat-header { color: #b45309; }
.cafe-box .split-stat-header { color: #15803d; }
.garden-box .split-stat-header { color: #047857; }

.split-stat-amount {
    font-size: 1.25rem;
    font-weight: 900;
    color: #0f172a;
}

.split-stat-sub {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
}

.split-divider-vs {
    font-size: 0.78rem;
    font-weight: 900;
    color: #94a3b8;
    background: #f1f5f9;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.split-progress-container {
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    background: #e2e8f0;
}

.split-bar-kid {
    background: #f59e0b;
    height: 100%;
    transition: width 0.3s ease;
}

.split-bar-cafe {
    background: #15803d;
    height: 100%;
    transition: width 0.3s ease;
}

.split-bar-garden {
    background: #059669;
    height: 100%;
    transition: width 0.3s ease;
}

.split-drinks-indicator {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0369a1;
    background: #f0f9ff;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #bae6fd;
}

/* Drinks 7-Categories Breakdown List */
.drinks-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}

.drink-breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.drink-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
}

.drink-item-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--kv-green);
}

.drink-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drink-item-amt {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
}

.drink-item-pct {
    background: #dcfce7;
    color: #15803d;
    font-size: 0.74rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 42px;
    text-align: center;
}

/* Table % Nước chế biến badges */
.badge-drinks-ratio {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: inline-block;
}

.growth-badge-tbl {
    font-weight: 800;
    font-size: 0.8rem;
    padding: 2px 7px;
    border-radius: 10px;
}
.growth-badge-tbl.up { background: #dcfce7; color: #166534; }
.growth-badge-tbl.down { background: #fee2e2; color: #991b1b; }

/* ==========================================================================
   HÓA ĐƠN ĐIỆN TỬ VNPT TT78 & PHƯƠNG THỨC THANH TOÁN (KIOTVIET FNB POS)
   ========================================================================== */

/* 1. Lựa chọn phương thức thanh toán tại giỏ hàng - Thu nhỏ gọn gàng */
.payment-method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    padding: 2px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.pm-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pm-toggle-btns {
    display: flex;
    gap: 4px;
}

.btn-pm-tab {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-pm-tab:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.btn-pm-tab.active {
    background: #15803d;
    color: #ffffff;
    border-color: #166534;
    box-shadow: 0 1px 3px rgba(21, 128, 61, 0.25);
}

/* 2. Checkbox phát hành HĐĐT ngay dưới mục tiền khách đưa - Gọn gàng */
.einvoice-cart-toggle-row {
    margin-top: 4px;
    padding: 4px 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.einvoice-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.84rem;
    font-weight: 700;
    color: #166534;
}

.einvoice-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #15803d;
    cursor: pointer;
}

.einvoice-summary-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
    font-size: 0.76rem;
}

.badge-company-txt {
    font-weight: 700;
    color: #047857;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.btn-badge-edit {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-badge-edit:hover { background: #0369a1; }

/* 3. Modal Thông Tin Khách Hàng Xuất Hóa Đơn */
.einvoice-modal-box {
    max-width: 620px;
    width: 95%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.einvoice-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-row label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.tax-search-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tax-search-group input {
    flex: 1;
}

.btn-tax-lookup {
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-tax-lookup:hover { background: #0369a1; }

.btn-masothue-web {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}
.btn-masothue-web:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.tax-lookup-notice {
    font-size: 0.78rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 2px;
}
.tax-lookup-notice.success { background: #dcfce7; color: #166534; }
.tax-lookup-notice.error { background: #fee2e2; color: #991b1b; }

.template-note-bar {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 4. Modal Cảnh Báo "BẠN CÓ CHẮC CHẮN XUẤT HÓA ĐƠN ĐIỆN TỬ" */
.einvoice-confirm-box {
    max-width: 480px;
    width: 90%;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border-top: 6px solid #eab308;
    animation: popInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popInModal {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.confirm-icon-box {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: #fef9c3;
    color: #ca8a04;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 10px rgba(202, 138, 4, 0.2);
}

.confirm-title-huge {
    font-size: 1.25rem;
    font-weight: 900;
    color: #991b1b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: -0.3px;
}

.confirm-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 16px;
}

.confirm-details-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-details-card .c-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.84rem;
}

.confirm-details-card .c-label {
    color: #64748b;
    font-weight: 600;
    min-width: 120px;
}

.confirm-details-card .c-val {
    font-weight: 700;
    color: #0f172a;
    text-align: right;
    max-width: 260px;
    word-break: break-word;
}
.confirm-details-card .c-val.font-large { font-size: 1.1rem; }

.confirm-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-confirm-yes {
    flex: 1;
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(21, 128, 61, 0.3);
}
.btn-confirm-yes:hover {
    background: #166534;
    transform: translateY(-1px);
}

.btn-confirm-no {
    flex: 1;
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-confirm-no:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 5. Giao diện In Hóa Đơn & Nút Đồng Ý Hoàn Thành */
.btn-primary-confirm {
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}
.btn-primary-confirm:hover {
    background: #166534;
}

.btn-cancel-receipt {
    background: #f1f5f9;
    color: #64748b;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-cancel-receipt:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Banner thông báo hoàn thành đơn hàng - In là tùy chọn */
.receipt-success-banner {
    background: #ecfdf5;
    border: 1.5px solid #6ee7b7;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 14px 18px 0;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.1);
}
.success-banner-icon {
    font-size: 2rem;
    color: #059669;
    flex-shrink: 0;
}
.success-banner-text {
    flex: 1;
}
.success-banner-title {
    color: #065f46;
    font-size: 0.96rem;
    font-weight: 800;
    display: block;
}
.success-banner-sub {
    color: #047857;
    font-size: 0.82rem;
    margin-top: 3px;
    font-weight: 500;
}

/* Nút In & Đóng mới trên Receipt Modal */
.btn-print-large {
    background: #1e3a8a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 11px 22px;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
    transition: all 0.2s;
}
.btn-print-large:hover {
    background: #172554;
    transform: translateY(-1px);
}

.btn-close-large {
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-close-large:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Khối HĐĐT trên phiếu in */
.receipt-einvoice-block {
    margin-top: 6px;
    font-size: 0.82rem;
}

.receipt-einvoice-title {
    text-align: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #1e3a8a;
    margin: 4px 0 8px;
}

.receipt-code-txt {
    font-family: monospace;
    font-size: 0.78rem;
    color: #334155;
    word-break: break-all;
}

.receipt-url-txt {
    font-family: monospace;
    font-size: 0.72rem;
    color: #0369a1;
}

/* 6. Quản Lý Tab: Thiết Lập Hóa Đơn Điện Tử (VNPT) */
.einvoice-settings-wrapper {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.einvoice-status-banner {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.banner-status-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-pulse-dot {
    width: 14px;
    height: 14px;
    background: #16a34a;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.2);
    animation: pulseStatus 2s infinite;
}

@keyframes pulseStatus {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.banner-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #14532d;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.banner-sub {
    font-size: 0.82rem;
    color: #15803d;
    margin: 0;
}

.badge-online-pill {
    background: #166534;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.einvoice-cards-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
}

@media (max-width: 1024px) {
    .einvoice-cards-grid {
        grid-template-columns: 1fr;
    }
}

.einvoice-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-header-styled {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-styled h4 {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-provider {
    background: #0284c7;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-tag-tt78 {
    background: #15803d;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
}

.card-body-styled {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-form-row label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
}

.setting-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.styled-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #0f172a;
    transition: border-color 0.2s;
}
.styled-input:focus {
    border-color: #15803d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}

.styled-input.font-mono { font-family: monospace; font-size: 0.82rem; }
.styled-input.font-bold { font-weight: 700; }

.input-action-wrap {
    display: flex;
    gap: 6px;
}

.btn-open-link {
    background: #f1f5f9;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}
.btn-open-link:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-eye-toggle {
    background: #f1f5f9;
    color: #64748b;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-eye-toggle:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.einvoice-btn-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.btn-check-vnpt-conn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-check-vnpt-conn:hover { background: #0369a1; }

.btn-save-vnpt-cfg {
    background: #15803d;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-save-vnpt-cfg:hover { background: #166534; }

.conn-test-notice {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}
.conn-test-notice.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.conn-test-notice.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Bảng Mẫu Hóa Đơn */
.tpl-styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.tpl-styled-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 8px 10px;
    border-bottom: 1px solid #cbd5e1;
    text-align: left;
}

.tpl-styled-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.tpl-badge-no {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.tpl-badge-serial {
    background: #fef3c7;
    color: #b45309;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.badge-tpl-current {
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 12px;
}

.badge-tpl-secondary {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 12px;
}

.card-sub-heading {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
}

.pos-feature-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.checklist-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.8rem;
}

.checklist-item i {
    margin-top: 2px;
    font-size: 0.95rem;
}

.checklist-item strong {
    color: #0f172a;
    display: block;
    margin-bottom: 2px;
}

.checklist-item p {
    color: #64748b;
    margin: 0;
    line-height: 1.35;
}

/* ==========================================================================
   TÙY CHỌN ĐỐI TƯỢNG XUẤT HÓA ĐƠN: NGƯỜI TIÊU DÙNG / CÁ NHÂN / DOANH NGHIỆP
   ========================================================================== */
.customer-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.btn-cust-tab {
    flex: 1;
    background: #f8fafc;
    color: #475569;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-cust-tab:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-cust-tab.active {
    background: #15803d;
    color: #ffffff;
    border-color: #166534;
    box-shadow: 0 2px 6px rgba(21, 128, 61, 0.25);
}

.consumer-default-card {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.def-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dcfce7;
    color: #15803d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.def-info h4 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    color: #14532d;
}

.def-info p {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: #166534;
    line-height: 1.4;
}

.badge-auto-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #047857;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.badge-tag-auto {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ================= SHORTCUT & MODAL CẬP NHẬT THÔNG TIN & MẬT KHẨU THUẾ VNPT ================= */
.btn-nav-tax-shortcut {
    border-left: 2px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.08) !important;
    font-weight: 700;
}
.btn-nav-tax-shortcut:hover {
    background: rgba(245, 158, 11, 0.2) !important;
}

.einvoice-toggle-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.btn-tax-settings-shortcut {
    background: #f8fafc;
    color: #0f766e;
    border: 1px solid #99f6e4;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-tax-settings-shortcut:hover {
    background: #0f766e;
    color: #ffffff;
    border-color: #0f766e;
}

.modal-actions-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.modal-actions-right {
    display: flex;
    gap: 10px;
}

.btn-link-tax-cfg {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-link-tax-cfg:hover {
    background: #f59e0b;
    color: #ffffff;
    border-color: #d97706;
}

.tax-settings-modal-box {
    max-width: 680px;
    width: 95%;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.tax-cfg-notice-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}
.tax-cfg-notice-card i {
    font-size: 1.1rem;
    margin-top: 2px;
    color: #3b82f6;
    flex-shrink: 0;
}


/* ================= CLOUDFLARE VIETNAMESE TYPOGRAPHY & HEADER POLISH ================= */
body, button, input, select, textarea {
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.app-header {
    gap: 10px !important;
    padding: 0 12px !important;
}

.header-left {
    gap: 8px !important;
    flex-shrink: 0;
}

.system-nav {
    display: flex;
    align-items: center;
    gap: 5px !important;
    flex-wrap: nowrap;
}

.sys-tab-btn {
    padding: 6px 11px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-radius: 8px !important;
    gap: 6px !important;
}

/* Fix ugly left-only border crescent on Cấu Hình Thuế button */
.btn-nav-tax-shortcut {
    background: rgba(254, 240, 138, 0.14) !important;
    border: 1px solid rgba(253, 224, 71, 0.45) !important;
    border-left: 1px solid rgba(253, 224, 71, 0.45) !important;
    color: #fef08a !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.btn-nav-tax-shortcut:hover {
    background: rgba(254, 240, 138, 0.25) !important;
    border-color: #fde047 !important;
    color: #ffffff !important;
}

/* Polished Đồng bộ dữ liệu button in Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px !important;
    flex-shrink: 0;
}

.btn-header-sync {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background: rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.38) !important;
    border-radius: 20px !important;
    padding: 5px 12px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.14) !important;
}

.btn-header-sync:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    border-color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22) !important;
}

.btn-header-sync i {
    font-size: 0.85rem !important;
    color: #86efac !important;
}

/* Button no-overflow safeguards across POS & Modals */
button, .btn-kv-action, .btn-sub-toggle, .btn-meta-tool, .btn-manage-sub, .btn-period-toggle, .btn-quick-date, .cat-tab-btn, .area-pill {
    white-space: nowrap;
    line-height: 1.3;
}

.manage-sub-tabs {
    flex-wrap: wrap;
}


/* ================= MOBILE & TABLET RESPONSIVE OPTIMIZATION ================= */

/* 0. Desktop Defaults for Mobile-Only Elements & Touch Ergonomics */
.btn-mobile-cart-toggle,
.btn-mobile-back-menu,
.mobile-floating-cart-bar {
    display: none;
}

button,
.kv-product-card,
.kv-table-card,
.cat-tab-btn,
.area-pill,
.sys-tab-btn,
.btn-sub-toggle {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kv-product-card.in-cart-active {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.22), 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}

@keyframes cartPulseBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.cart-pulse {
    animation: cartPulseBump 0.28s ease-out;
}

/* ==========================================================================
   1. TABLET LANDSCAPE & COMPACT LAPTOP (<= 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
    /* Header wraps cleanly into 2 compact rows so no tab or button overflows */
    .app-header {
        height: auto !important;
        min-height: 52px;
        flex-wrap: wrap !important;
        padding: 6px 12px !important;
        gap: 6px 10px !important;
    }

    .header-left {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    .brand-author-text,
    .brand-sub-badge {
        display: none !important;
    }

    .brand-logo-white-badge {
        padding: 3px 10px 3px 5px;
    }

    .brand-logo-img {
        width: 38px;
        height: 30px;
    }

    .brand-logo-text {
        font-size: 0.96rem;
    }

    .header-right {
        order: 2;
        margin-left: auto;
    }

    .system-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 5px 0 2px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        justify-content: flex-start;
        gap: 6px !important;
    }
    .system-nav::-webkit-scrollbar {
        display: none;
    }

    /* Category tabs: horizontally scrollable touch pills instead of cramped tiny buttons */
    .category-tabs-bar {
        min-height: 68px;
        max-height: 76px;
        padding: 5px 8px;
        gap: 5px;
    }

    .cat-tabs-row {
        justify-content: flex-start;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cat-tab-btn {
        flex: 0 0 auto !important;
        padding: 4px 12px !important;
        font-size: 0.78rem !important;
        height: 29px !important;
        border-radius: 16px !important;
        letter-spacing: 0 !important;
    }

    /* Balanced Left/Right split on Tablet Landscape */
    .pos-left-panel {
        width: 57%;
    }
    .pos-right-panel {
        width: 43%;
    }

    .tables-matrix-large {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)) !important;
        gap: 12px 10px !important;
    }

    .tables-matrix-large .table-shape {
        width: 104px !important;
        height: 68px !important;
    }

    .products-matrix-large {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 12px !important;
    }

    .products-matrix-large .kv-product-card {
        min-height: 176px !important;
    }

    .products-matrix-large .prod-preview-box {
        height: 96px !important;
    }

    /* Dashboard & Management padding */
    .dashboard-wrapper,
    .invoices-wrapper,
    .sync-wrapper {
        padding: 16px 18px;
        gap: 18px;
    }

    .holiday-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   2. TABLET PORTRAIT & MOBILE PHONES (<= 900px) - SMART POS 3-VIEW MODE
   ========================================================================== */
@media (max-width: 900px) {
    /* Show 3rd Toggle Button [Hóa đơn (X)] in POS Sub-Header */
    .btn-mobile-cart-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 6px;
        position: relative;
    }

    .mobile-cart-tab-badge {
        background: #e2e8f0;
        color: #334155;
        font-size: 0.74rem;
        font-weight: 800;
        padding: 1px 7px;
        border-radius: 12px;
        min-width: 20px;
        text-align: center;
        transition: all 0.2s ease;
    }

    .mobile-cart-tab-badge.has-items {
        background: #ef4444;
        color: #ffffff;
        box-shadow: 0 2px 5px rgba(239, 68, 68, 0.35);
    }

    .btn-mobile-cart-toggle.active .mobile-cart-tab-badge {
        background: #fef08a;
        color: #14532d;
    }

    /* POS Workspace switches to single-active-panel + sticky bottom cart bar */
    .pos-workspace {
        flex-direction: column;
        position: relative;
    }

    /* Default on <= 900px: Left Panel (Phòng bàn / Thực đơn) is full width */
    .pos-left-panel {
        width: 100% !important;
        flex: 1 1 auto !important;
        height: auto !important;
        border-right: none !important;
        padding-bottom: 66px !important; /* Space for sticky bottom cart bar */
    }

    .pos-right-panel {
        display: none !important;
    }

    /* Sticky Floating Bottom Cart Bar */
    .mobile-floating-cart-bar {
        display: flex !important;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 66px;
        background: linear-gradient(135deg, #0f172a 0%, #14532d 100%);
        color: #ffffff;
        padding: 8px 14px;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        z-index: 95;
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.25);
        border-top: 2px solid #22c55e;
        cursor: pointer;
    }

    .m-cart-bar-left {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
        flex: 1;
    }

    .m-cart-icon-wrap {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.28);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: #86efac;
        position: relative;
        flex-shrink: 0;
    }

    .m-cart-qty-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: #64748b;
        color: #ffffff;
        font-size: 0.72rem;
        font-weight: 900;
        min-width: 21px;
        height: 21px;
        padding: 0 5px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid #0f172a;
    }

    .m-cart-qty-badge.has-items {
        background: #ef4444;
    }

    .m-cart-bar-info {
        display: flex;
        flex-direction: column;
        min-width: 0;
        line-height: 1.25;
    }

    .m-cart-table-name {
        font-size: 0.76rem;
        font-weight: 700;
        color: #bbf7d0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-cart-total-val {
        font-size: 1.18rem;
        font-weight: 900;
        color: #fef08a;
        letter-spacing: -0.3px;
    }

    .m-cart-bar-btn {
        background: linear-gradient(135deg, #22c55e, #16a34a);
        color: #ffffff;
        border: none;
        border-radius: 10px;
        padding: 10px 16px;
        font-size: 0.86rem;
        font-weight: 800;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        box-shadow: 0 3px 10px rgba(34, 197, 94, 0.35);
        flex-shrink: 0;
    }

    /* When Cart View ('gio-hang') is active on <= 900px */
    .pos-workspace.mobile-cart-open .pos-left-panel {
        height: auto !important;
        flex: 0 0 auto !important;
        padding-bottom: 0 !important;
    }

    .pos-workspace.mobile-cart-open #categoryTabsBar,
    .pos-workspace.mobile-cart-open #viewPhongBan,
    .pos-workspace.mobile-cart-open #viewThucDon,
    .pos-workspace.mobile-cart-open .search-box-f3 {
        display: none !important;
    }

    .pos-workspace.mobile-cart-open .pos-right-panel {
        display: flex !important;
        width: 100% !important;
        flex: 1 1 auto !important;
        height: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .pos-workspace.mobile-cart-open .mobile-floating-cart-bar {
        display: none !important;
    }

    .pos-workspace.mobile-cart-open .cart-body-area {
        flex: 0 0 auto !important;
        min-height: 180px;
        overflow: visible !important;
    }

    .pos-workspace.mobile-cart-open .cart-bottom-area {
        flex: 0 0 auto !important;
        padding-bottom: 24px !important;
    }

    /* Show [+ Thêm món] button in Cart Top Bar on <= 900px */
    .btn-mobile-back-menu {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        background: #15803d;
        color: #ffffff;
        border: none;
        border-radius: 6px;
        padding: 6px 12px;
        font-size: 0.82rem;
        font-weight: 800;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(21, 128, 61, 0.25);
        flex-shrink: 0;
    }

    /* Larger touch targets for + / - quantity buttons in cart */
    .btn-qty-kv {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }

    .qty-val-kv {
        min-width: 28px !important;
        font-size: 1rem !important;
    }

    /* Dashboard & Analytics rows stack on <= 900px */
    .analytics-row {
        flex-direction: column !important;
        gap: 14px !important;
    }

    .area-split-row {
        grid-template-columns: 1fr !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .holiday-form-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .product-mgmt-filter-bar {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    .p-filter-group {
        flex: 1 1 calc(50% - 10px);
        min-width: 140px;
    }

    .p-filter-group select {
        flex: 1;
        width: 100%;
    }

    .p-filter-search {
        flex: 1 1 100%;
        order: 3;
    }

    .einvoice-status-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==========================================================================
   3. SMARTPHONES & COMPACT MOBILE (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
    /* Prevent iOS Safari auto-zoom on input focus */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="tel"],
    input[type="email"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Ultra-clean Mobile Header */
    .app-header {
        padding: 5px 8px !important;
        gap: 5px !important;
    }

    .header-left {
        gap: 6px !important;
    }

    .brand-logo-white-badge {
        padding: 2px 7px 2px 4px !important;
        gap: 5px !important;
    }

    .brand-logo-img {
        width: 30px !important;
        height: 25px !important;
    }

    .brand-logo-text {
        font-size: 0.82rem !important;
    }

    .branch-select-container {
        padding: 3px 7px !important;
        gap: 4px !important;
        max-width: 155px;
    }

    .branch-select {
        font-size: 0.76rem !important;
        max-width: 115px;
        text-overflow: ellipsis;
    }

    .branch-lock-badge {
        display: none !important;
    }

    /* Hide clock, role tag & cashier text on phone header to keep row 1 uncluttered */
    #clockDisplay,
    .user-role-tag,
    .cashier-info {
        display: none !important;
    }

    .btn-header-sync .btn-sync-text {
        display: none !important;
    }

    .btn-header-sync {
        padding: 6px 9px !important;
        border-radius: 50% !important;
    }

    .network-status-badge {
        padding: 3px 7px !important;
        font-size: 0.72rem !important;
    }

    .user-profile-badge {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    .btn-logout {
        width: 30px;
        height: 30px;
    }

    .sys-tab-btn {
        padding: 6px 10px !important;
        font-size: 0.78rem !important;
    }

    /* POS Sub-Header: [Phòng bàn | Thực đơn | Hóa đơn] on Row 1, Search on Row 2 */
    .pos-sub-header {
        height: auto !important;
        min-height: 46px;
        flex-wrap: wrap !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }

    .left-toggle-buttons {
        width: 100%;
        display: flex;
        gap: 5px;
    }

    .btn-sub-toggle {
        flex: 1 1 0;
        justify-content: center;
        padding: 7px 6px !important;
        font-size: 0.8rem !important;
        gap: 5px !important;
    }

    .search-box-f3 {
        width: 100%;
        max-width: none !important;
        order: 2;
    }

    .search-box-f3 input {
        padding: 7px 32px 7px 34px !important;
        font-size: 0.88rem !important;
    }

    /* Tables Filter & Grid on Phone (3 columns) */
    .filter-bar-tables {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 8px 10px;
    }

    .area-pills {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .area-pills::-webkit-scrollbar {
        display: none;
    }

    .area-pill {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    .status-radio-group {
        justify-content: space-between;
        font-size: 0.78rem;
        gap: 4px;
    }

    .tables-scroll-area {
        padding: 10px !important;
    }

    .tables-matrix-large {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px 8px !important;
    }

    .tables-matrix-large .table-shape {
        width: 100% !important;
        max-width: 106px !important;
        height: 62px !important;
        border-radius: 12px !important;
    }

    .tables-matrix-large .table-shape::before,
    .tables-matrix-large .table-shape::after {
        left: 18px !important;
        right: 18px !important;
    }

    .tables-matrix-large .table-name {
        font-size: 0.84rem !important;
    }

    .tables-matrix-large .table-bill {
        font-size: 0.74rem !important;
    }

    .tables-matrix-large .table-subgroup {
        font-size: 0.72rem !important;
    }

    .phong-ban-footer {
        height: 36px;
        padding: 0 10px;
        font-size: 0.78rem;
    }

    /* Products Grid on Phone (2 columns with clear photos) */
    .products-scroll-area {
        padding: 8px !important;
    }

    .products-matrix-large {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .products-matrix-large .kv-product-card {
        min-height: 162px !important;
    }

    .products-matrix-large .prod-preview-box {
        height: 92px !important;
    }

    .products-matrix-large .prod-info {
        padding: 7px 8px !important;
    }

    .products-matrix-large .prod-title {
        font-size: 0.82rem !important;
        min-height: 32px !important;
    }

    .products-matrix-large .prod-price {
        font-size: 0.98rem !important;
    }

    .thuc-don-footer {
        height: 38px;
        padding: 0 10px;
    }

    .btn-back-tables {
        padding: 4px 10px;
        font-size: 0.78rem;
    }

    /* Mobile Floating Cart Bar adjustments on compact phone */
    .mobile-floating-cart-bar {
        height: 60px;
        padding: 6px 10px;
    }

    .m-cart-icon-wrap {
        width: 38px;
        height: 38px;
        font-size: 1.05rem;
    }

    .m-cart-total-val {
        font-size: 1.05rem;
    }

    .m-cart-bar-btn {
        padding: 9px 12px;
        font-size: 0.8rem;
    }

    /* Cart & Checkout Panel on Phone */
    .cart-top-bar {
        height: auto !important;
        flex-wrap: wrap !important;
        padding: 8px 10px !important;
        gap: 6px !important;
    }

    .active-table-pill {
        font-size: 0.82rem !important;
        padding: 5px 10px !important;
    }

    .btn-top-transfer {
        padding: 5px 10px !important;
        font-size: 0.78rem !important;
        margin-left: auto;
    }

    .customer-search-box {
        flex: 1 1 55%;
        order: 3;
    }

    .price-mode-badge {
        order: 4;
        font-size: 0.74rem;
        padding: 4px 8px;
    }

    .cart-items-table th,
    .cart-item-row td {
        padding: 8px 5px !important;
        font-size: 0.8rem !important;
    }

    .item-info-col .item-title {
        font-size: 0.82rem;
    }

    .cart-bottom-area {
        padding: 10px 10px 24px !important;
        gap: 8px !important;
    }

    .cart-meta-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .meta-tools {
        width: 100%;
        display: flex;
        gap: 6px;
    }

    .btn-meta-tool {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 7px 6px;
    }

    .total-line-prominent {
        padding: 8px 10px !important;
    }

    .total-label-main {
        font-size: 0.86rem !important;
    }

    .total-val-huge {
        font-size: 1.4rem !important;
    }

    .tendered-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .t-col {
        justify-content: space-between;
    }

    .t-col input {
        width: 140px;
        height: 34px;
    }

    .einvoice-toggle-top-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .einvoice-toggle-label {
        font-size: 0.78rem;
    }

    .cart-action-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .btn-kv-action {
        font-size: 0.76rem !important;
        height: 40px !important;
        padding: 0 6px;
    }

    .btn-kv-checkout {
        height: 48px !important;
        font-size: 1.05rem !important;
    }

    /* Dashboard, Reports, Products, Users, Invoices on Phone */
    .dashboard-wrapper,
    .invoices-wrapper,
    .sync-wrapper {
        padding: 10px !important;
        gap: 12px !important;
    }

    .manage-sub-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        margin-bottom: 10px;
        padding-bottom: 2px;
    }
    .manage-sub-tabs::-webkit-scrollbar {
        display: none;
    }

    .btn-manage-sub {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .revenue-period-header {
        padding: 10px 12px;
        gap: 10px;
    }

    .period-toggle-group {
        width: 100%;
        overflow-x: auto;
        justify-content: space-between;
    }

    .btn-period-toggle {
        flex: 1;
        justify-content: center;
        padding: 6px 8px;
        font-size: 0.78rem;
    }

    .period-date-controls {
        width: 100%;
    }

    .quick-date-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .btn-quick-date {
        text-align: center;
        padding: 6px 4px;
        font-size: 0.75rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .kpi-card {
        padding: 14px !important;
    }

    .kpi-value {
        font-size: 1.32rem !important;
    }

    .analytics-card,
    .branch-split-card {
        padding: 14px !important;
    }

    .card-head {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }

    .split-stats-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .split-divider-vs {
        margin: 0 auto;
    }

    .holiday-form-grid {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
    }

    .p-filter-group {
        flex: 1 1 100%;
    }

    .invoices-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    /* Keep data tables clean and horizontally scrollable on phone */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    /* Modals & Login Box on Phone */
    .login-modal-overlay {
        padding: 10px !important;
        align-items: flex-start;
        overflow-y: auto;
    }

    .login-box {
        margin: auto 0;
        max-height: 95vh;
        overflow-y: auto;
    }

    .login-header {
        padding: 16px 14px 12px !important;
    }

    .login-header h2 {
        font-size: 1.2rem !important;
    }

    .login-form {
        padding: 14px 16px !important;
        gap: 12px !important;
    }

    .quick-login-section {
        padding: 0 16px 16px !important;
    }

    .quick-accounts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .btn-quick-acc {
        padding: 6px 8px;
        gap: 6px;
    }

    .btn-quick-acc strong {
        font-size: 0.76rem;
    }

    .modal-content,
    .einvoice-modal-box,
    .tax-settings-modal-box,
    .product-modal-enhanced,
    .einvoice-confirm-box {
        width: 96% !important;
        max-height: 92vh !important;
    }

    .modal-body {
        padding: 12px 14px !important;
        max-height: 74vh !important;
    }

    .customer-type-tabs {
        flex-direction: column;
        gap: 6px;
    }

    .setting-form-grid-2,
    .form-row-2col,
    #userModal .form-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .rbac-perms-grid {
        grid-template-columns: 1fr !important;
    }

    .tax-search-group,
    .input-action-wrap {
        flex-wrap: wrap;
    }

    .modal-actions,
    .modal-actions-split,
    .modal-footer,
    .einvoice-btn-actions,
    .receipt-actions-cluster {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .modal-actions-right {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .modal-actions-right button {
        flex: 1;
        justify-content: center;
    }

    .receipt-actions-cluster .btn-print-action,
    .receipt-actions-cluster .btn-close-large {
        flex: 1 1 100%;
        justify-content: center;
    }

    .receipt-success-banner {
        margin: 10px 12px 0;
        padding: 10px 12px;
    }
}
