* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #2EB67D;
    --color-primary-dark: #248f5f;
    --color-success: #28A745;
    --color-danger: #DC3545;
    --color-warning: #FFC107;
    --color-white: #FFFFFF;
    --color-gray-50: #F8F9FA;
    --color-gray-100: #E9ECEF;
    --color-gray-200: #DEE2E6;
    --color-gray-300: #CED4DA;
    --color-gray-600: #6C757D;
    --color-gray-800: #343A40;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
}

body {
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #2EB67D 0%, #248f5f 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* แก้ไข: บังคับให้ทุก element ใช้ Noto Sans Thai */
*, input, select, textarea, button {
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.test-container {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.test-container h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #2EB67D;
}

.btn {
    display: inline-block;
    margin-top: -0.5rem;
    padding: 0.7rem 1rem;
    background: #2EB67D;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.btn:hover {
    background: #248f5f;
    transform: translateY(-2px);
}

/* ==================== HEADER - แก้ไข Responsive ==================== */
.pos-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 60px;
    flex-wrap: nowrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.logo {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.store-info {
    min-width: 0;
    flex: 1;
}

.store-info h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-info p {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.user-info {
    text-align: right;
    font-size: 0.8rem;
    max-width: 150px;
    overflow: hidden;
    display: none; /* ซ่อนใน mobile */
}

.user-info div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== LOGIN SCREEN ==================== */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.logo-big {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-card h1 {
    font-size: 1.75rem;
    color: var(--color-gray-800);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-gray-600);
    margin-bottom: 2rem;
}

/* แก้ไข: Form Group ใน Login Card */
.login-card .form-group {
    margin-bottom: 1.25rem;
    text-align: left;
    width: 100%;
}

.login-card .form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
    box-sizing: border-box;
}

.login-card .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46, 182, 125, 0.1);
}

/* ==================== POS CONTAINER - แก้ไข Height ==================== */
#pos-screen {
    padding-top: 60px;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.pos-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    height: calc(100vh - 60px);
    gap: 0;
    overflow: hidden;
}

/* ==================== PRODUCTS PANEL ==================== */
.products-panel {
    background: var(--color-white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.category-filter {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--color-gray-50);
    border-bottom: 2px solid var(--color-gray-200);
    overflow-x: auto;
}

.category-btn {
    background: white;
    border: 2px solid var(--color-gray-300);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

.category-btn .icon {
    font-size: 1.25rem;
}

.category-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.category-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.search-box {
    padding: 1rem;
    background: var(--color-gray-50);
}

.search-box input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46, 182, 125, 0.1);
}

.products-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    align-content: start;
}

.product-card {
    background: white;
    border: 2px solid var(--color-gray-200);
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* ✅ เพิ่ม style สำหรับรูปภาพ */
.product-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.product-card:active {
    transform: translateY(-2px);
}

.product-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-gray-800);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.product-category {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
    background: var(--color-gray-200);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: var(--color-gray-600);
}

/* ==================== CART PANEL ==================== */
.cart-panel {
    background: var(--color-gray-50);
    border-left: 2px solid var(--color-gray-200);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cart-header {
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 2px solid var(--color-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.25rem;
    color: var(--color-gray-800);
}

.btn-text {
    background: none;
    border: none;
    color: var(--color-danger);
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-text:hover {
    background: rgba(220, 53, 69, 0.1);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-gray-600);
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* ==================== CART ITEM COMPACT (บรรทัดเดียว) ==================== */
.cart-item-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    gap: 0.75rem;
    transition: all 0.2s;
}

.cart-item-compact:hover {
    box-shadow: var(--shadow-md);
}

.item-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
}

.item-name {
    font-weight: 600;
    color: var(--color-gray-800);
    font-size: 0.95rem;
}

.item-qty-unit {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

.btn-qty-inline {
    background: var(--color-gray-200);
    border: none;
    color: var(--color-gray-800);
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-qty-inline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-qty-inline:active {
    transform: scale(0.95);
}

.item-price-remove {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.item-price-remove .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

.btn-remove-inline {
    background: var(--color-danger);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-remove-inline:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.btn-remove-inline:active {
    transform: scale(1.05);
}

/* ลบ Style เก่า (ถ้ามี) */
.cart-item {
    display: none; /* ซ่อน style เก่า */
}

/* ==================== CART SUMMARY ==================== */
.cart-summary {
    background: white;
    padding: 1.5rem;
    border-top: 2px solid var(--color-gray-200);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.summary-row input {
    width: 100px;
    padding: 0.5rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 8px;
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
}

.summary-row.total {
    font-size: 1.5rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--color-gray-300);
    margin-bottom: 0;
}

.summary-row.total strong {
    color: var(--color-primary);
}

/* แก้ไข: ส่วนลดและภาษี - ให้แสดง/ซ่อนได้ */
.summary-discount-tax {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.summary-discount-tax.show {
    max-height: 200px;
}

.btn-toggle-discount {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: center;
    margin-bottom: 0.5rem;
}

.btn-toggle-discount:hover {
    background: var(--color-gray-100);
}

/* ==================== CART ACTIONS ==================== */
.cart-actions {
    padding: 1rem;
    background: white;
    border-top: 2px solid var(--color-gray-200);
}

/* ==================== FOOTER ACTIONS (Mobile) ==================== */
.cart-footer-mobile {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 50;
    border-top: 2px solid var(--color-primary);
}

.footer-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: -35px;
}

.footer-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.footer-summary .total-label {
    color: var(--color-gray-600);
}

.footer-summary .total-amount {
    color: var(--color-primary);
    font-size: 1.5rem;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-gray-800);
    text-align: center;
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-qty {
    background: var(--color-primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-qty:hover {
    background: var(--color-primary-dark);
    transform: scale(1.1);
}

#qty-input {
    width: 120px;
    padding: 0.875rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

/* ✅ เพิ่ม: ให้ readonly input ดูปกติ */
#qty-input[readonly] {
    background: white;
    cursor: default;
    opacity: 1;
}

.unit-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.unit-btn {
    padding: 0.75rem 1.25rem;
    border: 2px solid var(--color-gray-300);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.unit-btn:hover {
    border-color: var(--color-primary);
}

.unit-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.price-input {
    margin-bottom: 1.5rem;
}

.price-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-gray-600);
}

.price-input input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 12px;
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-actions .btn {
    flex: 1;
}

/* ==================== PAYMENT MODAL ==================== */
.payment-modal {
    max-width: 600px;
}

.payment-modal h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--color-gray-800);
    text-align: center;
}

.payment-summary {
    background: var(--color-gray-50);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.amount-row.total {
    font-size: 1.75rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--color-gray-300);
    margin-bottom: 0;
}

.amount-row.total strong {
    color: var(--color-primary);
}

.payment-input {
    margin-bottom: 1.5rem;
}

.payment-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.125rem;
}

.payment-input input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: right;
}

.quick-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-amount {
    padding: 1rem;
    background: var(--color-gray-100);
    border: 2px solid var(--color-gray-300);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-amount:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.payment-change {
    background: #E6F7F1;
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--color-primary);
}

.payment-change strong {
    color: var(--color-primary);
    font-size: 1.75rem;
}

.payment-note {
    margin-bottom: 1.5rem;
}

.payment-note label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.payment-note input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-gray-300);
    border-radius: 12px;
    font-size: 1rem;
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

input {
    font-family: inherit;
}

input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46, 182, 125, 0.1);
}

/* แก้ไข: ตรวจสอบ input และ button ให้แน่ใจ */
input, select, textarea, button {
    font-family: 'Noto Sans Thai', sans-serif;
}

#qty-input, #price-input, #payment-received {
    font-family: 'Noto Sans Thai', sans-serif;
}

.btn, .btn-qty, .btn-amount, .category-btn, .unit-btn {
    font-family: 'Noto Sans Thai', sans-serif;
}

/* ==================== LOADING & TOAST ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 1.125rem;
}

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--color-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-danger);
}

.error-message {
    color: var(--color-danger);
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    font-size: 0.875rem;
    display: none;
    border-left: 3px solid var(--color-danger);
    text-align: left;
    width: 100%;
}

.error-message:not(:empty) {
    display: block;
}

/* ==================== RESPONSIVE - แก้ไขใหม่ทั้งหมด ==================== */
@media (max-width: 1024px) {
    .pos-container {
        grid-template-columns: 1fr 350px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    
    /* Desktop - เว้นที่สำหรับ footer */
    #pos-screen {
        padding-bottom: 90px;
    }
}

@media (max-width: 768px) {
    /* Header - ปรับให้กระทัดรัด */
    .pos-header {
        padding: 0.5rem 0.75rem;
        min-height: 56px;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .store-info h1 {
        font-size: 0.95rem;
    }
    
    .store-info p {
        font-size: 0.7rem;
    }
    
    .header-right {
        gap: 0.35rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    /* Container - แยกเป็น 2 ส่วน แบบ 50:50 จริงๆ */
    #pos-screen {
        padding-top: 56px;
        padding-bottom: 90px;
    }
    
    .pos-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr; /* ✅ เปลี่ยนเป็น 1fr 1fr (50:50 แท้จริง) */
        height: calc(100vh - 56px - 90px);
    }
    
    /* Products Panel */
    .products-panel {
        overflow: hidden;
    }
    
    .category-filter {
        padding: 0.5rem;
        gap: 0.35rem;
    }
    
    .category-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .category-btn .icon {
        font-size: 1.1rem;
    }
    
    .search-box {
        padding: 0.5rem;
    }
    
    .search-box input {
        padding: 0.65rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .product-card {
        padding: 0.65rem;
    }
    
    .product-icon {
        font-size: 2.25rem;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .product-price {
        font-size: 0.95rem;
    }
    
    .product-category {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .product-image {
        height: 60px;
    }
    
    /* Cart Panel - กระทัดรัด */
    .cart-panel {
        border-left: none;
        border-top: 2px solid var(--color-gray-200);
        overflow: hidden;
    }
    
    .cart-header {
        padding: 0.65rem 0.75rem;
    }
    .cart-header h2 {
        font-size: 1rem;
    }
    
    .cart-items {
        padding: 0.5rem;
        max-height: calc(50vh - 220px); /* ✅ เปลี่ยนจาก 40vh เป็น 50vh */
    }
    
    .cart-item {
        padding: 0.65rem;
        margin-bottom: 0.5rem;
    }
    
    .cart-item-name {
        font-size: 0.875rem;
    }
    
    .btn-remove {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .btn-qty-small {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    
    .item-qty {
        font-size: 0.875rem;
    }
    
    .item-price {
        font-size: 1rem;
    }
    
    /* Cart Item Compact - Mobile */
    .cart-item-compact {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
    }
    
    .item-name {
        font-size: 0.875rem;
    }
    
    .item-qty-unit {
        font-size: 0.8rem;
    }
    
    .btn-qty-inline {
        width: 22px;
        height: 22px;
        font-size: 0.9rem;
    }
    
    .item-price-remove .price {
        font-size: 1rem;
    }
    
    .btn-remove-inline {
        width: 26px;
        height: 26px;
        font-size: 1.1rem;
    }
    
    /* Cart Summary - ซ่อนใน Desktop, แสดงใน Footer Mobile */
    .cart-summary {
        padding: 0.75rem;
    }
    
    .summary-row {
        font-size: 0.875rem;
        margin-bottom: 0.65rem;
    }
    
    .summary-row input {
        width: 80px;
        padding: 0.4rem;
        font-size: 0.875rem;
    }
    
    .summary-row.total {
        font-size: 1.25rem;
    }
    
    /* ซ่อน Cart Actions Desktop */
    .cart-actions {
        display: none;
    }
    
    /* แสดง Footer Mobile */
    .cart-footer-mobile {
        display: block;
    }
    
    /* Modal - ปรับขนาด */
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        padding: 1.25rem;
        max-width: 95%;
    }
    
    .modal-content h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .quantity-controls {
        gap: 0.65rem;
        margin-bottom: 1rem;
    }
    
    .btn-qty {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }
    
    #qty-input {
        width: 100px;
        padding: 0.65rem;
        font-size: 1.25rem;
    }
    
    .unit-selector {
        gap: 0.4rem;
        margin-bottom: 1rem;
    }
    
    .unit-btn {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
    }
    
    .price-input {
        margin-bottom: 1rem;
    }
    
    .price-input input {
        padding: 0.65rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Payment Modal */
    .payment-modal h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .payment-summary {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .amount-row.total {
        font-size: 1.5rem;
    }
    
    .payment-input {
        margin-bottom: 1rem;
    }
    
    .payment-input label {
        font-size: 1rem;
    }
    
    .payment-input input {
        padding: 0.75rem;
        font-size: 1.25rem;
    }
    
    .quick-amounts {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .btn-amount {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .payment-change {
        padding: 1rem;
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .payment-change strong {
        font-size: 1.5rem;
    }
    
    .payment-note {
        margin-bottom: 1rem;
    }
    
    .payment-note input {
        padding: 0.65rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (min-width: 769px) {
    /* Desktop - แสดง user info */
    .user-info {
        display: block;
    }
    
    /* Desktop - ซ่อน Cart Actions แบบเดิม */
    .cart-actions {
        display: none;
    }
    
    /* Desktop - แสดง footer */
    .cart-footer-mobile {
        display: block;
    }
    
    /* Desktop - เว้นที่ให้ POS Container */
    #pos-screen {
        padding-bottom: 90px;
    }
    
    .pos-container {
        height: calc(100vh - 60px - 90px);
    }
}

@media (min-width: 1025px) {
    /* Desktop ใหญ่ - เว้นที่ */
    #pos-screen {
        padding-bottom: 90px;
    }
    
    .pos-container {
        height: calc(100vh - 60px - 90px);
    }
}
