/**
 * ESG POS Styles
 * assets/css/pos-style.css
 */

:root {
    --esg-primary: #10b981;
    --esg-primary-dark: #059669;
    --esg-danger: #ef4444;
    --esg-danger-dark: #dc2626;
    --esg-warning: #f59e0b;
    --esg-info: #3b82f6;
    --esg-secondary: #6b7280;
    --esg-success: #10b981;
    --esg-bg: #f9fafb;
    --esg-card-bg: #ffffff;
    --esg-border: #e5e7eb;
    --esg-text: #111827;
    --esg-text-light: #6b7280;
}

/* Standalone Mode - Hide WordPress UI */
body.esg-pos-standalone #wpadminbar,
body.esg-pos-standalone #adminmenumain,
body.esg-pos-standalone #adminmenuback,
body.esg-pos-standalone .update-nag,
body.esg-pos-standalone #wpfooter {
    display: none !important;
}

body.esg-pos-standalone #wpcontent,
body.esg-pos-standalone #wpbody {
    margin-left: 0 !important;
    padding-left: 0 !important;
}


body.esg-pos-standalone #esg-pos-container {
    margin: 0 !important;
}





/* Screen Management */
.esg-screen {
    display: none;
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
}


.esg-screen.active {
    display: flex;
}




/* Setup Screen */
#esg-pos-setup {
    background: linear-gradient(135deg, var(--esg-primary) 0%, var(--esg-primary-dark) 100%);
    justify-content: center;
    align-items: center;
}

.esg-setup-wrapper {
    text-align: center;
    color: white;
    max-width: 500px;
    width: 90%;
}

.esg-setup-wrapper .esg-logo h1 {
    font-size: 4em;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.esg-setup-wrapper .esg-logo p {
    font-size: 1.5em;
    margin: 0 0 60px 0;
    opacity: 0.9;
}

.esg-setup-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    color: var(--esg-text);
}

.esg-setup-content h2 {
    margin: 0 0 15px 0;
    font-size: 1.8em;
}

.esg-setup-content > p {
    margin: 0 0 30px 0;
    color: var(--esg-text-light);
}

.esg-setup-pin-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0 25px 0;
    padding: 15px;
    background: var(--esg-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.esg-setup-pin-display.active-field {
    background: #e0f2fe;
    border: 2px solid var(--esg-primary);
}

.esg-setup-pin-display .pin-dot {
    width: 18px;
    height: 18px;
    border: 3px solid var(--esg-border);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.esg-setup-pin-display .pin-dot.filled {
    background: var(--esg-primary);
    border-color: var(--esg-primary);
}

.esg-setup-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 30px 0 20px 0;
}

.setup-num-btn {
    width: 100%;
    height: 70px;
    border: 2px solid var(--esg-border);
    background: white;
    border-radius: 10px;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--esg-text);
}

.setup-num-btn:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: scale(1.05);
}

.setup-num-btn:active {
    transform: scale(0.95);
}

.setup-num-btn.setup-clear,
.setup-num-btn.setup-back {
    font-size: 16px;
}

#complete-setup-btn {
    width: 100%;
    margin-top: 10px;
}

#complete-setup-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#complete-setup-btn:disabled:hover {
    transform: none;
}

/* Menu Screen */
#esg-pos-menu {
    background: linear-gradient(135deg, var(--esg-primary) 0%, var(--esg-primary-dark) 100%);
    justify-content: center;
    align-items: center;
}

.esg-menu-wrapper {
    text-align: center;
    color: white;
}

.esg-logo h1 {
    font-size: 4em;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.esg-logo p {
    font-size: 1.5em;
    margin: 0 0 60px 0;
    opacity: 0.9;
}

.esg-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Buttons */
.esg-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
}

.esg-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.esg-btn:active {
    transform: translateY(0);
}

.esg-btn-large {
    min-width: 300px;
    min-height: 70px;
    font-size: 18px;
}

.esg-btn-small {
    padding: 8px 16px;
    min-height: 36px;
    font-size: 14px;
}

.esg-btn-primary {
    background: var(--esg-primary);
    color: white;
}

.esg-btn-primary:hover {
    background: var(--esg-primary-dark);
}

.esg-btn-secondary {
    background: var(--esg-secondary);
    color: white;
}

.esg-btn-success {
    background: var(--esg-success);
    color: white;
}

.esg-btn-danger {
    background: var(--esg-danger);
    color: white;
}

.esg-btn-danger:hover {
    background: var(--esg-danger-dark);
}

.esg-btn-warning {
    background: var(--esg-warning);
    color: white;
}

.esg-btn-info {
    background: var(--esg-info);
    color: white;
}

.esg-btn-cancel {
    background: var(--esg-secondary);
    color: white;
}

.esg-btn-icon {
    padding: 10px;
    min-width: auto;
}

/* Login Screen */
#esg-pos-login {
    justify-content: center;
    align-items: center;
    background: var(--esg-bg);
    padding: 24px;
}

.esg-login-wrapper {
    max-width: 420px;
    width: 90%;
    margin: 0 auto;
}

.esg-pin-pad {
    grid-template-columns: repeat(3, 80px);
    justify-content: center;
}

.esg-login-wrapper h2 {
    margin: 0 0 40px 0;
    color: var(--esg-text);
    font-size: 2em;
}

#login-cancel-btn {
    width: 100%;
    max-width: 270px;
    margin: 0 auto;
    display: block;
}

.esg-pin-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border: 3px solid var(--esg-border);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.pin-dot.filled {
    background: var(--esg-primary);
    border-color: var(--esg-primary);
}


.pin-btn {
    width: 80px;
    height: 80px;
    border: 2px solid var(--esg-border);
    background: white;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}


.pin-btn:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: scale(1.05);
}

.pin-btn:active {
    transform: scale(0.95);
}

/* Float Screen */
#esg-pos-float {
    justify-content: center;
    align-items: center;
    background: var(--esg-bg);
}

.esg-float-wrapper {
    background: var(--esg-card-bg);
    padding: 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 500px;
}

.esg-float-wrapper h2 {
    margin: 0 0 20px 0;
    font-size: 2em;
}

.esg-float-wrapper > p {
    margin: 0 0 40px 0;
    color: var(--esg-text-light);
    font-size: 1.1em;
}

.esg-float-input-wrapper {
    position: relative;
    margin-bottom: 40px;
}

.currency-symbol {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2em;
    color: var(--esg-text-light);
}

#float-amount {
    width: 100%;
    padding: 20px 20px 20px 60px;
    font-size: 2em;
    border: 2px solid var(--esg-border);
    border-radius: 8px;
    text-align: center;
}

.esg-float-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}


.esg-cart-section {
    height: 100%;
}

.esg-cart-item {
  cursor: pointer;
}

.esg-cart-item .cart-item-controls,
.esg-cart-item .cart-item-remove {
  cursor: default;
}

#esg-cart-note-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff7d6;
  border: 1px solid #e2c95c;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#esg-cart-note-indicator:empty {
  display: none;
}

.esg-cart-discount-btn {
    border: 1px solid #d9d9d9;
    background: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: inherit;
    font-weight: 600;
}

.esg-cart-discount-btn:hover {
    background: #f5f5f5;
}

.esg-cart-discount-btn.has-discount {
    background: #fff7d6;
    border-color: #e2c95c;
    color: #7a5b00;
}

#esg-discount-type {
    min-width: 180px;
    width: 180px;
}


/* Main POS Screen */
#esg-pos-main {
    flex: 1;              /* 👈 THIS is missing */
   /* display: flex;*/
    flex-direction: column;
    height: 100%;
}




#esg-pos-main.esg-screen.active {
    display: flex;
    flex-direction: column;
    height: 100vh;
}




.esg-pos-header {
    min-height: 64px;
    padding: 1px 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.esg-header-left,
.esg-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.esg-header-left p {
    margin: 0;
    color: var(--esg-text-light);
    font-size: 1.1em;
}


#current-time {
    font-size: 1.2em;
    color: var(--esg-text-light);
    font-weight: 500;
}

.esg-pos-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Main POS content */
.esg-pos-content {
    flex: 1;
    background: #f8fafc;
    overflow: auto;
}

/* Products Section */
.esg-products-section {
    flex: 1;
    overflow-y: auto;
}
.esg-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#product-search {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--esg-border);
    border-radius: 8px;
    font-size: 16px;
}



.esg-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    align-items: start;
    grid-auto-rows: min-content;
}

.esg-product-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    height: auto;
    box-sizing: border-box;
}

.esg-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--esg-primary);
}

.esg-product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
}

.esg-product-card h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--esg-text);
    min-height: 40px;
}

.esg-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--esg-primary);
}

.esg-product-stock {
    font-size: 12px;
    color: var(--esg-text-light);
    margin-top: 5px;
}

/* Cart Section */
.esg-cart-section {
    background: white;
    border-left: 2px solid var(--esg-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 450px; /* â† ADD THIS */
    width: 100%; /* â† ADD THIS */
}

.esg-cart-header {
    padding: 20px;
    border-bottom: 2px solid var(--esg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esg-cart-header h3 {
    margin: 0;
    font-size: 1.4em;
}

.esg-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.esg-empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: var(--esg-text-light);
}

.esg-empty-cart .dashicons {
    font-size: 80px;
    opacity: 0.3;
    margin-bottom: 15px;
}

.esg-empty-cart p {
    font-size: 1.2em;
}


.esg-cart-totals {
    padding: 20px;
    border-top: 2px solid var(--esg-border);
    border-bottom: 2px solid var(--esg-border);
}




.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1px;
    font-size: 16px;
}

.total-grand {
    font-size: 20px;
    font-weight: 700;
    color: var(--esg-primary);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--esg-border);
}


.esg-cart-actions {
    padding: 12px 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.esg-cart-actions .esg-btn,
#add-customer-btn,
#hold-transaction-btn,
#proforma-btn {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    min-height: 48px !important;
    padding: 8px 6px !important;
    font-size: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    text-align: center !important;
    box-sizing: border-box;
}

#add-customer-btn .dashicons,
#hold-transaction-btn .dashicons,
#proforma-btn .dashicons {
    font-size: 15px !important;
    width: 15px !important;
    height: 15px !important;
}

#proforma-btn,
#retrieve-proforma-btn {
    width: 180px;
    min-width: 180px;
    height: 50px;
}

/*

.esg-cart-actions {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.esg-cart-actions .esg-btn {
    padding: 12px 8px;
    font-size: 13px;
    min-height: 50px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.esg-cart-actions .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

*/


.esg-btn-checkout {
    margin: 20px;
    margin-top: 0;
}

/* Payment Screen */
#esg-pos-payment {
    justify-content: center;
    align-items: center;
    background: var(--esg-bg);
}

.esg-payment-wrapper {
    background: white;
    padding: 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 600px;
}

.esg-payment-wrapper h2 {
    margin: 0 0 30px 0;
    font-size: 2em;
}

.esg-payment-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.8em;
    font-weight: 700;
    padding: 20px;
    background: var(--esg-bg);
    border-radius: 8px;
    margin-bottom: 40px;
    color: var(--esg-primary);
}

.esg-payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.esg-payment-btn {
    padding: 40px 20px;
    border: 3px solid var(--esg-border);
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.esg-payment-btn:hover {
    border-color: var(--esg-primary);
    background: var(--esg-primary);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.esg-payment-btn .dashicons {
    font-size: 60px;
}

.esg-payment-btn span:last-child {
    font-size: 18px;
    font-weight: 600;
}


.spin {
    animation: esg-spin 1s linear infinite;
}

@keyframes esg-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}


/* Settings Screen */
#esg-pos-settings {
    flex-direction: column;
    background: var(--esg-bg);
}

.esg-settings-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.esg-settings-header {
    background: white;
    padding: 20px 30px;
    border-bottom: 2px solid var(--esg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esg-settings-header h2 {
    margin: 0;
    font-size: 1.8em;
}

.esg-settings-tabs {
    background: white;
    padding: 0 30px;
    border-bottom: 2px solid var(--esg-border);
    display: flex;
    gap: 10px;
}

.esg-tab-btn {
    padding: 15px 25px;
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--esg-text-light);
    transition: all 0.3s ease;
}

.esg-tab-btn:hover {
    color: var(--esg-primary);
}

.esg-tab-btn.active {
    color: var(--esg-primary);
    border-bottom-color: var(--esg-primary);
}

.esg-settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.esg-tab-content {
    display: none;
}

.esg-tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--esg-text);
}

.esg-input {
    width: 100%;
    padding: 1px 15px;
    border: 2px solid var(--esg-border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

.esg-input:focus {
    outline: none;
    border-color: var(--esg-primary);
}

/* Employee List */
#employees-list {
    margin-top: 20px;
}

.employee-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 2px solid var(--esg-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.employee-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.employee-info p {
    margin: 0;
    color: var(--esg-text-light);
    font-size: 14px;
}

.employee-actions {
    display: flex;
    gap: 10px;
}

/* Modal */
.esg-modal-overlay {
    padding: 40px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none;
}

.esg-modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.esg-modal {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;  /* ADD THIS */
    margin: auto;        /* ADD THIS */
}

.esg-modal-content {
    padding: 4px;
}

.esg-modal h3 {
    margin: 0 0 30px 0;
    font-size: 2em;
    font-weight: 700;
    color: var(--esg-text);
}



/* Product Modal Specific Styles */
.product-modal-section {
    margin-bottom: 30px;
}

.product-modal-section label {
    display: block;
    font-size: 12px;
    font-weight: 400;
    margin-bottom: 10px;
    color: var(--esg-text);
}

.product-modal-section label strong {
    font-size: 12px;
    margin-left: 8px;
}

/* Quantity Selector - BIGGER */
.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: var(--esg-bg);
    padding: 25px;
    border-radius: 12px;
    border: 3px solid var(--esg-border);
}

.qty-control-btn {
    width: 70px;
    height: 70px;
    border: 3px solid var(--esg-border);
    background: white;
    border-radius: 12px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--esg-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-control-btn:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: scale(1.08);
}

.qty-control-btn:active {
    transform: scale(0.95);
}

.qty-input-wrapper {
    min-width: 120px;
}

.qty-input-wrapper input {
    width: 100%;
    text-align: center;
    font-size: 36px;
    font-weight: bold;
    padding: 15px;
    border: 3px solid var(--esg-border);
    border-radius: 10px;
}

/* Stock Editor */
.stock-editor {
    background: #fffbeb;
    border: 2px solid #fbbf24;
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
}

.stock-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
    color: #92400e;
}

.stock-current {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--esg-text);
}

.stock-current strong {
    font-size: 20px;
    color: var(--esg-primary);
}

#modal-stock-input {
    font-size: 20px;
    padding: 15px;
}

.stock-warning {
    font-size: 13px;
    color: #92400e;
    margin-top: 10px;
    font-weight: 500;
}

.permission-denied {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: 500;
}

/* Modal Actions - BIGGER BUTTONS */
.product-modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 40px;
}

.product-modal-actions .esg-btn {
    flex: 1;
    padding: 20px 25px;
    font-size: 18px;
    font-weight: 700;
    min-height: 65px;
}

.product-modal-actions .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}


.esg-product-modal {
  max-width: 520px;
  padding: 18px;
}

.product-modal-qty-section {
  max-width: 260px;
  margin: 0 auto 12px auto;
}

.quantity-selector {
  max-width: 220px;
  margin: 0 auto;
  gap: 6px;
}

.quantity-selector input,
#modal-qty-input {
  max-width: 70px;
  height: 42px;
  font-size: 18px;
}

.qty-control-btn {
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.product-modal-actions.compact {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px auto 14px auto;
}

.product-modal-actions.compact .esg-btn {
  padding: 10px 16px !important;
  font-size: 14px !important;
  min-width: 120px;
}

.product-modal-actions.compact .dashicons {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
}

/* Reports */
.esg-reports-filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 30px;
}

#reports-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--esg-border);
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--esg-bg);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.summary-card h4 {
    margin: 0 0 10px 0;
    color: var(--esg-text-light);
    font-size: 14px;
    font-weight: 600;
}

.summary-card .amount {
    font-size: 2em;
    font-weight: 700;
    color: var(--esg-primary);
}

/* Responsive */
@media (max-width: 1400px) {
    .esg-pos-body {
        grid-template-columns: 1fr 400px;
    }
}

@media (max-width: 1200px) {
    .esg-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.esg-cart-item {
    animation: slideIn 0.3s ease;
}

/* Loading State */
.esg-loading {
    text-align: center;
    padding: 40px;
    color: var(--esg-text-light);
}

.esg-loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}




.esg-drawer-modal {
    width: min(1100px, 95vw);
    min-width: 0;
    max-width: 95vw;
    background: #fff;
    border-radius: 14px;
    padding: 18px 18px 14px;
    box-sizing: border-box;
}

.esg-drawer-table-wrap {
    overflow-x: auto;
}

.esg-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.esg-drawer-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}



.esg-drawer-table {
    width: max-content;   /* table defines width */
    min-width: 1100px;    /* professional POS width */
    border-collapse: collapse;
}


.esg-drawer-modal { padding: 18px; }
.esg-drawer-header h2 { margin: 0 0 6px 0; font-size: 20px; }
.esg-drawer-sub { color: #6b7280; font-size: 13px; margin-bottom: 14px; }


.esg-drawer-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #fff;
}

.esg-drawer-table th, .esg-drawer-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}

.esg-drawer-table thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
  text-align: left;
  font-weight: 700;
  color: #111827;
}

.esg-drawer-table td .esg-input {
  width: 100%;
  min-width: 140px;
  padding: 8px 10px;
  font-size: 13px;
}

.esg-drawer-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    width: 100%;
}

.esg-drawer-table-wrap {
    overflow-x: auto;
}

.esg-drawer-modal {
    max-width: 95vw;
}

.esg-drawer-table tr.saved {
  outline: 2px solid rgba(16,185,129,0.35);
}

 



/* Cash Tendering Modal */
.esg-cash-tendering {
    width: 100%;
}

.esg-cash-tendering h2 {
    color: var(--esg-text);
    font-weight: 700;
}

/* Tender Input - Larger */
#cash-tender-input {
    text-align: center;
}

#cash-tender-input::placeholder {
    color: #d1d5db;
}

#cash-tender-input:focus {
    outline: none;
    border-color: var(--esg-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Change Display - Fixed Position, Always Visible */
#change-display {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tender Numpad - MUCH LARGER for touchscreen */
.tender-num-btn {
    height: 100px;
    font-size: 36px;
    font-weight: 700;
    background: white;
    border: 3px solid var(--esg-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--esg-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tender-num-btn:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tender-num-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Quick Amount Buttons - Larger */
.quick-amount {
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
}

.quick-amount:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quick-amount:active {
    transform: translateY(0);
}

/* Complete Payment Button - LARGE and prominent */
#complete-cash-payment {
    background: var(--esg-success);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#complete-cash-payment:hover {
    background: var(--esg-primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

#complete-cash-payment:active {
    transform: translateY(0);
}

/* Cancel Button */
#cancel-cash-tender {
    background: white;
    color: var(--esg-text);
    border: 3px solid var(--esg-border);
    transition: all 0.15s ease;
}

#cancel-cash-tender:hover {
    background: var(--esg-bg);
    border-color: var(--esg-danger);
    color: var(--esg-danger);
    transform: translateY(-2px);
}

#cancel-cash-tender:active {
    transform: translateY(0);
}

/* Responsive Design for Smaller Screens */
@media (max-width: 1200px) {
    .esg-cash-tendering h2 {
        font-size: 28px;
    }
    
    .tender-num-btn {
        height: 85px;
        font-size: 32px;
    }
}

@media (max-width: 992px) {
    .esg-modal {
        max-width: 95%;
        padding: 30px;
    }
    
    /* Stack columns on smaller screens */
    .esg-cash-tendering > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .tender-num-btn {
        height: 75px;
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .esg-modal {
        padding: 20px;
        max-height: 98vh;
    }
    
    .esg-cash-tendering h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .tender-num-btn {
        height: 65px;
        font-size: 24px;
    }
    
    #cash-tender-input {
        font-size: 32px;
    }
    
    #change-amount {
        font-size: 42px;
    }
}

/* Smooth transitions for change display color changes */
#change-display, #change-amount, #change-label {
    transition: all 0.3s ease;
}

/* Focus state for accessibility */
.tender-num-btn:focus,
#complete-cash-payment:focus,
#cancel-cash-tender:focus {
    outline: 3px solid var(--esg-primary);
    outline-offset: 2px;
}

/* Improve button touch feedback on mobile */
@media (hover: none) and (pointer: coarse) {
    .tender-num-btn:active {
        background: var(--esg-primary);
        color: white;
    }
}


.esg-customer-row {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.esg-customer-row:hover,
.esg-customer-row.active {
    background: #f2f7ff;
}



.esg-customer-row {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.esg-customer-row:hover {
    background: #f5f7fa;
}

#esg-customer-view {
    position: fixed;
    inset: 0;                 /* top:0 right:0 bottom:0 left:0 */
    background: #ffffff;
    z-index: 100000;          /* higher than menu & POS */
    overflow-y: auto;
    display: none;
}

#esg-customer-view.active {
    display: block;
}


.esg-customer-wrapper {
    margin-top: 0;
    background: #fff;
    max-width: 900px;
    
    padding: 12px;
    border-radius: 8px;
}

#esg-customer-list {
    margin-top: 8px;
}

.esg-customer-wrapper h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.customer-item:first-child {
    margin-top: 0;
}



/*
 * UPDATED CART STYLES - Single Line, Larger Buttons & Fonts
 * Replace or add to your pos-style.css file
 */
 
 .esg-cart-customer {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

 
 

/* Cart Item - SINGLE LINE LAYOUT */
.esg-cart-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1px 1px !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    margin-bottom: 10px !important;
    gap: 6px !important;
    min-height: 65px !important;
}



.esg-cart-item:hover {
    border-color: #d1d5db !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Product Name - Takes available space */
.cart-item-name {
    flex: 1 1 auto !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    line-height: 1.0 !important;
    max-width: 220px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
}


.cart-item-left {
    display: flex;
    flex-direction: column;
    flex: 1;
}
/*
.discount-row {
    display: flex;
    gap: 8px;
    font-size: 11px;
    margin-top: 4px;
}
*/

.discount-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-size: 11px;
    margin-top: 4px;
}
/*
.discount-badge {
    color: #15803d;
    font-weight: 700;
}

.discount-savings {
    color: #166534;
    font-weight: 600;
}
*/

.discount-badge {
    color: #15803d;
    font-weight: 700;
    display: block;
}

.discount-savings {
    color: #166534;
    font-weight: 600;
    display: block;
    margin-left: 0;
}


.esg-cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}




.esg-cart-item.has-discount {
  border-left: 4px solid #2ecc71;
}



/* Quantity Controls Container */
.cart-item-controls {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: #f9fafb !important;
    padding: 4px 5px !important;
    border-radius: 6px !important;
    border: 1px solid #e5e7eb !important;
    flex-shrink: 0 !important;
}

/* Plus/Minus Buttons - LARGE */
.qty-btn {
    width: 42px !important;
    height: 42px !important;
    border: 2px solid #d1d5db !important;
    background: white !important;
    border-radius: 6px !important;
    font-size: 4px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.qty-btn:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.qty-btn:active {
    transform: scale(0.95) !important;
}

/* Minus Button */
.qty-minus {
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
    background: #fef2f2 !important;
    margin-left: 4px !important;
}

.qty-minus:hover {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
}

.cart-item-controls {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}




/* Plus Button */
.qty-plus {
    color: #10b981 !important;
    border-color: #6ee7b7 !important;
    background: #f0fdf4 !important;
}

.qty-plus:hover {
    background: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
}

/* Quantity Display */
.qty-display {
    min-width: 32px !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    padding: 0 8px !important;
}

/* Total Price - LARGE */
.cart-item-total {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    min-width: 75px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}

/* Remove Button - LARGE */
.cart-item-remove {
    width: 42px !important;
    height: 42px !important;
    border: 2px solid #fca5a5 !important;
    background: #fef2f2 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.cart-item-remove:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    transform: scale(1.08) !important;
}

.cart-item-remove:hover .dashicons {
    color: white !important;
}

.cart-item-remove .dashicons {
    color: #ef4444;
    font-size: 26px;
    width: 26px;
    height: 26px;
    transition: color 0.15s ease;
}

.cart-item-remove:active {
    transform: scale(0.95) !important;
}

/* Empty Cart */
.esg-empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.esg-empty-cart .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.esg-empty-cart p {
    font-size: 18px;
    margin: 0;
}

/* Tablet Screens */
@media (min-width: 768px) and (max-width: 1024px) {
    .qty-btn {
        width: 60px;
        height: 60px;
        font-size: 34px;
    }
    
    .cart-item-name {
        font-size: 18px;
    }
    
    
    
    .cart-item-total {
        font-size: 24px;
    }
    
    .cart-item-remove {
        width: 55px;
        height: 55px;
    }
}

/* Mobile Screens */
@media (max-width: 767px) {
    .esg-cart-item {
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px;
    }
    
    .cart-item-name {
        flex: 1 1 100%;
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .cart-item-controls {
        flex: 1;
    }
    
    .cart-item-total {
        flex: 1;
        text-align: center;
        font-size: 22px;
        min-width: auto;
    }
    
    .cart-item-remove {
        flex: 0 0 auto;
    }
    
    .qty-btn {
        width: 55px;
        height: 55px;
        font-size: 32px;
    }
    
    .qty-display {
        font-size: 24px;
    }
}

/* Large Screens (Extra large buttons) */
@media (min-width: 1200px) {
    .qty-btn {
        width: 70px;
        height: 70px;
        font-size: 42px;
    }
    
    .cart-item-remove {
        width: 65px;
        height: 65px;
    }
    
.cart-item-remove .dashicons {
    color: #ef4444 !important;
    font-size: 20px !important;
    width: 20px !important;
    height: 20px !important;
}
   /* 
    .qty-display {
        font-size: 32px;
        min-width: 60px;
    }
  */
  
    .cart-item-name {
        font-size: 22px;
    }
    
    .cart-item-total {
        font-size: 28px;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .qty-btn {
        width: 70px;
        height: 70px;
        font-size: 40px;
    }
    
    .cart-item-remove {
        width: 65px;
        height: 65px;
    }
    
    .qty-display {
        font-size: 30px;
    }
}

/* Focus States for Accessibility */
.qty-btn:focus,
.cart-item-remove:focus {
    outline: 3px solid #10b981;
    outline-offset: 2px;
}

/* Menu Toggle Button (in Header) */
.esg-menu-toggle-header {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    z-index: 1000;
}

.esg-menu-toggle-header:hover {
    background: var(--esg-primary);
    color: white;
    border-color: var(--esg-primary);
    transform: scale(1.05);
}

.esg-menu-toggle-header .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Header layout with hamburger */
.esg-header-left {
    display: flex;
    align-items: center;
}

.esg-header-info h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.1;
}


.esg-header-info p {
    margin: 2px 0 0;
    font-size: 0.95rem;
}


.esg-submenu-header,
.esg-menu-toggle-header,
#menu-toggle-btn,
.submenu-title {
    display: none !important;
}

.esg-header-text p {
    margin: 0;
}

/* ==================== MENU MODAL (REPLACES SLIDING MENU) ==================== */

#esg-menu-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    z-index: 1000000;
    pointer-events: auto;
}


#esg-menu-modal-overlay.active {
    transform: translateX(0);
}


.esg-menu-modal {
    display: flex;
    height: 100vh;
    background: #0f172a;
}


.esg-menu-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}



.esg-submenu-greeting {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.esg-submenu-greeting h3 {
    margin: 0;
    font-size: 16px;
    color: #e5e7eb;
}

.esg-submenu-greeting p {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}


.esg-submenu-header {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 16px;
}

.esg-submenu-header .esg-menu-toggle-header {
    all: unset;
    cursor: pointer;
    color: #e5e7eb;
}

.esg-submenu-header .dashicons {
    font-size: 22px;
}

.esg-submenu-header h2 {
    margin: 0;
    font-size: 16px;
    color: #e5e7eb;
}

.esg-submenu-header p {
    margin: 0;
    font-size: 13px;
    color: #9ca3af;
}

.esg-submenu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}





/* DEFAULT: submenu hidden */
.esg-pos-submenu {
    display: flex !important;
    visibility: visible !important;
    flex-direction: column;
    width: 260px;
    background: #0f172a;
}


/* VISIBLE STATE */
.esg-pos-submenu.active {
    display: flex !important;
    visibility: visible;
   
}


.submenu-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 8px;
}

.esg-pos-submenu button {
    width: auto;           /* 👈 NOT 100vw */
    max-width: 100%;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 14px 16px;
    margin-bottom: 8px;

    flex: 0 0 auto;        /* 👈 IMPORTANT */
}







.esg-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #2271b1;
    color: white;
}

.esg-menu-header h3 {
    margin: 0;
    font-size: 20px;
}

.esg-menu-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    font-size: 24px;
}

.esg-menu-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.esg-menu-close:hover {
    opacity: 0.8;
}

/* Menu Tabs - Horizontal for modal */
.esg-menu-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f5f5f5;
    padding: 0 20px;
}

.esg-menu-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    transition: all 0.2s ease;
}

.esg-menu-tab:hover {
    background: #e8e8e8;
}

.esg-menu-tab.active {
    background: white;
    border-bottom-color: #2271b1;
    font-weight: 600;
    color: #2271b1;
}

.esg-menu-tab .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Menu Content */
.esg-menu-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.esg-menu-tab-content {
    display: none;
}

.esg-menu-tab-content.active {
    display: block;
}

/* Transaction Filters */
.esg-transaction-filters {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-row {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-row label {
    font-weight: 600;
    min-width: 80px;
}

.filter-row input,
.filter-row select {
    flex: 1;
}

/* Transaction List */
.esg-transaction-list {
    max-height: 500px;
    overflow-y: auto;
}

.esg-transaction-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.esg-transaction-item:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.transaction-order-number {
    font-weight: 600;
    font-size: 16px;
    color: #2271b1;
}

.transaction-amount {
    font-size: 18px;
    font-weight: 700;
    color: #10b981;
}

.transaction-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #666;
}

.transaction-meta {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.transaction-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.transaction-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.transaction-actions .esg-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
}

/* Loading State */
.esg-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Pagination */
.esg-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.esg-pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.esg-pagination button:hover {
    background: #f5f5f5;
}

.esg-pagination button.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.esg-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ============================================
   BARCODE SCANNER FEEDBACK STYLES
   ============================================ */

/* Barcode Scanner Feedback Messages */
.barcode-feedback {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    z-index: 999999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: slideDownFade 0.3s ease;
}

.barcode-success {
    background: #10b981;
    color: white;
}

.barcode-error {
    background: #ef4444;
    color: white;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Focus States for Barcode Scanner Visibility */
.esg-product-card:focus-within {
    outline: 3px solid var(--esg-primary);
    outline-offset: 2px;
}






#esg-pos-container {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


.esg-pos-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 72px);
    flex-direction: row;
    overflow: hidden;
}


#esg-pos-container.menu-active #esg-pos-main {
    transition: none;
}



#esg-pos-main {
    flex: 1;
    min-width: 0;
    transition: none;
}


body.esg-pos-page header,
body.esg-pos-page footer,
body.esg-pos-page .header,
body.esg-pos-page .footer,
body.esg-pos-page .header-wrapper,
body.esg-pos-page .footer-wrapper {
    display: none !important;
}





.esg-pos-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 16px;
    height: calc(100vh - 64px);
    padding: 12px 16px 16px;
    box-sizing: border-box;
}

.esg-products-section,
.esg-cart-section {
    min-height: 0;
}

.esg-cart-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.esg-cart-header,
.esg-cart-note-preview,
.esg-cart-totals,
.esg-cart-actions,
.esg-cart-footer {
    flex: 0 0 auto;
}

.esg-cart-items {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.esg-search-bar {
    margin-bottom: 10px;
}

.esg-product-grid {
    height: calc(100% - 60px);
    overflow-y: auto;
}



#add-customer-btn,
#hold-transaction-btn,
#proforma-btn {
    min-width: 110px !important;
    max-width: 110px !important;
    min-height: 55px !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    text-align: center !important;
}

#add-customer-btn .dashicons,
#hold-transaction-btn .dashicons,
#proforma-btn .dashicons {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
}
.esg-cart-section {
    padding-bottom: 16px;
}


#esg-network-status {
    cursor: pointer;
    font-weight: 600;
}

.esg-sync-row {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
}

.esg-pos-layout {
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

.esg-cart-section {
  height: 100% !important;
  max-height: 100dvh !important;
  min-height: 0 !important;

  display: grid !important;
  grid-template-rows: auto auto 1fr auto auto !important;
  overflow: hidden !important;
}


.esg-cart-items {
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 8px !important;
    scroll-padding-bottom: 12px;
}

.esg-cart-actions {
  position: relative !important;
  bottom: auto !important;

  display: flex !important;
  gap: 8px !important;
  align-items: center !important;

  background: #fff !important;
  z-index: 20 !important;

  padding: 8px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.esg-cart-actions .esg-btn,
#esg-add-note-btn,
#clear-cart-btn {
  min-height: 38px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
}

.cart-totals,
.esg-cart-totals {
  flex-shrink: 0 !important;
  padding: 8px !important;
}

.total-grand {
  min-height: 46px !important;
  padding: 10px !important;
}

.esg-cart-header,
.esg-cart-customer-row {
  padding: 8px !important;
  margin-bottom: 6px !important;
}


#esg-modal-overlay {
  z-index: 999999;
}

#esg-customer-view {
  z-index: 9999;
}


.esg-drawer-table th,
.esg-drawer-table td {
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.2;
  vertical-align: middle;
}

.esg-drawer-table .esg-btn-small {
  padding: 4px 7px;
  font-size: 12px;
  min-height: 0;
  line-height: 1.1;
}

.esg-drawer-table td:last-child {
  white-space: nowrap;
}

.esg-debtors-wide {
    width: 95vw;
    max-width: 1800px;
    height: 85vh;
    max-height: 900px;
    overflow: auto;
}

.esg-debtors-wide .esg-drawer-table {
    width: 100%;
    table-layout: auto;
}

.esg-debtors-wide .esg-drawer-table-wrap {
    overflow-x: visible;
}

.esg-brought-forward-row {
  background: #fff7d6;
  font-weight: 600;
}

.esg-statement-period-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.esg-statement-period-actions input {
  max-width: 220px;
}

.esg-receipt-subtabs {
    display:flex;
    gap:10px;
    margin-bottom:15px;
}

.esg-receipt-subtab {
    padding:8px 15px;
    cursor:pointer;
}

.esg-receipt-subtab.active {
    font-weight:bold;
}

#esg-modal-overlay:has(.esg-debtors-wide) .esg-modal {
  width: 98vw !important;
  max-width: 98vw !important;
  height: 92vh !important;
  max-height: 92vh !important;
  resize: horizontal;
  overflow: auto !important;
}

#esg-modal-overlay:has(.esg-debtors-wide) .esg-modal-content {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  overflow: auto !important;
  box-sizing: border-box;
}

.esg-debtors-wide {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  overflow: auto !important;
}

#esg-modal-overlay:has(.esg-drawer-modal) .esg-modal {
  width: 98vw !important;
  max-width: 98vw !important;
  height: 92vh !important;
  max-height: 92vh !important;
  resize: both;
  overflow: auto !important;
}

#esg-modal-overlay:has(.esg-drawer-modal) .esg-modal-content {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  overflow: auto !important;
  box-sizing: border-box;
  padding: 10px !important;
}

#esg-modal-overlay:has(.esg-drawer-modal) {
  padding: 8px !important;
}

.esg-drawer-modal {
  width: 100% !important;
  max-width: none !important;
}

.esg-drawer-table-wrap {
  width: 100%;
  overflow-x: auto;
}

#esg-modal-overlay {
  z-index: 9999999 !important;
}

#esg-customer-view {
  z-index: 9999 !important;
}

/* =========================================================
   Stage 1 debtor FIFO aging
   ========================================================= */

.esg-aging-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.esg-aging-summary > div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.esg-aging-summary strong,
.esg-aging-summary span {
  display: block;
}

.esg-aging-summary strong {
  color: #111827;
  font-size: 17px;
  line-height: 1.3;
}

.esg-aging-summary span {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.esg-aging-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.esg-aging-paid,
.esg-aging-current {
  background: #dcfce7;
  color: #166534;
}

.esg-aging-due-soon {
  background: #fef3c7;
  color: #92400e;
}

.esg-aging-overdue {
  background: #fee2e2;
  color: #b91c1c;
}

.esg-aging-critical {
  background: #7f1d1d;
  color: #ffffff;
}

.esg-debtor-row-overdue {
  background: #fff7f7;
}

.esg-debtor-row-critical {
  background: #fef2f2;
  box-shadow: inset 4px 0 0 #991b1b;
}

.esg-overdue-amount {
  font-weight: 700;
}

.esg-debtors-aging-table {
  min-width: 1320px;
}

@media (max-width: 800px) {
  .esg-aging-summary {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

/* =========================================================
   Incoming payment parser
   ========================================================= */

.esg-incoming-payments-stage-one {
  max-width: 980px;
}

.esg-payment-test-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: #ffffff;
}

.esg-payment-test-card h4 {
  margin: 0 0 12px;
}

.esg-payment-test-table {
  width: 100%;
  border-collapse: collapse;
}

.esg-payment-test-table th,
.esg-payment-test-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}

.esg-payment-test-table th {
  width: 180px;
  color: #475569;
}

.esg-payment-match-success {
  border-left: 5px solid #15803d;
  background: #f0fdf4;
}

.esg-payment-match-warning {
  border-left: 5px solid #d97706;
  background: #fffbeb;
}

.esg-payment-test-error {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 600;
}

.esg-payment-test-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #f59e0b;
  border-radius: 7px;
  background: #fffbeb;
  color: #92400e;
  font-weight: 600;
}

/* =========================================================
   Incoming Payments review queue
   ========================================================= */

.esg-incoming-payments-module {
  width: 100%;
}

.esg-incoming-payments-header,
.esg-incoming-queue-toolbar,
.esg-payment-import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.esg-incoming-payments-header {
  margin-bottom: 16px;
}

.esg-incoming-payments-header h3,
.esg-incoming-queue-toolbar h4 {
  margin: 0;
}

.esg-payment-import-panel,
.esg-incoming-queue-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #ffffff;
}

.esg-payment-import-panel h4 {
  margin-top: 0;
}

.esg-payment-import-actions {
  justify-content: flex-start;
}

.esg-incoming-queue-toolbar {
  margin-bottom: 12px;
}

#esg-incoming-payment-status-filter {
  width: auto;
  min-width: 170px;
}

.esg-incoming-payment-table {
  min-width: 1180px;
}

.esg-incoming-payment-table td small {
  display: block;
  margin-top: 3px;
  color: #64748b;
}

.esg-incoming-status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.esg-incoming-status-new {
  background: #e2e8f0;
  color: #334155;
}

.esg-incoming-status-matched {
  background: #dcfce7;
  color: #166534;
}

.esg-incoming-status-review_required {
  background: #fef3c7;
  color: #92400e;
}

.esg-incoming-status-posted {
  background: #dbeafe;
  color: #1d4ed8;
}

.esg-incoming-status-error {
  background: #fee2e2;
  color: #991b1b;
}

.esg-incoming-error {
  max-width: 240px;
  margin-top: 6px;
  color: #991b1b;
  font-size: 12px;
}

.esg-payment-needs-match {
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
}

.esg-payment-posted-text {
  color: #166534;
  font-weight: 700;
}

/* Multi-invoice incoming payments */

.esg-incoming-invoice-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.esg-incoming-lines-row td {
  padding: 0 !important;
  background: #f8fafc;
}

.esg-incoming-lines-panel {
  padding: 14px 18px;
  border-left: 4px solid #64748b;
}

.esg-incoming-lines-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.esg-incoming-invoice-line {
  padding: 10px 0;
  border-top: 1px solid #e2e8f0;
}

.esg-incoming-invoice-line > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.esg-incoming-line-meta {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.esg-line-match-success {
  margin-top: 5px;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.esg-line-match-error {
  margin-top: 5px;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.esg-payment-test-line {
  display: grid;
  grid-template-columns: minmax(110px, 1fr)
                         minmax(90px, auto)
                         minmax(180px, 2fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #e2e8f0;
}

/* =========================================================
   Incoming Payment review modal
   ========================================================= */

.esg-incoming-review-modal {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

/*
 * Allow the Incoming Payment review modal to use nearly
 * the full browser width.
 */
#esg-modal-overlay:has(.esg-incoming-review-modal) {
  padding: 8px !important;
  align-items: center;
}

#esg-modal-overlay:has(.esg-incoming-review-modal) .esg-modal {
  width: 98vw !important;
  max-width: 98vw !important;

  height: 94vh !important;
  max-height: 94vh !important;

  margin: auto !important;
  overflow: hidden !important;
  box-sizing: border-box;
}

#esg-modal-overlay:has(.esg-incoming-review-modal)
.esg-modal-content {
  width: 100% !important;
  max-width: none !important;

  height: 100% !important;
  max-height: none !important;

  padding: 10px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;

  box-sizing: border-box;
}

.esg-incoming-review-summary {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.esg-incoming-review-summary > div {
  padding: 12px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: #f8fafc;
}

.esg-incoming-review-summary span,
.esg-incoming-review-summary strong,
.esg-incoming-review-summary small {
  display: block;
}

.esg-incoming-review-summary span {
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
}

.esg-incoming-review-summary strong {
  color: #111827;
  font-size: 15px;
}

.esg-incoming-review-summary small {
  margin-top: 3px;
  color: #64748b;
}

.esg-incoming-review-section {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #ffffff;
}

.esg-incoming-review-section h3 {
  margin: 0 0 12px;
}

.esg-incoming-review-lines {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.esg-incoming-review-lines th,
.esg-incoming-review-lines td {
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.esg-incoming-review-lines th:nth-child(1) {
  width: 44px;
}

.esg-incoming-review-lines th:nth-child(2) {
  width: 110px;
}

.esg-incoming-review-lines th:nth-child(3) {
  width: 105px;
}

.esg-incoming-review-lines th:nth-child(4) {
  width: 105px;
}

.esg-incoming-review-lines th:nth-child(6) {
  width: 90px;
}

.esg-incoming-review-lines th:nth-child(8) {
  width: 90px;
}

.esg-incoming-review-lines th:nth-child(9) {
  width: 135px;
}

.esg-incoming-review-modal .esg-drawer-table-wrap {
  width: 100%;
  overflow-x: visible;
}

.esg-incoming-review-lines td small {
  display: block;
  margin-top: 3px;
  color: #64748b;
}

.esg-incoming-validation-grid {
  display: grid;
  grid-template-columns:
    repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.esg-incoming-validation-grid > div {
  padding: 12px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
}

.esg-incoming-validation-grid span,
.esg-incoming-validation-grid strong {
  display: block;
}

.esg-incoming-validation-grid span {
  color: #64748b;
  font-size: 12px;
}

.esg-incoming-validation-grid strong {
  margin-top: 4px;
}

.esg-incoming-validation-grid .is-valid {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.esg-incoming-validation-grid .is-invalid {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.esg-incoming-review-actions,
.esg-incoming-action-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.esg-incoming-review-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .esg-incoming-review-summary {
    grid-template-columns:
      repeat(2, minmax(150px, 1fr));
  }

  .esg-incoming-validation-grid {
    grid-template-columns:
      repeat(2, minmax(130px, 1fr));
  }
}

@media (max-width: 600px) {
  .esg-incoming-review-summary,
  .esg-incoming-validation-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Incoming invoice-line editor
   ========================================================= */

.esg-incoming-line-editor {
  width: min(720px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
}

.esg-incoming-line-editor .form-group {
  margin-bottom: 14px;
}

.esg-incoming-line-editor label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.esg-incoming-line-editor textarea {
  resize: vertical;
}

/* =========================================================
   Manual incoming-payment debtor assignment
   ========================================================= */

.esg-incoming-debtor-assignment {
  width: min(900px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
}

.esg-incoming-debtor-results-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.esg-incoming-debtor-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;

  width: 100%;
  padding: 11px 12px;

  border: 1px solid #dbe3ec;
  border-radius: 8px;

  background: #ffffff;
  color: #111827;

  text-align: left;
  cursor: pointer;
}

.esg-incoming-debtor-result:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.esg-incoming-debtor-result.selected {
  border-color: #16a34a;
  background: #f0fdf4;
}

.esg-incoming-debtor-result span,
.esg-incoming-debtor-result strong,
.esg-incoming-debtor-result small {
  display: block;
}

.esg-incoming-debtor-result small {
  margin-top: 3px;
  color: #64748b;
}

.esg-incoming-selected-debtor {
  margin: 12px 0;
  padding: 12px;

  border: 1px solid #86efac;
  border-radius: 8px;

  background: #f0fdf4;
  color: #166534;
}

.esg-incoming-line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* =========================================================
   Incoming-payment manual-review audit
   ========================================================= */

.esg-manual-match-label {
  display: block;
  margin-top: 4px;
  color: #92400e;
  font-weight: 600;
}

.esg-manual-review-note {
  display: block;
  margin-top: 5px;
  padding: 5px 7px;

  border-left: 3px solid #d97706;
  border-radius: 3px;

  background: #fffbeb;
  color: #78350f;

  line-height: 1.35;
}

.esg-manual-review-banner {
  margin: 12px 0;
  padding: 12px 14px;

  border: 1px solid #f59e0b;
  border-radius: 8px;

  background: #fffbeb;
  color: #78350f;
}

.esg-manual-review-banner.error {
  border-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}

.esg-manual-review-banner strong,
.esg-manual-review-banner small {
  display: block;
}

.esg-manual-review-banner small {
  margin-top: 5px;
  opacity: 0.85;
}

.esg-incoming-status-ignored {
  background: #e2e8f0;
  color: #475569;
}

.esg-incoming-status-duplicate {
  background: #f3e8ff;
  color: #7e22ce;
}

.esg-payment-ignored-text {
  color: #475569;
  font-weight: 700;
}

.esg-payment-duplicate-text {
  color: #7e22ce;
  font-weight: 700;
}

.esg-incoming-disposition-modal {
  width: min(680px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
}

/* Incoming payment line review statuses — Stage 2 */
.esg-line-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.esg-line-status-matched { background: rgba(34, 197, 94, .12); color: #166534; }
.esg-line-status-review { background: rgba(245, 158, 11, .14); color: #92400e; }
.esg-line-status-posted { background: rgba(59, 130, 246, .12); color: #1d4ed8; }
