/* Invoice Editor - Compact Premium Design */

.invoice-editor-wrapper {
    background: #f0f2f5;
    width: 100%;
    /* overflow: hidden; */
    /* Prevent body/wrapper scroll */
    display: flex;
    flex-direction: column;
    overflow: clip;
    /* Safeguard against horizontal scroll without breaking sticky */
    font-family: var(--font-body);
    padding-bottom: 0;
    /* Increased to prevent footer overlap */
}



/* Invoice Type Selector - Premium Dashboard Style */
.invoice-type-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.payment-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
}

.toggle-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.75rem;
}

.toggle-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.825rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-btn:hover {
    color: #b10d0d;
}

.toggle-btn.active {
    background: #ffffff;
    color: #b10d0d;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.invoice-type-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Invoice Form Container - Compact */
.invoice-form-container {
    flex: 1;
    padding: 0rem;
    /* overflow-y: auto; */
    /* max-width: 1600px; */
    margin: 0 0 0.55rem 0;
    width: 100%;
}

.invoice-header-section {
    /* background: white; */
    /* padding: 1rem; */
    /* border-radius: 8px; */
    margin-bottom: 0.55rem;
    /* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); */
    /* border: 1px solid rgba(0, 0, 0, 0.02); */
}

.header-columns {
    display: flex;
    gap: 1.5rem;
}

.header-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-title {
    font-size: 0.82rem;
    font-weight: 850;
    color: #64748b;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: #ffffff;
    border-radius: 8px;
    width: fit-content;
    border: 1px solid #f1f5f9;
}

.section-title i {
    color: #b10d0d;
    font-size: 0.85rem;
}

.transport-toggle-header {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    /* Slightly reduced radius */
    padding: 0.5rem 0.75rem;
    /* Reduced padding */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    min-height: auto;
    /* Allow auto height */
}

.transport-toggle-header:hover {
    transform: translateY(-1px);
    /* More subtle hover */
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Lighter shadow */
    background: #fafafa;
}

.transport-icon-box {
    width: 28px;
    /* Reduced from 36px */
    height: 28px;
    /* Reduced from 36px */
    background: rgba(239, 119, 34, 0.1);
    color: #b10d0d;
    border-radius: 6px;
    /* Adjusted radius */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.transport-toggle-header:hover .transport-icon-box {
    background: #b10d0d;
    color: #ffffff;
    transform: rotate(0deg);
    /* Removed rotation for simpler feel */
}

.transport-toggle-title {
    font-size: 0.82rem;
    /* Reduced from 0.75rem */
    font-weight: 700;
    /* Slightly less heavy */
    color: #334155;
    /* Slightly softer dark */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.header-col .form-check-input {
    background-color: #cbd5e1;
    border-color: #cbd5e0;
    cursor: pointer;
}

.header-col .form-check-input:checked {
    background-color: #b10d0d;
    border-color: #b10d0d;
}

.client-details {
    padding-right: 0.75rem;
}

@media (max-width: 992px) {
    .header-columns {
        flex-direction: column;
        gap: 1rem;
    }

    .client-details {
        padding-right: 0;
        border-bottom: 1px solid #f1f5f9;
        padding-bottom: 1rem;
    }
}

/* Payment Status Fields (Received/Balance) */
.payment-status-badge {
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1.5px solid #edf2f7;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 42px;
    /* Matches typical input height */
    height: 100%;
    /* Ensure it fills container if needed */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

/* Force Equal Dimensions for Payment Inputs */

.payment-status-badge {
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
}



.payment-status-badge.balance-due {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #c53030;
}

.payment-status-badge.paid-in-full {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #276749;
}

.balance-amount-text {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.form-group-invoice {
    display: flex;
    flex-direction: column;
    /* gap: 0.35rem; */
    position: relative;
}

.form-group-invoice label {
    font-size: 0.62rem;
    font-weight: 450;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.form-group-invoice:focus-within label {
    color: #3b3a39;
    transform: translateX(5px);
}

.form-group-invoice input:not([type="checkbox"]):not([type="radio"]),
.form-group-invoice select,
.form-group-invoice textarea {
    padding: 0.55rem 0.85rem;
    border: 1.5px solid #b5b5b5;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: #ffffff;
    color: #1a202c;
    width: 100%;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.form-group-invoice select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23EF7722'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 3rem;
}

.form-group-invoice textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-group-invoice input:not([type="checkbox"]):not([type="radio"]):hover,
.form-group-invoice select:hover,
.form-group-invoice textarea:hover {
    border-color: #cbd5e0;
    background: #ffffff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.form-group-invoice input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group-invoice select:focus,
.form-group-invoice textarea:focus {
    outline: solid 2px #8e8e8e;
    border: 1px solid #8e8e8e !important;
    background: #ffffff;
    box-shadow: none !important;
    transform: translateY(0);
}

.editor-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.editor-search-icon {
    position: absolute;
    left: 0.85rem;
    color: #94a3b8;
    z-index: 5;
    font-size: 0.85rem;
}

.editor-input-actions {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.25rem;
    align-items: center;
    z-index: 10;
}

.editor-scan-btn,
.editor-add-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.75rem;
}

.editor-scan-btn {
    background: #eff6ff;
    color: #3b82f6;
}

.editor-scan-btn:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.05);
}

.editor-add-btn {
    background: #ecfdf5;
    color: #10b981;
}

.editor-add-btn:hover {
    background: #10b981;
    color: white;
    transform: scale(1.05);
}

.editor-input-actions button:active {
    transform: scale(0.95);
}

/* Ensure input doesn't overlap with actions */
.editor-search-field {
    padding-right: 70px !important;
}

/* OLD SUGGESTIONS STYLE REMOVED/COMMENTED OUT
.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestion-item {
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 2px;
    border-bottom: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.suggestion-item strong,
.suggestion-item .fw-bold {
    color: #1e293b;
    font-size: 0.82rem;
}

/* Soft Badge Utilities */
.bg-soft-info {
    background-color: rgba(11, 166, 223, 0.1) !important;
}

.text-info {
    color: rgb(11, 166, 223) !important;
}

.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.suggestion-item small,
.extra-small {
    color: #64748b;
    font-size: 0.82rem !important;
    margin-top: 1px;
}

#address-fields {
    transition: all 0.3s ease;
    /* border-left: 4px solid #6366f1 !important; */
}

.form-control-sm {
    font-size: 0.85rem !important;
}

.add-new-client {
    color: #b10d0d;
    font-weight: 600;
    justify-content: center !important;
    gap: 0.4rem;
    border-top: 1px solid #f1f5f9;
    margin-top: 0.35rem;
    padding-top: 0.6rem !important;
    font-size: 0.85rem;
}



/* Invoice Items Section - Modern Redesign */
.invoice-items-section {
    position: relative;
    background: white;
    padding: 0.44rem;
    border-radius: 0;
    /* margin-bottom: 0.75rem; */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #cbd5e1;
    min-height: 200px;
    /* Merged from below */
    overflow: visible !important;
    /* Allow suggestions to pop out */
}

/* Desktop Table Container - allow normal horizontal scroll and rounded corners */
.table-responsive {
    overflow-x: auto !important;
    border-radius: 6px;
}

/* Mobile: allow half-out delete button to be visible */
@media (max-width: 768px) {
    .table-responsive {
        overflow: visible !important;
        overflow-x: visible !important;
    }
}

/* On small screens, we still need horizontal scroll for traditional tables, 
   but since we use cards on mobile (under 768px), visible overflow is fine for desktop. */



.invoice-items-table {
    width: 100%;
    border-collapse: separate;
    background-color: #fff;
    border-radius: 12px;
    border-spacing: 0;
    font-size: 0.82rem;
    min-width: 1200px;
    /* Ensure table doesn't get squashed */
}

.invoice-items-table thead {
    background: white;
    position: sticky;
    top: 0;
    z-index: 70;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.invoice-items-table .header-main th {
    padding: 0.6rem 0.6rem;
    text-align: center;
    font-weight: 700;
    color: #ffffff;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    background: #8f6b04;
}

.invoice-items-table .header-main th:last-child {
    border-right: none;
}

.invoice-items-table .header-sub th {
    padding: 0.5rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: #ffffff;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    background: #a59249;
}

.invoice-items-table .header-sub th:last-child {
    border-right: none;
}

.invoice-items-table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.invoice-items-table tbody tr:hover {
    background: rgba(239, 119, 34, 0.03) !important;
    z-index: 5;
}

.invoice-items-table tbody tr.active-row {
    background: #ffffff !important;
    /* box-shadow: 0 0 0 2px rgba(239, 119, 34, 0.25), 0 8px 30px -5px rgba(239, 119, 34, 0.15) !important; */
    z-index: 10;
    position: relative;
}

.invoice-items-table td {
    padding: 0;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.invoice-items-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-items-table td:first-child {
    font-weight: 600;
    color: #64748b;
    text-align: center;
    padding: 0.5rem 0.3rem;
}

.invoice-items-table input,
.invoice-items-table select {
    width: 100%;
    padding: 0.35rem 0.3rem;
    border: none;
    border-radius: 0;
    font-size: 0.7rem;
    background: transparent;
    transition: all 0.2s;
    outline: none;
}

/* Fast Navigation (Main Editor Inputs) - Height & Premium Feel Optimization */
.fast-nav {
    /* padding-top: 0rem !important;
    padding-bottom: 0rem !important; */
    font-weight: 500;
    /* min-height: 35px !important; */
    /* Premium standardized height */
    transition: all 0.25s ease !important;
}

.invoice-items-table input.fast-nav {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

.invoice-items-table input:hover,
.invoice-items-table select:hover {
    background: #ffffff;
}

/* Active row - show borders */
.invoice-items-table tbody tr.active-row input,
.invoice-items-table tbody tr.active-row select {
    border-color: #cbd5e1;
    background: #ffffff;
}

.invoice-items-table input:focus,
.invoice-items-table select:focus {
    border-color: #b10d0d !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.15) !important;
    z-index: 30;
    position: relative;
}

.invoice-items-table tbody tr.active-row input:focus,
.invoice-items-table tbody tr.active-row select:focus {
    border-color: #b10d0d !important;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.2) !important;
}

.invoice-items-table input[readonly] {
    background: transparent;
    color: #475569;
    font-weight: 600;
    border-color: transparent;
    cursor: default;
}

.invoice-items-table tbody tr.active-row input[readonly] {
    background: #ffffff;
}

.btn-remove-row {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #ef4444;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 1;
    font-size: 0.82rem;
}

.btn-remove-row:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b10d0d;
    transform: scale(1.1);
}

/* Item Search Suggestions */
.item-search-wrapper {
    position: relative;
    width: 100%;
}

.item-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    /* max-height: 400px; */
    overflow-y: auto;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15), 0 5px 15px -5px rgba(0, 0, 0, 0.05);
    z-index: 3000;
    display: none;
    backdrop-filter: blur(10px);
    padding: 6px;

}

/* Ensure row being edited stays on top of subsequent rows/sections and sticky headers */
.invoice-items-table tbody tr {
    position: relative;
    z-index: 1;
}

.invoice-items-table tbody tr.active-row,
.invoice-items-table tbody tr:focus-within {
    z-index: 100 !important;
    /* Raised above sticky table headers (z-index 70) */
}

/* Ensure SweetAlert modals are always on top of active table rows and sidebars */
.swal2-container {
    z-index: 99999999 !important;
}

.item-suggestions.active {
    display: block;
}

.item-suggestion {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 2px;
    cursor: pointer;
    border-bottom: none;
    transition: all 0.2s;
}

.item-suggestion.out-of-stock-suggestion {
    opacity: 0.85;
}

.item-suggestion:last-child {
    border-bottom: none;
}

.item-suggestion:hover,
.item-suggestion.highlighted {
    background: linear-gradient(to right, #fff7ed, #ffffff);
    border-left: 3px solid #b10d0d;
    box-shadow: 0 2px 8px rgba(239, 119, 34, 0.05);
}

.item-suggestion-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.82rem;
}

.item-suggestion-details {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 0;
}

.item-suggestion-price {
    color: #b10d0d;
    font-weight: 600;
}

.total-row {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%) !important;
    font-weight: 600;
    border-top: 2px solid #cbd5e1;
}

.total-row td {
    padding: 0.75rem 0.6rem;
    color: #1e293b;
    font-size: 1rem;
}

.final-total-row {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%) !important;
    border-top: 2px solid #fb923c;
}

.final-total-row td {
    padding: 0.85rem 0.6rem;
    font-size: 0.9rem;
    color: #c2410c;
    font-weight: 700;
}

.payment-row td {
    padding: 0.7rem 0.6rem;
    font-size: 1rem;
}

.payment-row input {
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 1rem;
    text-align: right;
    background: white;
    cursor: text;
    transition: all 0.2s;
}

.payment-row input:hover {
    border-color: #94a3b8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.payment-row input:focus {
    outline: none;
    border-color: #b10d0d;
    background: #fffbf5;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.15);
}

/* Ensure received amount is always editable */


#balance-row td {
    color: #1e293b;
    font-weight: 600;
}

.text-right {
    text-align: right;
}

.add-row-td {
    text-align: center;
}

.btn-add-row {
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.82rem;
    box-shadow: none;
}

.btn-add-row:hover {
    border-color: #b10d0d;
    border-style: dashed;
    color: #b10d0d;
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-add-row i {
    transition: transform 0.3s;
}

.btn-add-row:hover i {
    transform: rotate(90deg);
}

/* Invoice Actions - Compact */
/* Mobile Hisaab Calculator Strip */
.mobile-hisaab-strip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 16px;
    margin-bottom: 0;
}

.invoice-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.btn-invoice-primary {
    background: linear-gradient(135deg, #b10d0d 0%, #b10d0d 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(239, 119, 34, 0.25);
    font-size: 0.9rem;
}

.btn-invoice-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 119, 34, 0.35);
}

.btn-invoice-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    gap: 0.4rem;
}

/* Item Settings Modal */
.items-header-actions {
    position: relative;
}

.btn-item-settings {
    background: #ffffff;
    border: 1.5px solid #f1f5f9;
    color: #64748b;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn-item-set.btn-add-row:hover {
    background: #fff7ed;
    border-color: #b10d0d;
    color: #b10d0d;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(239, 119, 34, 0.1);
}

/* --- Batch & Dates Widget (Premium Compact) --- */
.batch-dates-widget {
    min-width: 130px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.batch-dates-widget:hover {
    border-color: #b10d0d;
    box-shadow: 0 4px 12px rgba(239, 119, 34, 0.08);
}

.batch-dates-widget .d-flex {
    height: 20px;
}

.batch-dates-widget .d-flex:last-child {
    height: 19px;
    border-top: 1px solid #cbd5e1 !important;
}

.batch-dates-widget .bg-light {
    width: 18px !important;
    min-width: 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    background: #ffffff !important;
    color: #94a3b8 !important;
    border-right: 1px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-transform: uppercase;
}

.batch-dates-widget input {
    height: 100% !important;
    font-size: 13px !important;
    padding: 0 6px !important;
    text-align: left !important;
    background: transparent !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    border: none !important;
    outline: none !important;
}

.batch-dates-widget input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

.batch-dates-widget input[type="date"] {
    font-size: 13px !important;
    padding: 0 2px !important;
    color: #64748b !important;
}

.batch-dates-widget input:focus {
    color: #b10d0d !important;
    background: #fff7ed !important;
}

.batch-dates-widget .border-end {
    border-right: 1px solid #cbd5e1 !important;
}

.btn-item-settings i {
    font-size: 0.9rem;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-item-settings:hover i {
    transform: rotate(180deg);
}

.settings-modal {
    display: none;
    background: white;
    border-right: 1px solid #e2e8f0;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    z-index: 1000001;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    animation: sidebarSlideIn 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    /* Rounded only on the right */
    overflow-y: auto;
}

@keyframes sidebarSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Global Backdrop Styling for Settings */
[id^="settings-backdrop-"] {
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(4px) !important;
    animation: fadeIn 0.3s ease-out;
}

.settings-header {
    background: #f8fafc;
    padding: 24px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.close-settings {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.close-settings:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fee2e2;
    transform: rotate(90deg);
}

.settings-body {
    padding: 24px 20px;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group h4 {
    font-size: 0.82rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.setting-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.setting-checkbox:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: translateX(4px);
}

.setting-checkbox input {
    accent-color: #161E54;
    width: 16px;
    height: 16px;
}

/* Visibility toggles for columns */
/* Dynamic CSS classes will be used via JS to show/hide: e.g., .col-mrp { display: none; } */
.col-hidden {
    display: none !important;
}

/* =========================================
   Invoice Preview Modal Styles
   ========================================= */
.invoice-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.preview-container {
    display: flex;
    width: 95%;
    height: 95%;
    background: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Sidebar Styles */
.preview-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #cbd5e1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #1e293b;
}

.close-preview-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0 5px;
}

.close-preview-btn:hover {
    color: #ef4444;
}

.sidebar-section h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-options {
    display: flex;
    gap: 10px;
}

.theme-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.theme-btn.active {
    background: #b10d0d;
    color: white;
    border-color: #b10d0d;
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    color: white;
    transition: transform 0.1s;
}

.share-btn:active {
    transform: scale(0.98);
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.gmail {
    background: #DB4437;
}

.share-btn.message {
    background: #BBE0EF;
}

.print-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-btn {
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.primary {
    background: #b10d0d;
    color: white;
}

.action-btn.secondary {
    background: #cbd5e1;
    color: #1e293b;
}

.whatsapp-promo {
    margin-top: auto;
    background: #dcfce7;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    border: 1px solid #86efac;
}

.whatsapp-promo i {
    font-size: 2rem;
    color: #25D366;
}

.whatsapp-promo p {
    margin: 5px 0 0;
    font-size: 1rem;
    color: #166534;
}

/* Invoice Preview Content Area */
.preview-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    background: #94a3b8;
    /* Contrast background for paper */
}

/* Invoice Paper Styling (A4 equivalent width) */
.invoice-preview-container .invoice-paper {
    width: 210mm;
    min-height: 297mm;
    background: white;
    padding: 10mm;
    /* Reduced from 15mm */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    /* Reduced from 14px */
    line-height: 1.3;
}

/* Invoice Internal Styles */
.invoice-header {
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.invoice-title {
    margin: 0 0 10px 0;
    text-align: right;
    font-size: 1.4rem;
    /* Reduced from 1.8rem */
    text-transform: uppercase;
    color: #000;
    font-weight: 800;
}

.header-split {
    display: flex;
    justify-content: space-between;
}

.company-details {
    display: flex;
    flex-direction: column;
}

#preview-company-logo {
    max-height: 60px;
    max-width: 150px;
    object-fit: contain;
    margin-bottom: 8px;
    align-self: flex-start;
}

.company-details h3 {
    margin: 0 0 2px 0;
    font-size: 1.2rem;
    /* Reduced from 1.5rem */
    font-weight: 800;
}

.invoice-meta {
    text-align: right;
}

.meta-row {
    margin-bottom: 3px;
}

.client-details-section {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    /* Reduced */
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.preview-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.preview-items-table th,
.preview-items-table td {
    border: 1px solid #cbd5e1;
    padding: 4px 6px;
    /* Reduced padding */
    text-align: left;
    font-size: 1rem;
    /* Smaller font */
}

.preview-items-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.preview-items-table td:nth-child(4),
/* Qty */
.preview-items-table td:nth-child(5),
/* Rate */
.preview-items-table td:nth-child(6),
/* GST */
.preview-items-table td:nth-child(7) {
    /* Amount */
    text-align: right;
}

.invoice-footer-split {
    display: flex;
    gap: 20px;
}

.left-footer {
    flex: 1.5;
}

.right-footer {
    flex: 1;
}

.tax-summary-container {
    margin-bottom: 10px;
}

.tax-summary-container h4 {
    margin: 0 0 5px 0;
    font-size: 0.85rem;
    text-decoration: underline;
}

.tax-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    /* Very compact */
    margin-bottom: 10px;
}

.tax-summary-table th,
.tax-summary-table td {
    border: 1px solid #cbd5e1;
    padding: 3px;
    text-align: center;
}

.tax-summary-table th {
    background: #ffffff;
}

.totals-table {
    width: 100%;
    border-collapse: collapse;
}

.totals-table td {
    padding: 4px 8px;
    /* Reduced padding */
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
}

.totals-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.grand-total-row {
    font-weight: 800;
    font-size: 1rem;
    color: #000;
}

.grand-total-row td {
    padding-top: 6px;
    padding-bottom: 6px;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
}

.signature-box {
    margin-top: 30px;
    text-align: right;
}

.sign-space {
    height: 40px;
    margin-top: 5px;
    font-weight: 600;
}

/* =========================================
   Autocomplete Suggestion Dropdown Styling (Custom Premium)
   ========================================= */

.item-suggestions {
    position: absolute;
    z-index: 1050;
    width: 100%;
    left: 0;
    top: 100%;
    margin-top: 6px;
    min-width: 200px;
}

.custom-dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
}

.custom-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover {
    background-color: #ffffff;
}

/* Header: Name + Badge */
.custom-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.client-badge {
    font-size: 0.82rem;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Meta: Phone + Address */
.custom-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #64748b;
}

.custom-item-meta i {
    opacity: 0.6;
    margin-right: 4px;
    font-size: 0.82rem;
}

.meta-divider {
    color: #cbd5e1;
}

.meta-phone,
.meta-address {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-address {
    max-width: 180px;
    /* Prevent long address overflow */
}

/* Print Styles */
@media print {

    /* Targetted hiding for professional printing */
    #sidebar,
    #top-navbar,
    .action-bar-floating,
    #invoice-loader,
    .modal-backdrop,
    .sb-portal-backdrop,
    .corner-lux-loader,
    #section-loader,
    .buttons-sticked {
        display: none !important;
    }

    #invoice-preview-modal,
    #invoice-preview-modal * {
        visibility: visible;
    }

    #invoice-preview-modal {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: white;
        z-index: 99999;
        backdrop-filter: none;
    }

    .preview-container {
        width: 100%;
        height: 100%;
        box-shadow: none;
        display: block;
        border-radius: 0;
    }

    .preview-sidebar {
        display: none !important;
    }

    .preview-content {
        padding: 0;
        overflow: visible;
        background: white;
        display: block;
    }

    .invoice-paper {
        width: 100%;
        min-height: auto;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    /* Ensure colors print correctly */
    .preview-items-table th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    #invoice-preview-modal,
    #invoice-preview-modal * {
        visibility: visible;
    }

    #invoice-preview-modal {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: white;
        z-index: 99999;
        backdrop-filter: none;
    }

    .preview-container {
        width: 100%;
        height: 100%;
        box-shadow: none;
        display: block;
        border-radius: 0;
    }

    .preview-sidebar {
        display: none !important;
    }

    .preview-content {
        padding: 0;
        overflow: visible;
        background: white;
        display: block;
    }

    .invoice-paper {
        width: 100%;
        min-height: auto;
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    /* Ensure colors print correctly */
    .preview-items-table th {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Specific fix for Address Fields to ensure full width */
#billing-address,
#shipping-address {
    width: 100% !important;
    box-sizing: border-box !important;
    max-width: 100%;
}

#address-fields {
    width: 100%;
}

/* --- Professional Preview Navbar --- */
.preview-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e293b;
    /* Dark Professional Header */
    color: white;
    padding: 0.8rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.preview-header-title {
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 1rem;
    color: #cbd5e1;
}

.nav-btn-back,
.nav-btn-new {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.nav-btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn-new {
    background: #b10d0d;
    /* Brand Color */
    border-color: #b10d0d;
}

.nav-btn-new:hover {
    background: #d96317;
}

/* Refine Modal Layout for Navbar */
#invoice-preview-modal {
    flex-direction: column !important;
    /* Stack navbar and container */
    background: #f1f5f9;
    /* Light gray background */
    padding: 0 !important;
}

#invoice-preview-modal .preview-container {
    height: calc(100% - 60px);
    /* Adjust for navbar */
    margin-top: 0 !important;
    border-radius: 0;
    box-shadow: none;
    max-width: 100% !important;
    background: transparent !important;
    padding: 1.5rem;
    /* Resume padding for content */
    box-sizing: border-box;
}

/* Update Sidebar Styling for Premium Box */
.premium-themes-banner {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    color: #fbbf24;
    /* Gold */
    text-align: center;
}

.premium-themes-banner p {
    margin: 0 0 0.5rem 0;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dummy-theme-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.dummy-theme {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
    border-radius: 4px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Hide Mobile Elements on Desktop by default */
.qty-btn {
    display: none;
}

/* Desktop Qty input shouldn't have stepper background */
.qty-stepper {
    background: transparent;
}

.qty-stepper input {
    text-align: right !important;
    /* Restore standard alignment for desktop */
}

/* Batch Fields Desktop Styling - Use placeholders, hide labels */
.batch-row label {
    display: none;
}

.batch-input-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Barcode Scanner System - Premium Styles (Global/Laptop) */
.barcode-scanner-bar {
    background: #ffffff;
    border: 1.5px solid #f1f5f9;
    border-radius: 20px;
    padding: 0.8rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.barcode-scanner-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #b10d0d;
    opacity: 0.8;
}

.barcode-scanner-bar:hover {
    box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.scanner-status-dot {
    width: 44px;
    height: 44px;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    position: relative;
    transition: all 0.4s ease;
    font-size: 1.1rem;
    border: 1.5px solid #edf2f7;
}

.scanner-status-dot.active {
    background: rgba(239, 119, 34, 0.08);
    color: #b10d0d;
    border-color: rgba(239, 119, 34, 0.3);
    box-shadow: 0 0 20px rgba(239, 119, 34, 0.15);
}

.status-pulse {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #b10d0d;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
    box-shadow: 0 0 10px rgba(239, 119, 34, 0.5);
}

.scanner-status-dot.active .status-pulse {
    display: block;
    animation: scanner-pulse 1.5s infinite;
}

@keyframes scanner-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 119, 34, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 119, 34, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 119, 34, 0);
    }
}

.scanner-title {
    font-size: 0.95rem;
    font-weight: 800 !important;
    color: #1e293b;
    margin-bottom: 0.15rem;
}

.scanner-subtitle {
    font-size: 1rem;
    color: #64748b;
}

.btn-primary-custom {
    background: linear-gradient(135deg, #b10d0d 0%, #b10d0d 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(239, 119, 34, 0.25);
    text-decoration: none;
}

.btn-primary-custom:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px -5px rgba(239, 119, 34, 0.4);
    background: linear-gradient(135deg, #b10d0d 0%, #991b1b 100%);
    color: white;
}

/* Scanner Viewport Styles */
.scanner-guide-frame {
    position: absolute;
    width: 280px;
    height: 180px;
    z-index: 50;
    pointer-events: none;
    opacity: 0.8;
}

.guide-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: #BBE0EF;
    border-style: solid;
    border-width: 0;
}

.top-left {
    top: 0;
    left: 0;
    border-top-width: 6px;
    border-left-width: 6px;
    border-top-left-radius: 20px;
}

.top-right {
    top: 0;
    right: 0;
    border-top-width: 6px;
    border-right-width: 6px;
    border-top-right-radius: 20px;
}

.bottom-left {
    bottom: 0;
    left: 0;
    border-bottom-width: 6px;
    border-left-width: 6px;
    border-bottom-left-radius: 20px;
}

.bottom-right {
    bottom: 0;
    right: 0;
    border-bottom-width: 6px;
    border-right-width: 6px;
    border-bottom-right-radius: 20px;
}

.guide-laser {
    position: absolute;
    top: 50%;
    left: 5%;
    width: 90%;
    height: 3px;
    background: #ef4444;
    box-shadow: 0 0 15px #ef4444;
    animation: laser-move 2s infinite ease-in-out;
}

@keyframes laser-move {

    0%,
    100% {
        top: 20%;
        opacity: 0.4;
    }

    50% {
        top: 80%;
        opacity: 1;
    }
}

/* Mobile Responsive Styles - Professional Ultra-Compact Layout */
@media (max-width: 768px) {
    .invoice-editor-wrapper {
        padding-top: 5px;
    }

    .invoice-tabs-bar {
        position: sticky !important;
        position: -webkit-sticky !important;
        top: 0 !important;
        /* Sticky to top on mobile */
        z-index: 100 !important;
        background: #0f172a;
        /* Ensure background is set to cover content behind */
    }

    .batch-row {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
        width: 100%;
    }

    .batch-row label {
        display: block;
        font-size: 0.82rem;
        font-weight: 800;
        color: #64748b;
        min-width: 45px;
        text-transform: uppercase;
    }

    .batch-row input {
        flex: 1;
    }

    .invoice-form-container {
        /* padding: 0.24rem; */
    }

    /* Transform Table to Professional Vertical Cards */
    .invoice-items-table,
    .invoice-items-table thead,
    .invoice-items-table tbody,
    .invoice-items-table tfoot,
    .invoice-items-table tr {
        display: block;
    }

    .invoice-items-table {
        min-width: 100% !important;
        border: none;
    }

    .invoice-items-table thead {
        display: none;
    }

    .invoice-items-table tbody tr {

        border: 1px solid #cbd5e1;
        border-radius: 8px;
        margin-bottom: 0.5rem;
        padding: 0.4rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
        position: relative;
        display: flex;
        flex-wrap: wrap;
        overflow: visible !important;
    }

    .invoice-items-table tbody tr.active-row {
        border-color: #b10d0d;
        background-color: #fffaf5 !important;
        box-shadow: 0 4px 15px rgba(239, 119, 34, 0.1);
    }

    /* Standard Card Cells - 2 per row for better alignment */
    .invoice-items-table td {
        border: none !important;
        padding: 0.15rem 0.2rem !important;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        text-align: left;
        font-size: 0.82rem;
        width: 50%;
        box-sizing: border-box;
        overflow: visible;
        /* Ensure suggestions are not clipped */
    }

    .invoice-items-table td::before {
        content: attr(data-label) ": ";
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.82rem;
        color: #64748b;
        width: 70px;
        flex-shrink: 0;
        letter-spacing: 0.02em;
    }

    /* Item Description - Full Width Primary */
    .invoice-items-table td[data-label="Item"] {
        width: 100%;
        /* border-bottom: 2px solid #f1f5f9 !important; */
        margin-bottom: 0.4rem;
        padding-bottom: 0.4rem !important;
        display: block;
        overflow: visible;
        /* Ensure suggestions are not clipped */
    }

    .invoice-items-table td[data-label="Item"]::before {
        width: 100%;
        display: block;
        margin-bottom: 4px;
        color: #b10d0d;
        font-size: 0.82rem;
    }

    /* Batch - Full Width for better space */
    .invoice-items-table td[data-label="Batch"] {
        width: 100% !important;
        border-top: 1px dashed #cbd5e1 !important;
        margin-top: 0.2rem;
        padding-top: 0.4rem !important;
        padding-bottom: 0.4rem !important;
        display: block !important;
        /* Force vertical stacking */
    }

    .invoice-items-table td[data-label="Batch"]::before {
        display: none;
    }

    .batch-dates-widget {
        min-width: 100% !important;
        width: 100%;
        margin-top: 5px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
    }

    .batch-dates-widget .d-flex {
        height: 24px !important;
        background: #fff;
    }

    .batch-dates-widget .d-flex:last-child {
        height: 22px !important;
        border-top: 1px solid #cbd5e1 !important;
    }

    .batch-dates-widget input {
        height: 100% !important;
        font-size: 13px !important;
        padding: 0 8px !important;
        font-weight: 600 !important;
    }

    .batch-dates-widget .bg-light {
        width: 24px !important;
        min-width: 24px !important;
        font-size: 13px !important;
        font-weight: 800 !important;
        background: #ffffff !important;
        color: #64748b !important;
        border-right: 1px solid #cbd5e1 !important;
    }

    .batch-dates-widget input[type="date"] {
        font-size: 13px !important;
        padding: 0 2px !important;
    }

    .batch-dates-widget .border-end {
        border-right: 1px solid #cbd5e1 !important;
    }

    /* Actions - Clean top right positioning */
    /* Actions - Clean top right positioning (Floating Half-Out) */
    .invoice-items-table td.action-cell {
        position: absolute;
        top: -10px;
        right: -10px;
        width: auto;
        padding: 0 !important;
        display: block;
        z-index: 100;
        overflow: visible !important;
    }

    .invoice-items-table td.action-cell::before {
        display: none;
    }

    .btn-remove-row {
        background: #fee2e2 !important;
        color: #dc2626 !important;
        border-radius: 50% !important;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        border: 2px solid white;
    }

    /* Inputs - Nano Compact & Aligned */
    .invoice-items-table input,
    .invoice-items-table select {
        flex: 1;
        /* Fill remaining space */
        min-width: 0;
        padding: 0.15rem 0.3rem !important;
        background: #ffffff;
        border: none;
        border-radius: 4px;
        font-size: 0.82rem !important;
        height: auto !important;
        text-align: right !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Focus Zoom Effect for Better Editing */
    .invoice-items-table input:focus,
    .invoice-items-table select:focus {
        transform: scale(1.02);
        z-index: 100;
        background: white !important;
        border-color: #b10d0d !important;
        box-shadow: 0 4px 15px rgba(239, 119, 34, 0.25) !important;
        outline: none !important;
    }

    /* Quantity Stepper Design */
    .qty-stepper {
        display: flex;
        align-items: center;
        background: #f1f5f9;
        border-radius: 4px;
        padding: 1px;
        flex: 1;
        max-width: 100%;
    }

    .qty-btn {
        width: 24px;
        height: 24px;
        border: none;
        background: white;
        color: #1e293b;
        font-weight: 800;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 3px;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .qty-btn:active {
        background: #b10d0d;
        color: white;
        transform: scale(0.9);
    }

    .qty-stepper input {
        border: none !important;
        background: transparent !important;
        width: 100% !important;
        text-align: center !important;
        border-radius: 0 !important;
        font-weight: 700 !important;
        box-shadow: none !important;
        transform: none !important;
        /* Prevent zoom on the stepper input specifically to keep buttons visible */
    }

    .invoice-items-table td[data-label="Item"] input {
        width: 100% !important;
        text-align: left !important;
        height: auto !important;
        font-weight: 600;
        border-color: #b10d0d;
    }

    .invoice-items-table input[readonly] {
        background: transparent;
        border-color: transparent;
        padding-right: 0 !important;
        font-weight: 700;
        color: #1e293b;
    }

    /* High Value Highlighting */
    .invoice-items-table td[data-label="Total"] input {
        color: #ef4444 !important;
        font-weight: 800 !important;
        font-size: 1rem !important;
    }

    /* Footer - Vertical Professional Summary */
    .custom-invoice-summary,
    .invoice-editor-summary,
    .invoice-summary-card .p-3 {
        /* Target the container used in snippet */
        display: block;
        padding: 0.75rem 0.25rem;
        border-radius: 12px;
        margin-top: 1rem;
    }

    /* Force Row Layout for Summary Items - COMPACT MODE (excludes payment tracking) */
    .custom-invoice-summary .summary-item,
    .invoice-editor-summary .d-flex,
    .invoice-summary-card .d-flex:not(.payment-tracking-rows .d-flex):not(.payment-tracking-rows *) {
        width: 100% !important;
        padding: 0.15rem 0.5rem !important;
        /* Extremely Compact Padding */
        justify-content: space-between !important;
        display: flex !important;
        flex-direction: row !important;
        /* Force Side-by-Side */
        background: white;
        border: 1px solid #f1f5f9;
        border-radius: 4px;
        margin-bottom: 2px !important;
        /* Minimal Gap */
        align-items: center !important;
        min-height: 28px;
        /* Force minimum height */
    }


    /* Reset payment tracking rows to match laptop design */
    .payment-tracking-rows .d-flex,
    .payment-tracking-rows .position-relative,
    .payment-tracking-rows .row,
    .payment-tracking-rows .form-group-invoice {
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        min-height: auto !important;
        width: auto !important;
    }


    .payment-tracking-rows .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .payment-tracking-rows .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 6px !important;
    }

    /* Smaller Font for Compactness */
    .invoice-summary-card .text-secondary,
    .invoice-summary-card .text-muted {
        font-size: 0.82rem !important;
        margin-bottom: 0 !important;
    }

    /* Fix Inputs inside summary (exclude payment tracking rows to keep laptop design) */
    .invoice-summary-card input:not(.payment-tracking-rows input),
    .invoice-editor-summary input {
        /* max-width: 70px !important; */
        /* Smaller width */
        height: 24px !important;
        /* Reduced height */
        font-size: 0.82rem !important;
        text-align: right !important;
        border: 1px solid #cbd5e1 !important;
        background: #ffffff !important;
        border-radius: 3px !important;
        padding: 0 4px !important;
    }



    .payment-tracking-rows .form-group-invoice label {
        font-size: 0.55rem !important;
        font-weight: 600 !important;
        margin-bottom: 3px !important;
    }

    /* ₹ symbol inside payment inputs - smaller on mobile */
    .payment-tracking-rows .position-absolute {
        font-size: 0.75rem !important;
        margin-left: 0.5rem !important;
    }

    /* Online details grid (UPI dropdown + Ref input) - fit inside column */
    .payment-tracking-rows .online-details-grid {
        margin-top: 4px !important;
        gap: 3px !important;
        padding: 2px !important;
        border-radius: 6px !important;
        width: 100% !important;
    }

    .payment-tracking-rows .online-detail-field {
        height: 24px !important;
        font-size: 9px !important;
        padding: 0 5px !important;
        border-radius: 4px !important;
    }

    .payment-tracking-rows .online-detail-field.select {
        background-size: 8px !important;
        padding-right: 16px !important;
    }

    .payment-tracking-rows .online-detail-field.input::placeholder {
        font-size: 8px !important;
    }

    .custom-invoice-summary .summary-label {
        font-size: 0.82rem;
        font-weight: 600;
        color: #475569;
        text-transform: uppercase;
    }

    .custom-invoice-summary .summary-value {
        font-weight: 700;
        color: #1e293b;
        font-size: 0.85rem;
    }

    .final-total-row td {
        background: #fff7ed;
        border-color: #fee2e2 !important;
    }

    .final-total-row td strong {
        color: #c2410c;
        font-size: 1rem;
    }

    .mob-hide {
        display: none !important;
    }

    .add-row-td {
        width: 100% !important;
        display: block !important;
        padding: 0 !important;
    }

    .add-row-td::before {
        display: none !important;
    }

    .btn-add-row {
        width: 100% !important;
        padding: 0.65rem !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        margin: 0.5rem 0;
        border-radius: 12px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #fffaf5 !important;
        border: 1.5px solid #b10d0d !important;
        color: #b10d0d !important;
        box-shadow: 0 4px 12px rgba(239, 119, 34, 0.1) !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Sticky Bottom Actions */
    .invoice-actions {
        position: sticky;
        bottom: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        padding: 0.6rem;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
        z-index: 100;
        /* margin: 0 -0.15rem; */
        display: flex;
        gap: 0.4rem;
        border-top: 1px solid #cbd5e1;
    }

    .btn-invoice-primary,
    .btn-invoice-secondary {
        flex: 1;
        font-size: 0.82rem;
        font-weight: 700;
        padding: 0.6rem 0.2rem;
        height: 42px;
        border-radius: 8px;
    }

    /* Fix Round Off Toggle */
    .invoice-summary-card .form-check-input,
    #auto-round-off {
        appearance: auto !important;
        /* Allow browser default or custom switch */
        width: 32px !important;
        height: 18px !important;
        margin-top: 0 !important;
        position: relative !important;
        cursor: pointer !important;
        display: inline-block !important;
        background-color: #cbd5e1;
        border-radius: 20px;
    }

    .invoice-summary-card .form-check-input:checked,
    #auto-round-off:checked {
        background-color: #b10d0d;
        border-color: #b10d0d;
    }

    #round-off {
        width: 70px !important;
        height: 24px !important;
    }

    /* =========================================
       Direct Payment Section Styling (Targeting provided HTML)
       ========================================= */

    /* 1. Reset Bootstrap Row/Col for this specific section */
    .invoice-summary-card .row.g-3,
    .payment-section-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        margin: 10px 0 0 0 !important;
        width: 100% !important;
        gap: 12px !important;
        border-top: 1px dashed #cbd5e1;
        padding-top: 12px;
    }

    .invoice-summary-card .col-6 {
        width: 50% !important;
        flex: 1 1 50% !important;
        padding: 0 !important;
        /* Remove gutters */
        max-width: 50% !important;
    }

    /* 2. Labels */
    .form-group-invoice label {
        font-size: 0.62rem !important;
        font-weight: 600 !important;
        color: #64748b !important;
        text-transform: uppercase !important;
        margin-bottom: 4px !important;
        letter-spacing: 0.5px;
    }

    /* 3. Received Amount (Input) */




    /* Currency Icon Overlay */
    /* Target the span.text-success inside position-relative */
    .position-relative .text-success.position-absolute {
        left: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 1rem !important;
        color: #15803d !important;
        margin: 0 !important;
        /* Override ms-4 */
        padding: 0 !important;
        z-index: 10;
    }

    /* 4. Balance Due - match laptop styling on mobile */


    /* Batch Fields Mobile Styling */
    .invoice-items-table td.col-batch::before {
        display: none !important;
        /* Hide main label to use internal ones */
    }

    .batch-input-container {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .batch-row {
        display: flex;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
    }

    .batch-row label {
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.82rem !important;
        color: #64748b !important;
        width: 70px;
        /* Matching other mobile labels */
        flex-shrink: 0;
        display: block;
        margin: 0 !important;
        text-align: left;
    }

    /* =========================================
       Payment Mode, Reference & Note Styling (Premium)
       ========================================= */

    /* Force Side-by-Side Layout for Payment Mode & Ref */
    .header-columns {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    .header-columns .form-group-invoice {
        flex: 1 !important;
        min-width: 0;
    }

    /* Premium Input Styling (Matching Amount Received) */
    .invoice-editor-wrapper #payment-mode,
    .invoice-editor-wrapper #reference-no,
    .invoice-editor-wrapper .invoice-note textarea,
    .invoice-editor-wrapper textarea#invoice-note {
        width: 100% !important;
        height: 28px !important;
        background: #fff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 8px !important;
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    /* Focus States */
    .invoice-editor-wrapper #payment-mode:focus,
    .invoice-editor-wrapper #reference-no:focus,
    .invoice-editor-wrapper .invoice-note textarea:focus,
    .invoice-editor-wrapper textarea#invoice-note:focus {
        border-color: #b10d0d !important;
        background: #fff !important;
        box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.1) !important;
        outline: none !important;
    }

    /* Specific for Textarea on mobile */
    .invoice-editor-wrapper .invoice-note textarea,
    .invoice-editor-wrapper textarea#invoice-note {
        height: auto !important;
        min-height: 280px !important;
        padding: 10px !important;
        line-height: 1.5;
    }
}

/* Desktop specific note styling */
textarea#invoice-note {
    min-height: 80px !important;
}

/* 
   -----------------------------------
   PREMIUM SETTINGS MODAL STYLES 
   -----------------------------------
*/

#settings-backdrop {
    backdrop-filter: blur(4px);
    background: rgba(15, 23, 42, 0.6) !important;
    animation: fadeInBackground 0.3s;
}

@keyframes fadeInBackground {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}



@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.settings-header {
    padding: 1.25rem 1.5rem;
    /* background: linear-gradient(to right, #ffffff, #ffffff); */
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.close-settings {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings:hover {
    background: #f1f5f9;
    color: #ef4444;
    transform: rotate(90deg);
}

.settings-body {
    padding: 1.5rem;
    overflow-y: auto;
    /* background: #ffffff; */
}

.setting-group {
    margin-bottom: 2rem;
    background: #fafbfc;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group h4 {
    font-size: 0.82rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group h4::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #cbd5e1;
}

/* Premium Switch Toggles */
.setting-checkbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    /* Text left, Switch right */
    padding: 0.5rem 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    color: #334155;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.setting-checkbox:hover {
    color: #0f172a;
}

.setting-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    outline: none;
    flex-shrink: 0;
    margin-left: 1rem;
    border: none !important;
}

.setting-checkbox input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.setting-checkbox input[type="checkbox"]:checked {
    background: #b10d0d;
    box-shadow: 0 2px 8px rgba(239, 119, 34, 0.3);
}

.setting-checkbox input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}




.scanner-bar-compact {
    min-height: 42px;
}

.scanner-indicator-circle {
    width: 28px;
    height: 28px;
    border: 1px solid #e0e7ff;
    position: relative;
    background-color: #ffffff;
    /* bg-light */
}

.scanner-status-pulse {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px #fff;
}

.scanner-title-text {
    font-size: 1rem !important;
}

.scanner-subtitle-text {
    font-size: 0.82rem !important;
    line-height: 1 !important;
}

.scanner-camera-btn {
    font-size: 0.82rem !important;
    background: #fff !important;
    white-space: nowrap !important;
}

/* Premium Hover Effects */
.hover-lift {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease !important;
}

.hover-lift:hover {
    transform: none !important;
}

.hover-glow:hover {
    box-shadow: 0 10px 30px -5px rgba(79, 70, 229, 0.5) !important;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* Font Weight Utilities */
.fw-700 {
    font-weight: 700 !important;
}

.fw-800 {
    font-weight: 800 !important;
}

/* Invoice Action Buttons (Premium Overrides) */
.invoice-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.action-btn-draft,
.action-btn-back {
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    min-width: 140px;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 50px !important;
    transition: all 0.3s ease !important;
}

.action-btn-back:hover {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    transform: translateX(-5px);
}

.action-btn-save {
    background: linear-gradient(135deg, #b10d0d 0%, #b10d0d 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(239, 119, 34, 0.4) !important;
    min-width: 240px;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    border-radius: 50px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.action-btn-save:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(239, 119, 34, 0.5) !important;
    background: linear-gradient(135deg, #b10d0d 0%, #991b1b 100%) !important;
}

/* Mobile Bottom Action Bar (Static - No longer sticky/fixed) */
@media (max-width: 767px) {
    .invoice-editor-wrapper {
        /* padding-bottom: 20px !important; */
        /* Reduced from 110px */
    }

    .invoice-actions {
        position: relative !important;
        /* Changed from fixed to relative */
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        background: white !important;
        z-index: 1 !important;
        /* Reduced z-index */
        padding: 20px 12px !important;
        /* Elegant horizontal padding so buttons don't touch screen edges */
        /* margin-top: 20px !important; */
        /* margin-bottom: 24px !important; */
        /* Override large bottom margin (like 80px inline) on mobile */
        border-top: none !important;
        box-shadow: none !important;
        display: flex !important;
        gap: 12px !important;
        justify-content: center !important;
        /* Center align buttons */
    }


    .action-btn-draft,
    .action-btn-back {
        min-width: auto !important;
        flex: 1 !important;
        border-radius: 50px !important;
        padding: 12px 8px !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        border: 1.5px solid #cbd5e1 !important;
        background: #ffffff !important;
        color: #1e293b !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        text-transform: uppercase;
    }

    .action-btn-save {
        min-width: auto !important;
        flex: 1.6 !important;
        border-radius: 50px !important;
        padding: 12px 8px !important;
        font-size: 1rem !important;
        font-weight: 800 !important;
        box-shadow: 0 8px 25px -4px rgba(239, 119, 34, 0.45) !important;
        background: linear-gradient(135deg, #b10d0d 0%, #b10d0d 100%) !important;
        color: white !important;
        border: none !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .action-btn-save i,
    .action-btn-draft i,
    .action-btn-back i {
        font-size: 1.1rem !important;
    }

    @keyframes slideUpFooter {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}





.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ffffff;
    transition: all 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #ffffff;
    padding-left: 20px;
}


.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ffffff;
    transition: all 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #ffffff;
    padding-left: 20px;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ffffff;
    transition: all 0.2s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #ffffff;
    padding-left: 20px;
}

/* Ensure Search Input Wrapper has relative position */
.search-input-wrapper {
    position: relative;
    /* To anchor suggestions */
}

/* Mobile Settings Modal Sidebar adjustments */
@media (max-width: 768px) {
    .settings-modal {
        max-width: 85%;
        /* Slightly narrower sidebar on very small screens if desired, or 100% */
    }
}

/* Sale Invoice Page Styles - Compact Version */

.sale-invoice-wrapper {
    padding: 1rem;
    background: #EBEBEB;
    min-height: 100vh;
}

/* Header */
.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sale-header-left {
    flex: 1;
}

.sale-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.sale-subtitle {
    color: #64748b;
    margin: 0;
    font-size: 1rem;
}

.sale-header-right {
    display: flex;
    gap: 0.75rem;
}

.btn-sale-primary {
    background: #b10d0d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(239, 119, 34, 0.25);
}

.btn-sale-primary:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 119, 34, 0.35);
}

/* Filter Card */
.sale-filter-card {
    background: white;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: #1e293b;
    font-size: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.filter-label-small {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

.filter-select,
.filter-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    min-width: 120px;
    transition: all 0.3s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #b10d0d;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.1);
}

.filter-grid-custom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-grid-custom .filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-grid-custom .search-wrapper {
    grid-column: span 2;
}

.filter-grid-custom .form-control,
.filter-grid-custom .form-select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

.filter-grid-custom .form-control:focus,
.filter-grid-custom .form-select:focus {
    background-color: #fff;
    border-color: #b10d0d;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.1);
}

.filter-grid-custom .input-group-text {
    border-radius: 8px 0 0 8px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
}

.filter-grid-custom .input-group .form-control {
    border-radius: 0 8px 8px 0;
}

.action-btns-group .btn {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}

.action-btns-group .btn-light {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.action-btns-group .btn-light:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

.filter-grid-custom .filter-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.filter-grid-custom .filter-item:hover .filter-label {
    color: #1e293b;
}

.filter-grid-custom .filter-label i {
    width: 20px;
    font-size: 1rem;
    opacity: 0.7;
    margin-right: 4px;
}

.filter-grid-custom .filter-item:nth-child(1) .filter-label i {
    color: #BBE0EF !important;
}

/* Blue for Search */
.filter-grid-custom .filter-item:nth-child(2) .filter-label i {
    color: #8b5cf6 !important;
}

/* Purple for Type */
.filter-grid-custom .filter-item:nth-child(3) .filter-label i {
    color: #2563eb !important;
}

/* Orange for Stock */
.filter-grid-custom .filter-item:nth-child(4) .filter-label i {
    color: #10b981 !important;
}

/* Green for Limit */

.action-btns-group .btn-primary-custom:active {
    transform: scale(0.95);
}

/* Stats Grid */
.sale-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}


.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-primary .stat-icon {
    background: linear-gradient(135deg, #FF6B35, #FF8C42);
    color: white;
}

.stat-success .stat-icon {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.stat-warning .stat-icon {
    background: linear-gradient(135deg, #2563eb, #fbbf24);
    color: white;
}

.stat-info .stat-icon {
    background: linear-gradient(135deg, #0EA5E9, #38bdf8);
    color: white;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.stat-trend.positive {
    background: #dcfce7;
    color: #16a34a;
}

.stat-trend.negative {
    background: #fee2e2;
    color: #dc2626;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.15rem;
}

.stat-label {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 500;
}

.stat-footer {
    color: #94a3b8;
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

/* Actions Bar */
.sale-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #b10d0d;
    box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.1);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-action {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-action:hover {
    border-color: #b10d0d;
    color: #b10d0d;
    background: rgba(239, 119, 34, 0.05);
}

/* Transactions Section */
.transactions-section {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1rem 0;
}

.table-container {
    overflow-x: auto;
}

.sale-table {
    width: 100%;
    border-collapse: collapse;
}

.sale-table thead {
    background: #ffffff;
}

.sale-table th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.82rem;
    text-transform: uppercase;
    border-bottom: 1px solid #cbd5e1;
}

.sale-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    font-size: 1rem;
}

.sale-table tbody tr {
    transition: all 0.3s;
}

.sale-table tbody tr:hover {
    background: #ffffff;
}

.no-data {
    text-align: center;
}

/* (Style removed and moved to global style.css) */

/* Status Badges */
.status-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-paid {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 3px 10px;
    border-radius: 6px;
}

.status-pending,
.status-partial {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
    padding: 3px 10px;
    border-radius: 6px;
}

.status-overdue,
.status-unpaid,
.status-rejected {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 3px 10px;
    border-radius: 6px;
}

/* Action Buttons in Table */
.table-action-btn {
    background: none;
    border: none;
    color: #64748b;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 6px;
}

.table-action-btn:hover {
    background: #f1f5f9;
    color: #FF6B35;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #cbd5e1;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 2px solid #cbd5e1;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    color: #64748b;
}

.pagination-btn:hover {
    border-color: #FF6B35;
    color: #FF6B35;
}

.pagination-btn.active {
    background: #FF6B35;
    border-color: #FF6B35;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sale-invoice-wrapper {
        padding: 10px;
        background: #ffffff;
        /* Lighter background for the page */
        padding-bottom: 80px;
    }

    /* --- Header --- */
    .sale-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .sale-header-right {
        display: none;
    }

    .sale-title {
        font-size: 1.25rem;
        color: #334155;
    }

    .sale-subtitle {
        font-size: 0.82rem;
    }

    /* --- Stats Grid (Compact) --- */
    .sale-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 0.75rem;
    }

    .stat-card {
        padding: 8px 10px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
        border: 1px solid #f1f5f9;
        display: flex;
        flex-direction: row;
        /* Horizontal layout for mobile */
        align-items: center;
        gap: 8px;
        height: auto;
        min-height: 54px;
        /* Fixed small height */
    }

    .stat-header {
        margin-bottom: 0;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .stat-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .stat-value {
        font-size: 1rem;
        margin-bottom: -2px;
        line-height: 1.1;
    }

    .stat-label {
        font-size: 0.82rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .stat-trend {
        position: absolute;
        top: 4px;
        right: 4px;
        font-size: 0.82rem;
        padding: 1px 4px;
        display: none;
        /* Hide trend on ultra compact mobile */
    }

    /* --- Filter Section (Optimized) --- */
    .sale-filter-card {
        padding: 10px;
        border-radius: 10px;
        border: 1px solid #f1f5f9;
        margin-bottom: 1rem;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    }

    /* Filter Grid for Mobile - Single Column Stack */
    .filter-grid-custom {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding-top: 1rem !important;
    }

    /* Fields should be full width */
    .filter-grid-custom .filter-item {
        width: 100%;
    }

    /* Make inputs smaller but comfortable */
    .filter-grid-custom .form-control,
    .filter-grid-custom .form-select {
        font-size: 1rem;
        padding: 8px 10px;
        height: 40px;
    }

    .filter-label {
        font-size: 0.82rem !important;
        font-weight: 800 !important;
        color: #475569 !important;
        margin-bottom: 6px !important;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        letter-spacing: 0.5px;
    }

    .filter-label i {
        margin-right: 8px;
        font-size: 0.85rem;
    }

    /* Buttons in filters - Aligned to right and stacked like in the image */
    .action-btns-group {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        margin-top: 4px;
        width: 100% !important;
        margin-left: 0 !important;
    }

    .action-btns-group .btn {
        width: 140px;
        /* Fixed width for standard action buttons on mobile */
        height: 36px;
        font-size: 1rem;
        padding: 0 16px;
        justify-content: flex-start;
        /* Align content to start of the small button */
    }

    .action-btns-group .btn-primary-custom {
        width: 140px;
        background-color: #b10d0d !important;
        border-color: #b10d0d !important;
        justify-content: center;
        /* Center Refresh button */
    }

    /* --- Transactions Section & Cards --- */
    .transactions-section {
        background: transparent;
        padding: 0;
        box-shadow: none;
    }

    .section-title {
        display: none;
    }

    .table-container {
        overflow-x: visible;
    }

    .sale-table thead {
        display: none;
    }

    .sale-table,
    .sale-table tbody,
    .sale-table tr,
    .sale-table td {
        display: block;
        width: 100%;
    }

    .sale-table {
        min-width: 0 !important;
    }

    /* Card Styling - White + Colorful Light */
    .sale-table tbody tr {
        background: #fff;
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 10px;
        position: relative;
        border: 1px solid #cbd5e1;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);

        display: grid;
        grid-template-columns: 1fr auto;
        gap: 6px;
    }

    /* Colorful Light Left Border Accent based on nth-child for variety */
    .sale-table tbody tr:nth-child(4n+1) {
        border-left: 4px solid #BBE0EF;
    }

    /* Blue */
    .sale-table tbody tr:nth-child(4n+2) {
        border-left: 4px solid #10b981;
    }

    /* Green */
    .sale-table tbody tr:nth-child(4n+3) {
        border-left: 4px solid #2563eb;
    }

    /* Orange */
    .sale-table tbody tr:nth-child(4n+4) {
        border-left: 4px solid #8b5cf6;
    }

    /* Purple */

    .sale-table td {
        padding: 0;
        border: none;
        text-align: left;
    }

    /* 1. Checkbox - Hide */
    .sale-table td:nth-child(1) {
        display: none;
    }

    /* 2. Invoice # (Top Right) */
    .sale-table td:nth-child(2) {
        grid-column: 2 / 3;
        grid-row: 1;
        font-size: 0.82rem;
        color: #94a3b8;
        font-weight: 500;
        text-align: right;
    }

    .sale-table td:nth-child(2):before {
        content: '#';
    }

    /* 3. Date (Top Left - Small) */
    .sale-table td:nth-child(3) {
        grid-column: 1 / 2;
        grid-row: 1;
        font-size: 0.82rem;
        color: #94a3b8;
    }

    /* 4. Party Name */
    .sale-table td:nth-child(4) {
        grid-column: 1 / 2;
        /* Takes left side now */
        grid-row: 2;
        font-size: 0.9rem;
        font-weight: 700;
        color: #334155;
        margin-bottom: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 5. Items (Show) - Row 2 Right (Small) */
    .sale-table td:nth-child(5) {
        display: flex;
        /* Turn on */
        grid-column: 2 / 3;
        grid-row: 2;
        font-size: 0.82rem;
        color: #64748b;
        justify-content: flex-end;
        align-items: center;
    }

    .sale-table td:nth-child(5):before {
        content: 'Items:';
        margin-right: 2px;
        font-size: 0.82rem;
    }

    /* 6 - Hide */
    .sale-table td:nth-child(6) {
        display: none;
    }

    /* 7. Amount */
    .sale-table td:nth-child(7) {
        grid-column: 1 / 2;
        grid-row: 3;
        font-size: 0.85rem;
        font-weight: 700;
        color: #334155;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .sale-table td:nth-child(7):before {
        content: 'Amt:';
        font-size: 0.82rem;
        font-weight: 500;
        color: #94a3b8;
    }

    /* 9. Balance */
    .sale-table td:nth-child(9) {
        grid-column: 2 / 3;
        grid-row: 3;
        font-size: 0.85rem;
        font-weight: 700;
        color: #ef4444;
        text-align: right;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
    }

    .sale-table td:nth-child(9):before {
        content: 'Bal:';
        font-size: 0.82rem;
        font-weight: 500;
        color: #94a3b8;
    }

    /* 10. Status (Badge) - Row 4 Right */
    .sale-table td:nth-child(10) {
        grid-column: 2 / 3;
        grid-row: 4;
        text-align: right;
        margin-top: 4px;
    }

    /* 8. Received - Row 4 Left */
    .sale-table td:nth-child(8) {
        display: flex;
        grid-column: 1 / 2;
        grid-row: 4;
        font-size: 0.85rem;
        font-weight: 600;
        color: #059669;
        /* Greenish */
        align-items: center;
        gap: 4px;
        margin-top: 4px;
    }

    .sale-table td:nth-child(8):before {
        content: 'Rcvd:';
        font-size: 0.82rem;
        font-weight: 500;
        color: #94a3b8;
    }

    .sale-table td:nth-child(10) .status-badge {
        font-size: 0.82rem;
        padding: 2px 8px;
        border-radius: 12px;
        font-weight: 600;
        display: inline-block;
    }

    /* Colorful Light Badges Override */
    .status-paid {
        /* background: #ecfdf5 !important; */
        color: #059669 !important;
        border: 1px solid #d1fae5 !important;
    }

    .status-pending {
        background: #fffbeb !important;
        color: #d97706 !important;
        border: 1px solid #fde68a !important;
    }

    .status-overdue {
        background: #fef2f2 !important;
        color: #dc2626 !important;
        border: 1px solid #fecaca !important;
    }

    /* 11. Actions (Row 5 - Full Width) */
    .sale-table td:nth-child(11) {
        grid-column: 1 / -1;
        grid-row: 5;
        margin-top: 8px;
        display: flex;
        gap: 12px;
        justify-content: center;
        border-top: 1px dashed #cbd5e1;
        padding-top: 8px;
    }

    .table-action-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #ffffff;
        border: 1px solid #dae1e7;
        color: #64748b;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .table-action-btn:hover {
        background: #f1f5f9;
        color: #0f172a;
        border-color: #cbd5e1;
    }

    .table-action-btn i {
        font-size: 0.9rem;
    }

}

/* Global Footer Section Styling */
.invoice-footer-section {
    /* background: white !important; */
    /* padding: 0.5rem !important; */
    /* border-radius: 12px !important; */
    /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important; */
    /* border: 1px solid #cbd5e1 !important; */
    margin-top: 0rem !important;
}

/* Restore negative margins for rows inside the footer section (negating style.css line 32 override) */
.invoice-footer-section .row {
    margin-left: calc(var(--bs-gutter-x) * -0.5) !important;
    margin-right: calc(var(--bs-gutter-x) * -0.5) !important;
}

/* ==========================================================================
   PREMIUM SUGGESTIONS REDESIGN (UNIQUE CLASSES v2)
   ========================================================================== */

/* ==========================================================================
   ULTRA-PREMIUM SUGGESTIONS REDESIGN (Sunder Sa)
   ========================================================================== */

.premium-suggest-list,
.item-suggestions,
#party-suggestions,
#phone-suggestions {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px) saturate(160%);
    -webkit-backdrop-filter: blur(15px) saturate(160%);
    border-radius: 12px;
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    width: auto;
    min-width: 300px;
    max-width: 450px;
    max-height: min(380px, calc(100vh - 120px));
    overflow-y: auto !important;
    overflow-x: hidden;
    animation: suggestPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Internal UL should not have its own box styling now */
.premium-suggest-list {
    list-style: none;
    padding: 6px;
    margin: 0;
    max-height: 350px;
    overflow-y: auto !important;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    display: block;
}

/* Custom Scrollbar */
.premium-suggest-list::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.premium-suggest-list::-webkit-scrollbar-track {
    background: transparent;
}

.premium-suggest-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

@keyframes suggestPop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Custom Scrollbar for Suggestions */
.premium-suggest-list::-webkit-scrollbar,
.item-suggestions::-webkit-scrollbar {
    width: 5px;
}

.premium-suggest-list::-webkit-scrollbar-thumb,
.item-suggestions::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.5);
    border-radius: 10px;
}

.premium-suggest-item,
.item-suggestion {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8f8f8;
    border: 1px solid #e6eaf0;
    position: relative;
    overflow: hidden;
}

.premium-suggest-item:hover,
.premium-suggest-item.highlighted,
.item-suggestion:hover,
.item-suggestion.highlighted {
    background: #fff7ed !important;
    border-color: rgba(239, 119, 34, 0.3) !important;
}

.premium-suggest-item:hover::before,
.premium-suggest-item.highlighted::before,
.item-suggestion:hover::before,
.item-suggestion.highlighted::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: #b10d0d;
    border-radius: 0 4px 4px 0;
    z-index: 10;
}

.premium-item-header,
.item-suggestion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.premium-client-name,
.item-suggestion-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.premium-client-badge,
.item-suggestion-price {
    font-size: 0.82rem;
    background: #515151;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid #575151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-left: 5px;
}

.item-suggestion-price {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    border-color: #fee2e2;
}

.premium-item-meta,
.item-suggestion-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 2px;
}

.premium-item-meta i,
.item-suggestion-details i {
    font-size: 0.82rem;
    color: #94a3b8;
}

.premium-meta-phone,
.premium-meta-address {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.premium-meta-address {
    max-width: 200px;
}

.premium-meta-divider {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 300;
}

/* Add Button in Suggestions */
.premium-suggest-add,
.item-suggestion-add {
    font-weight: 700 !important;
    color: #b10d0d !important;
    background: #fff7ed !important;
    justify-content: flex-start !important;
    align-items: center !important;
    flex-direction: row !important;
    padding: 12px 16px !important;
    gap: 12px !important;
    border: 1px dashed #fdba74 !important;
    white-space: normal !important;
    line-height: 1.4 !important;
    border-radius: 16px !important;
}

.premium-add-icon {
    font-size: 1.25rem;
    color: #b10d0d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-add-title {
    font-size: 0.85rem;
    font-weight: 700;
}

.premium-add-subtitle {
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0.8;
}

.premium-suggest-add:hover,
.premium-suggest-item:hover,
.item-suggestion-add:hover {
    background: #ffedd5 !important;
    border-style: solid !important;
}

/* Close strip at top of suggestion dropdowns */
.sugg-close-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 8px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #f1f5f9;
    cursor: default;
}

.sugg-close-strip button:hover,
.sugg-x-btn:hover {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #dc2626 !important;
}

/* Inline × button inside close strip */
.sugg-x-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 10px;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.15s ease;
    line-height: 1;
}

/* Close button for item suggestions */
.sugg-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(241, 245, 249, 0.95);
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    font-size: 10px;
    z-index: 10001;
    transition: all 0.18s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
    padding: 0;
}

.sugg-close-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}


/* Reset padding for suggestions now that we use a strip */
.item-suggestions.active,
#party-suggestions,
#phone-suggestions {
    padding-top: 0 !important;
    border: 2px solid #e50e04 !important;
    box-shadow: 0 20px 40px -5px rgb(231 24 24 / 18%), 0 8px 20px -5px rgb(239 34 34 / 10%) !important;
    animation: suggestPopActive 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes suggestPopActive {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Highlight the table row currently active/focused or with suggestions dropdown */
.invoice-items-table tbody tr.active-row,
.invoice-items-table tbody tr.suggestions-active-row {
    position: relative !important;
    z-index: 104 !important;
    /* Elevated above overlay */
}

.invoice-items-table tbody tr.active-row td,
.invoice-items-table tbody tr.suggestions-active-row td {
    background-color: #fff9f2 !important;
    /* Premium soft warm orange glow */
    border-top: 1.5px solid #b10d0d !important;
    border-bottom: 1.5px solid #b10d0d !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.invoice-items-table tbody tr.active-row td:first-child,
.invoice-items-table tbody tr.suggestions-active-row td:first-child {
    border-left: 4px solid #b10d0d !important;
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
}

.invoice-items-table tbody tr.active-row td:last-child,
.invoice-items-table tbody tr.suggestions-active-row td:last-child {
    border-right: 2.5px solid #b10d0d !important;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
}

/* Active inputs in active/suggestions row get a crisp focus background */
.invoice-items-table tbody tr.active-row input:not([readonly]),
.invoice-items-table tbody tr.active-row select,
.invoice-items-table tbody tr.suggestions-active-row input:not([readonly]),
.invoice-items-table tbody tr.suggestions-active-row select {
    background-color: #ffffff !important;
    border-color: #fdba74 !important;
}

/* Ensure suggestions dropdown is elevated above row z-index */
.item-suggestions.active {
    z-index: 10060 !important;
}


@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Elevate the table container above the overlay when suggestions are active */
.invoice-editor-wrapper:has(tr.suggestions-active-row) .invoice-items-section {
    position: relative !important;
    z-index: 10000 !important;
    /* Above global overlay */
}

/* Dim other rows, headers, and footers in the table when suggestions are active */
.invoice-items-table:has(tbody tr.suggestions-active-row) tbody tr:not(.suggestions-active-row) {
    opacity: 0.85;
    filter: brightness(0.8) contrast(0.85) grayscale(30%) blur(0.3px);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.invoice-items-table:has(tbody tr.suggestions-active-row) thead,
.invoice-items-table:has(tbody tr.suggestions-active-row) tfoot {
    opacity: 0.8;
    filter: brightness(0.8);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

/* =========================================
   GRID VIEW MODE (User Requested)
   2-Column Layout for Items Table with Scroll
   ========================================= */
@media (min-width: 768px) {
    .invoice-items-table.grid-view-mode {
        display: flex;
        flex-direction: column;
        height: 600px;
        /* Fixed height for scroll container */
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        background: #ffffff;
    }

    .invoice-items-table.grid-view-mode thead {
        display: none;
        /* Hide traditional headers */
    }

    .invoice-items-table.grid-view-mode tbody {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        /* 2 Columns */
        gap: 15px;
        padding: 15px;
        overflow-y: auto;
        flex: 1;
        /* Take available space */
        align-content: start;
        /* Prevent stretching */
    }

    .invoice-items-table.grid-view-mode tbody tr {
        display: flex;
        /* Card Layout */
        flex-direction: row;
        flex-wrap: wrap;
        background: #ffffff;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        margin-bottom: 0;
        /* Gap handles spacing */
        height: fit-content;
        position: relative;
        transition: all 0.2s ease;
    }

    .invoice-items-table.grid-view-mode tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        border-color: #cbd5e1;
        z-index: 5;
    }

    .invoice-items-table.grid-view-mode tbody tr.active-row {
        border-color: #b10d0d;
        box-shadow: 0 0 0 1px #b10d0d;
        background: #fffaf5;
    }

    /* Cell Restructuring for Card */
    .invoice-items-table.grid-view-mode td {
        display: flex;
        flex-direction: row;
        align-items: center;
        width: 50%;
        /* 2 items per row inside card */
        padding: 4px 8px;
        border: none;
        font-size: 0.82rem;
        box-sizing: border-box;
    }

    /* Full Width Cells */
    .invoice-items-table.grid-view-mode td[data-label="Item"],
    .invoice-items-table.grid-view-mode td[data-label="Batch"],
    .invoice-items-table.grid-view-mode td[data-label="Total"] {
        width: 100%;
        padding-bottom: 8px;
    }

    .invoice-items-table.grid-view-mode td[data-label="Item"] {
        border-bottom: 1px solid #f1f5f9;
        margin-bottom: 8px;
    }

    /* Labels */
    .invoice-items-table.grid-view-mode td::before {
        content: attr(data-label) ": ";
        font-weight: 700;
        color: #64748b;
        margin-right: 6px;
        font-size: 0.82rem;
        text-transform: uppercase;
        min-width: 50px;
    }

    /* Hide label for Item Name */
    .invoice-items-table.grid-view-mode td[data-label="Item"]::before {
        display: none;
    }

    /* Footer/Add Button Area */
    .invoice-items-table.grid-view-mode tfoot {
        display: block;
        padding: 10px;
        background: #fff;
        border-top: 1px solid #cbd5e1;
        flex-shrink: 0;
    }

    .invoice-items-table.grid-view-mode tfoot tr,
    .invoice-items-table.grid-view-mode tfoot td {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
    }

    /* Reveal hidden columns in grid view if previously hidden */
    .invoice-items-table.grid-view-mode .col-hidden {
        display: flex !important;
    }

    /* Action Button Positioning */
    .invoice-items-table.grid-view-mode td.action-cell {
        position: absolute;
        top: 8px;
        right: 8px;
        width: auto;
        padding: 0;
    }
}


/* Laptop Horizontal Scroll Mode */
@media (min-width: 768px) and (max-width: 1440px) {
    .table-responsive {
        display: block;
        width: 100%;
        /* overflow-x: auto !important; */
        -webkit-overflow-scrolling: touch;
        border: 0 !important;
    }

    /* Ensure table has minimum width to trigger scroll instead of squeezing */
    .invoice-items-table {
        min-width: 1100px;
    }
}

/* --- MODERN ADDITIONAL CHARGES (TRANSPORT & HANDLING) --- */
.charges-card {
    border-radius: 16px !important;
    /* Rounded corners (16px) */
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03) !important;
    /* Soft shadow */
    border: 1px solid rgb(163 179 199) !important;
    /* Subtle border */
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    width: 100% !important;
    padding: 0 !important;
    /* Touch colored strip to edge */
}

/* Color themes for accordions based on names/ids */
#additional-charges-accordion,
.charges-card[id*="charges"],
.charges-card[id*="transport"] {
    border-left: 4px solid #3b82f6 !important;
    /* Blue vertical strip */
    background: #f8fafc !important;
    /* Tinted blue-slate */
}

#invoice-note-accordion,
.charges-card[id*="note"],
.charges-card[id*="remark"] {
    border-left: 4px solid #f59e0b !important;
    /* Amber vertical strip */
    background: #fffbeb !important;
    /* Tinted amber */
}

.charges-card[id*="extra"],
.charges-card[id*="info"] {
    border-left: 4px solid #10b981 !important;
    /* Green vertical strip */
    background: #f0fdf4 !important;
    /* Tinted green */
}

.charges-card h6 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin: 0 !important;
    padding: 10px 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1e3a8a !important;
    /* Navy blue primary */
    cursor: pointer !important;
    user-select: none !important;
    /* Minimal height 50-55px */
    box-sizing: border-box !important;
}

.charges-card h6 span {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.charges-card h6 span i {
    font-size: 16px !important;
}

.charges-card .toggle-icon {
    font-size: 11px !important;
    color: #64748b !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Open state: chevron points UP */
.charges-card .toggle-icon {
    transform: rotate(-180deg) !important;
}

/* Collapsed state (default): chevron points DOWN */
.charges-card.collapsed .toggle-icon {
    transform: rotate(0deg) !important;
}

.charges-content {
    max-height: 1500px !important;
    opacity: 1 !important;
    overflow: hidden !important;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.3s ease !important;
    padding: 0 6px 6px 6px !important;
    box-sizing: border-box !important;
}

.charges-card.collapsed .charges-content {
    max-height: 0 !important;
    opacity: 0 !important;
    padding: 0 6px 0 6px !important;
    pointer-events: none !important;
}

.charges-card table {
    font-size: 0.78rem;
}

.charges-card th {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 1.5px solid #f1f5f9;
    font-weight: 700;
    padding-bottom: 6px;
}

.charges-card td {
    padding: 3px;
    vertical-align: middle;
    background: #ffffff;
}

.charge-input {
    width: 100% !important;
    height: 30px !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 0 8px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    text-align: right !important;
    background: #ffffff !important;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

.charge-input:focus {
    border-color: #161E54 !important;
    background: #ffffff !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(22, 30, 84, 0.1) !important;
}

.charge-select {
    width: 100% !important;
    color: #1e293b !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    padding: 0 8px !important;
    padding-right: 24px !important;
    appearance: auto !important;
    /* Use standard arrow to avoid white-on-white issues */
    font-weight: 600 !important;
    width: 100% !important;
    height: 30px !important;
    font-size: 0.78rem !important;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px;
    padding-right: 20px !important;
}

.charge-select:focus {
    border-color: #161E54 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(22, 30, 84, 0.1) !important;
}

.charge-result-val {
    font-weight: 500;
    color: #64748b;
    font-size: 1rem;
}

.charge-total-val {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.82rem;
}

/* Mobile Responsive Logic for Charges */
@media (max-width: 768px) {

    .charges-card table,
    .charges-card thead,
    .charges-card tbody,
    .charges-card tr,
    .charges-card td {
        display: block;
        width: 100% !important;
    }

    .charges-card thead {
        display: none;
    }

    .charges-card tr {
        margin-bottom: 8px;
        padding: 8px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: #ffffff;
        display: flex !important;
        flex-wrap: wrap;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    }

    .charges-card td {
        padding: 0 !important;
        border: none !important;
        margin-bottom: 4px;
    }

    .charge-name-col {
        flex: 0 0 100%;
        font-size: 0.85rem;
        font-weight: 800;
        color: #1e293b;
        border-bottom: 1px solid #f1f5f9 !important;
        padding-bottom: 4px !important;
        margin-bottom: 8px !important;
    }

    .charges-card td[data-label="Amount"],
    .charges-card td[data-label="GST Rate"],
    .charges-card td[data-label="GST Type"] {
        flex: 0 0 33.33%;
        padding: 0 3px !important;
        margin-bottom: 8px;
    }

    .charges-card td:before {
        content: attr(data-label);
        font-size: 0.6rem;
        color: #94a3b8;
        font-weight: 700;
        display: block;
        margin-bottom: 2px;
        text-transform: uppercase;
    }

    .charges-card td[data-label="Excl. Tax"],
    .charges-card td[data-label="Tax Amt"] {
        flex: 0 0 33.33%;
        background: #e7e7e7;
        padding: 6px 3px !important;
        text-align: left !important;
        font-size: 0.7rem;
        margin-bottom: 0 !important;
        margin-top: 2px;
    }

    .charges-card td[data-label="Incl. Tax"] {
        flex: 0 0 33.33%;
        background: #fff7ed;
        padding: 5px 3px !important;
        text-align: left !important;
        font-size: 0.7rem;
        margin-bottom: 0 !important;
        margin-top: 2px;
        border: 1px solid #fee2e2;
    }

    /* Rounded corners for the results grey box */
    .charges-card td[data-label="Excl. Tax"] {
        border-radius: 8px 0 0 8px;
    }

    .charges-card td[data-label="Incl. Tax"] {
        border-radius: 0 8px 8px 0;
    }

    .charge-input,
    .charge-select {
        height: 26px !important;
        font-size: 0.75rem !important;
        padding: 0 5px !important;
    }

    /* Collapsible Logic moved outside for global support */
}

/* --- END MODERN ADDITIONAL CHARGES --- */

/* Online Detail Fields Grid */
.online-details-grid {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.online-detail-field {
    height: 28px !important;
    font-size: 10.5px !important;
    border: 1px solid transparent !important;
    background: #ffffff !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    color: #334155 !important;
    padding: 0 8px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.online-detail-field.select {
    flex: 1;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px center !important;
    background-size: 10px !important;
    padding-right: 20px !important;
}

.online-detail-field.input {
    flex: 1.5;
}

.online-detail-field:hover {
    border-color: #cbd5e1 !important;
    background: #ffffff !important;
}

.online-detail-field:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

.online-detail-field::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* Split Payment Tracking Grid - Premium Design (Removed as per user request for standard design) */
/* Purchase Return Refund Section Mobile Optimization */
@media (max-width: 768px) {
    .refund-payment-section {
        margin-top: 10px !important;
        background: #f8fafc;
        padding: 12px;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
    }

    .refund-payment-section .col-12 {
        margin-bottom: 5px;
    }

    .refund-payment-section label {
        font-size: 0.65rem !important;
        color: #64748b !important;
        margin-bottom: 4px !important;
    }

    #paid-amount {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
    }

    .payment-status-badge.balance-due {
        background: #fff5f5 !important;
        border: 1px solid #feb2b2 !important;
        justify-content: center !important;
    }
}

/* --- Custom Refund Payment Grid (No Bootstrap) --- */
.refund-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
    padding: 5px 0;
}

.refund-input-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.refund-label {
    display: block;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 0.5px;
}

.refund-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.refund-currency {
    position: absolute;
    left: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    pointer-events: none;
}

.refund-field {
    width: 100%;
    height: 48px;
    padding: 0 12px 0 32px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    outline: none;
    color: #1e293b;
}

.refund-field:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.refund-status-badge {
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    position: relative;
    border: 1.5px solid transparent;
}

.refund-status-badge .refund-currency {
    position: static;
    margin-right: 4px;
}

.refund-status-badge.balance-due {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #e53e3e;
}

.refund-status-badge.paid-in-full {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #2f855a;
}

/* Mobile Responsiveness for Custom Grid */
@media (max-width: 576px) {
    .refund-payment-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        background: #f8fafc;
        padding: 15px;
        border-radius: 16px;
        border: 1px solid #e2e8f0;
    }

    .refund-field {
        background: #ffffff;
    }

    .refund-status-badge {
        justify-content: center;
    }
}

/* --- Premium Refund Payment Flex (Single Row Optimization) --- */
.refund-payment-flex {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    width: 100%;
}

.refund-item-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    /* Prevents flex items from overflowing */
}

.refund-item-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.refund-input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    height: 42px;
    transition: all 0.2s ease;
}

.refund-input-group:focus-within {
    border-color: #6366f1;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.refund-icon-prefix {
    padding: 0 10px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #64748b;
}

.refund-input-field {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0 10px 0 0;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    outline: none;
    color: #1e293b;
}

.refund-display-badge {
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    border: 1.5px solid transparent;
    overflow: hidden;
}

.refund-display-badge.balance-due {
    background: #fff5f5;
    border-color: #feb2b2;
    color: #ef4444;
}

.refund-display-badge.paid-in-full {
    background: #f0fff4;
    border-color: #9ae6b4;
    color: #10b981;
}

/* Ensure single row on all screens */
@media (max-width: 576px) {
    .refund-payment-flex {
        gap: 8px;
    }

    .refund-item-label {
        font-size: 0.62rem;
    }

    .refund-input-field,
    .refund-display-badge {
        font-size: 0.9rem;
    }

    .refund-input-group,
    .refund-display-badge {
        height: 38px;
        padding: 0 8px;
    }

    .refund-icon-prefix {
        padding: 0 5px;
    }
}

/* --- Mobile-Specific Refinements for Single Row Payment --- */
@media (max-width: 480px) {
    .refund-payment-flex {
        gap: 6px;
        background: #f8fafc;
        padding: 8px;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        margin-top: 10px;
    }

    .refund-item-box {
        gap: 2px;
    }

    .refund-item-label {
        font-size: 10px !important;
        opacity: 0.8;
    }

    .refund-input-group,
    .refund-display-badge {
        height: 34px !important;
        border-radius: 8px !important;
        padding: 0 5px !important;
    }

    .refund-icon-prefix {
        font-size: 1rem !important;
        padding: 0 3px !important;
    }

    .refund-input-field,
    #balance-amount {
        font-size: 0.85rem !important;
    }

    /* Abbreviate labels on very small screens if needed */
    .refund-item-box[id="received-row"] .refund-item-label::after {
        content: " (Ref.)";
        display: none;
        /* Hide full text if needed, but let's keep it for now */
    }
}

/* --- Summary Card Mobile Padding Optimization --- */
@media (max-width: 576px) {
    .invoice-summary-card .p-2 {
        padding: 0.5rem !important;
        /* Make it even tighter for small screens */
    }
}

/* --- Prevent Text Wrapping in Refund Section --- */
.refund-input-field,
#balance-amount {
    white-space: nowrap;
}

/* Barcode Scanner Compact Styles */
.barcode-scanner-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.scanner-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.scanner-dot-compact {
    width: 32px;
    height: 32px;
    background: #f8fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
}

.scanner-dot-compact.active {
    background: #ecfdf5;
    color: #10b981;
    border-color: #a7f3d0;
}

.scanner-dot-compact.processing {
    background: #eff6ff;
    color: #3b82f6;
    border-color: #bfdbfe;
}

.status-pulse-compact {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.2;
    animation: scanner-pulse 2s infinite;
}

@keyframes scanner-pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.scanner-title-compact {
    font-size: 0.85rem;
    font-weight: 800;
    margin: 0;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scanner-subtitle-compact {
    font-size: 0.65rem;
    color: #64748b;
    font-weight: 600;
    display: block;
}

.scanner-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-camera-compact {
    padding: 0.5rem 0.85rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-camera-compact:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.scanner-divider {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 0.25rem;
}

.btn-settings-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-settings-icon:hover {
    background: #f1f5f9;
    color: #64748b;
}

/* ==========================================================================
   GLOBAL PREMIUM DESIGN STANDARDIZATION (Consistent Radius, Padding, & Spacing)
   ========================================================================== */

/* 1. Outer Cards & Panels (Consistent 10px Radius & 12px Padding) */

.barcode-scanner-compact,
.barcode-scanner-bar,
.invoice-items-section {
    background: white !important;
    padding: 0.44rem !important;
    border-radius: 0 !important;
    /* margin-bottom: 0.75rem; */
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;

}

.invoice-summary-card {
    background: #f4f0fd !important;
    padding: 10px !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid #cbd5e1 !important;
    overflow: visible !important;
}

#gst-breakdown-summary {
    background: #fcffe0 !important;
}

/* Specific spacing fix to prevent touching cards */
.charges-card {
    margin-bottom: 15px !important;
}

/* 2. Inner Inputs & Controls (Consistent 8px Proportional Inner Radius) */
.form-group-invoice input:not([type="checkbox"]):not([type="radio"]),
.form-group-invoice select,
.form-group-invoice textarea,
.editor-input,
textarea.editor-input,
.charge-input,
.charge-select,
.payment-tracking-rows .form-group-invoice input,
.payment-tracking-rows select,

.qty-stepper button,
.btn-camera-compact,
.btn-settings-icon,
.payment-status-badge {
    border-radius: 8px !important;
}

.payment-tracking-rows {
    background: #d2f2ff !important;
    border: 1px solid #00c6f0 !important;
    padding: 5px !important;
    border-radius: 10px !important;
    overflow: hidden;
}

/* Padding and spacing details for standard fields */
.form-group-invoice textarea,
textarea.editor-input {
    padding: 10px 12px !important;
}

/* Mobile override for only invoice items section border-radius */
@media (max-width: 768px) {
    .invoice-items-section {
        border-radius: 0 !important;
    }
}

/* Restore grid spacing in laptop view while maintaining outer alignment */
.invoice-summary-row {
    --bs-gutter-x: 0rem !important;
    margin-left: calc(var(--bs-gutter-x) * -0.5) !important;
    margin-right: calc(var(--bs-gutter-x) * -0.5) !important;
    padding: 0 !important;
}



/* Mobile bottom sheet and item card styling overrides */
@media (max-width: 768px) {

    /* Empty row design */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 12px !important;
        display: block !important;
        width: 100% !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty .item-search-wrapper {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty .item-search-wrapper::before {
        content: "\f002";
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #b10d0d;
        /* Orange primary search icon */
        font-size: 15px;
        pointer-events: none;
        z-index: 5;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty .item-select {
        width: 100% !important;
        height: 48px !important;
        border-radius: 24px !important;
        border: 1.5px solid #fee2e2 !important;
        background: #fffdfa !important;
        /* Soft cream/white */
        box-shadow: 0 4px 10px rgba(251, 146, 60, 0.05) !important;
        padding-left: 45px !important;
        padding-right: 20px !important;
        font-size: 14px !important;
        color: #7c2d12 !important;
        /* Dark orange-brown text */
        text-align: left !important;
        cursor: pointer;
        box-sizing: border-box;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-empty .item-select::placeholder {
        color: #9a3412 !important;
        opacity: 0.6;
    }

    /* Selected row card design */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        /* Subtle border */
        border-radius: 16px !important;
        /* Rounded corners (16px) */
        padding: 8px 12px !important;
        /* Compact padding */
        margin-bottom: 10px !important;
        box-shadow: 0 4px 12px rgba(30, 58, 138, 0.05) !important;
        /* Soft shadow with navy blue tint */
        position: relative !important;
        box-sizing: border-box !important;
        animation: slideUpFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        min-height: 80px !important;
        border-left: 4px solid #8f070d !important;
    }


    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Row index cell styled as a circular orange badge */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .row-index-cell {
        position: absolute !important;
        top: 10px !important;
        left: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 24px !important;
        height: 24px !important;
        background: #f1f5f9 !important;
        /* Soft premium background */
        color: #1e3a8a !important;
        /* Navy blue primary */
        font-weight: 700 !important;
        border-radius: 50% !important;
        font-size: 11px !important;
        border: 1px solid #cbd5e1 !important;
        padding: 0 !important;
        z-index: 5 !important;
        order: 1 !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .row-index-cell::before {
        display: none !important;
    }

    /* Item details styling */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-item-main {
        width: 100% !important;
        flex: 0 0 100% !important;
        display: block !important;
        padding: 0 34px !important;
        /* Spacing for index badge (left) and delete button (right) */
        box-sizing: border-box !important;
        background: transparent !important;
        border: none !important;
        margin: 0 !important;
        align-self: center !important;
        order: 2 !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-item-main::before {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .item-search-wrapper {
        width: 100% !important;
        overflow: visible !important;
        display: flex !important;
        align-items: center !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        justify-content: space-between;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .item-search-wrapper::after {
        content: "\f304" !important;
        font-family: "Font Awesome 5 Free" !important;
        font-weight: 900 !important;
        font-size: 11px !important;
        margin-left: 6px !important;
        flex-shrink: 0 !important;
        opacity: 0.7 !important;
        background: #e8ebfd !important;
        color: #4d44ef !important;
        border: 1px solid #aab1fd !important;
        border-radius: 8px !important;
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        box-shadow: none !important;
        transition: all 0.2s ease !important;
    }

    .barcode-scanner-compact,
    .barcode-scanner-bar,
    .invoice-items-section {
        background: #f0f2f5 !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .item-select {
        font-size: 14px !important;
        /* Compact but highly readable */
        font-weight: 700 !important;
        color: #0f172a !important;
        /* Premium dark text */
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        text-align: left !important;
        width: 100% !important;
        max-width: 100% !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-transform: capitalize !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        box-shadow: none !important;
    }

    /* Delete / Action Cell Floating Top-Right */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .action-cell {
        position: absolute !important;
        top: 8px !important;
        right: 8px !important;
        display: block !important;
        padding: 0 !important;
        border: none !important;
        width: auto !important;
        z-index: 5 !important;
        order: 3 !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .action-cell::before {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .btn-remove-row {
        background: #fee2e2 !important;
        /* Premium light red background */
        color: #ef4444 !important;
        /* Red accent */
        border: 1px solid #fecaca !important;
        border-radius: 8px !important;
        /* Clean rounded button */
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        box-shadow: none !important;
        transition: all 0.2s ease !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .btn-remove-row:hover,
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .btn-remove-row:active {
        background: #ef4444 !important;
        color: #ffffff !important;
        border-color: #ef4444 !important;
    }

    /* Quantity Stepper Cell */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-qty-main {
        width: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        padding: 0 !important;
        border: none !important;
        align-items: center !important;
        margin-top: 6px !important;
        order: 4 !important;
        align-self: flex-start !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-qty-main::before {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .qty-stepper {
        display: flex !important;
        align-items: center !important;
        background: #f8fafc !important;
        /* Slate light background */
        border: 1px solid #e2e8f0 !important;
        border-radius: 9999px !important;
        /* Pill-shaped */
        padding: 1px !important;
        max-width: 110px !important;
        height: 28px !important;
        /* Slimmer height */
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .qty-stepper .qty-btn {
        width: 24px !important;
        height: 24px !important;
        border-radius: 50% !important;
        border: none !important;
        background: #ffffff !important;
        color: #1e3a8a !important;
        /* Navy blue primary */
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        padding: 0 !important;
        transition: all 0.2s ease !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .qty-stepper .qty-btn:active {
        background: #1e3a8a !important;
        color: #ffffff !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .qty-stepper .item-qty {
        width: 62px !important;
        background: transparent !important;
        border: none !important;
        text-align: center !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Total price positioning */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .desktop-total-cell {
        width: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding: 0 !important;
        border: none !important;
        margin-top: 6px !important;
        order: 5 !important;
        align-self: flex-start !important;
        margin-left: auto !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .desktop-total-cell::before {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .total-amount {
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        /* Slate dark text */
        background: transparent !important;
        border: none !important;
        text-align: right !important;
        padding: 0;
        width: 80px !important;
        outline: none !important;
        pointer-events: none !important;
        /* Readonly total */
    }

    /* More details row */
    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-mobile-actions {
        width: auto !important;
        flex: none !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        border: none !important;
        margin-top: 6px !important;
        order: 6 !important;
        align-self: flex-start !important;
        margin-left: auto !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-mobile-actions:has(.more-link.active) {
        padding-bottom: 20px !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .col-mobile-actions::before {
        display: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .mobile-row-summary {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .more-link {
        color: #ffffff !important;
        /* Subtle slate grey */
        font-weight: 600 !important;
        font-size: 11px !important;
        text-decoration: none !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        cursor: pointer !important;
        background: #9f0a0d !important;
        /* Soft grey background */
        border: 1px solid #c72027 !important;
        border-radius: 6px !important;
        padding: 4px 8px !important;
        transition: all 0.2s ease !important;
        user-select: none !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .more-link:active {
        background: #c72027 !important;
        color: #ffffff !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .more-link::after {
        content: "\f107" !important;
        font-family: "Font Awesome 5 Free" !important;
        font-weight: 900 !important;
        transition: transform 0.2s ease !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .more-link.active::after {
        content: "\f106" !important;
    }

    .invoice-editor-wrapper .invoice-items-table tr.item-row.row-selected .mob-row-total-display {
        display: none !important;
        /* Hidden as we now use desktop-total-cell for amount */
    }

    /* Collapsible Section Layout for Expanded Mode inside Flex Container */
    .invoice-items-table tr.item-row.row-selected .mobile-collapsible {
        display: none !important;
        /* Hidden by default */
    }

    .invoice-items-table tr.item-row.row-expanded .mobile-collapsible:not(.col-hidden) {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 48% !important;
        /* Side by side fields */
        margin-top: 6px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        padding: 4px 6px !important;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
        box-sizing: border-box !important;
        order: 10 !important;
        /* Force to bottom under Row 2 */
        background: #ffffff !important;
    }

    .invoice-items-table tr.item-row.row-expanded .mobile-collapsible:not(.col-hidden):focus-within {
        border-color: #1e3a8a !important;
        /* Navy focus accent */
        box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.08) !important;
    }

    .invoice-items-table tr.item-row.row-expanded .mobile-collapsible::before {
        content: attr(data-label) !important;
        color: #64748b !important;
        font-size: 0.72rem !important;
        font-weight: 500 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        width: auto !important;
        margin-right: 8px !important;
    }

    .invoice-items-table tr.item-row.row-expanded .mobile-collapsible input,
    .invoice-items-table tr.item-row.row-expanded .mobile-collapsible select {
        background: transparent !important;
        border: none !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
        color: #1e293b !important;
        padding: 0 !important;
        height: auto !important;
        text-align: right !important;
        box-shadow: none !important;
        outline: none !important;
        flex: 1 !important;
        min-width: 0 !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch {
        width: 100% !important;
        display: block !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch:not(.col-hidden) {
        display: block !important;
        width: 100% !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        padding: 6px 10px !important;
        margin-top: 8px !important;
        box-sizing: border-box !important;
        order: 11 !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch:not(.col-hidden):focus-within {
        border-color: #1e3a8a !important;
        background: #ffffff !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch .batch-dates-widget {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        margin-top: 0 !important;
        width: 100% !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch .batch-dates-widget .d-flex {
        background: transparent !important;
        border: none !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch .batch-dates-widget input {
        background: transparent !important;
        border: none !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        text-align: left !important;
        padding: 0 8px !important;
    }

    .invoice-items-table tr.item-row.row-expanded .col-batch .batch-dates-widget .bg-light {
        background: transparent !important;
        border: none !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #64748b !important;
    }

    /* Add Row Button styling */
    .invoice-editor-wrapper .btn-add-row {
        width: 100% !important;
        height: 48px !important;
        border-radius: 24px !important;
        border: 2px dashed #ffffff !important;
        background: #06205b !important;
        color: #ffffff !important;
        font-weight: 800 !important;
        font-size: 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 12px rgba(249, 115, 22, 0.05) !important;
        text-transform: uppercase;
        margin-top: 16px !important;
        cursor: pointer !important;
    }
}

/* Mobile Bottom Sheet Overlay & Container */
.mobile-bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0);
    z-index: 2500;
    display: none;
    transition: background-color 0.3s ease;
    backdrop-filter: blur(0px);
}

.mobile-bottom-sheet-overlay.active {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 85%;
    max-height: 85vh;
    background: #fdf7f7;
    /* Soft cream background */
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2501;
    overflow: hidden;
}

.mobile-bottom-sheet.active {
    transform: translateY(0);
}

.sheet-drag-handle {
    width: 44px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 3px;
    margin: 10px auto 14px auto;
    flex-shrink: 0;
}

.sheet-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 14px 16px;
    border-bottom: 1px solid #fee2e2;
    flex-shrink: 0;
}

.sheet-search-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
    pointer-events: none;
}

#sheet-item-search,
#sheet-party-search {
    flex: 1;
    height: 46px;
    border-radius: 23px;
    border: 1.5px solid #fee2e2;
    background: #ffffff;
    padding-left: 42px;
    padding-right: 48px;
    /* space for barcode icon */
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#sheet-item-search:focus,
#sheet-party-search:focus {
    border-color: #b10d0d;
    /* Orange focus border */
}

.sheet-icon-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #b10d0d;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-close-btn {
    background: #ffedd5;
    color: #991b1b;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sheet-body::-webkit-scrollbar,
.sheet-items-list::-webkit-scrollbar,
.mobile-bottom-sheet::-webkit-scrollbar,
#sheet-item-detail-panel::-webkit-scrollbar,
#sheet-parties-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.sheet-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 24px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
}

/* Quick Add Item Form - inline sheet form when item not found */
.sheet-quick-add-form {
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #fee2e2;
    padding: 16px;
    margin: 4px 0;
    box-shadow: 0 4px 18px rgba(185, 28, 28, 0.08);
}

.sheet-quick-add-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    color: #b91c1c;
    margin-bottom: 8px;
}

.sheet-quick-add-header i {
    font-size: 17px;
}

.sheet-quick-add-note {
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 14px;
    line-height: 1.5;
    border-left: 3px solid #fca5a5;
}

.sqaf-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    margin-bottom: 10px;
}

.sqaf-label {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.sqaf-input {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
    font-family: inherit;
}

.sqaf-input:focus {
    border-color: #b91c1c;
    background: #fff;
}

.sqaf-select {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 8px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
    font-family: inherit;
    appearance: auto;
}

.sqaf-select:focus {
    border-color: #b91c1c;
    background: #fff;
}

.sqaf-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.sqaf-error {
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    border: 1px solid #fecaca;
}

.sqaf-save-btn {
    width: 100%;
    background: linear-gradient(135deg, #b91c1c, #ef4444);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(185, 28, 28, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 4px;
    letter-spacing: 0.3px;
    font-family: inherit;
}

.sqaf-save-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.2);
}

.sqaf-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Item card styling inside the bottom sheet */
.sheet-item-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.sheet-item-card:active {
    transform: scale(0.98);
    background: #fffbeb;
    border-color: #fee2e2;
}

/* Out of stock product card - faded look */
.sheet-item-card.sheet-item-out-of-stock {
    background: #fafafa;
    border-color: #f1f1f1;
    opacity: 0.82;
}

.sheet-item-card.sheet-item-out-of-stock .sheet-item-title {
    color: #94a3b8;
}

.sheet-item-card.sheet-item-out-of-stock .sheet-item-price-val {
    color: #94a3b8;
}

/* Service badge */
.sheet-service-badge {
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sheet-item-details-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sheet-item-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.sheet-item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
}

.sheet-item-category {
    font-weight: 500;
}

.sheet-recent-badge {
    background: #ffedd5;
    color: #991b1b;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sheet-stock-badge {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.sheet-stock-badge.out {
    background: #fee2e2;
    color: #ef4444;
}

.sheet-item-details-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sheet-item-price-val {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

<style>

/* Smooth Section Toggle Animation */
.collapsed-section {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, margin 0.3s ease;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.open-section {
    max-height: 600px;
    /* Large enough for transport + more items */
    opacity: 1;
    transition: max-height 0.5s ease-in, opacity 0.4s ease-in, margin 0.3s ease;
}

/* Desktop Single Row Layout for Transport Details */
@media (min-width: 992px) {
    .transport-grid-desktop {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 15px;
    }

    .transport-grid-desktop>div {
        flex: 1;
        width: auto !important;
        max-width: none !important;
    }
}

.summary-select {
    font-size: 0.72rem !important;
    padding: 0 4px !important;
    height: 22px !important;
    border-radius: 6px !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    background: #ffffff !important;
    cursor: pointer;
    width: auto !important;
}

.summary-input {
    width: 100% !important;
    height: 22px !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
    border: 1px solid #e2e8f0 !important;
    text-align: right !important;
    font-weight: 700 !important;
    padding: 0 5px !important;
}

/* Premium Payment Details Styles */
.premium-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 12px;
}

.premium-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.premium-field-group label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-left: 2px;
}

.premium-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 38px !important;
    border-radius: 10px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.premium-input-wrapper:focus-within {
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12) !important;
}

.premium-input-addon {
    height: 100% !important;
    width: 36px !important;
    background: #f1f5f9 !important;
    border-right: 1.5px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    color: #475569 !important;
    pointer-events: none !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.premium-input-wrapper:focus-within .premium-input-addon {
    border-color: #6366f1 !important;
    background: #eef2ff !important;
    color: #6366f1 !important;
}

.premium-input {
    border: none !important;
    height: 100% !important;
    padding: 0 12px !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-grow: 1 !important;
    outline: none !important;
}

.premium-input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.premium-input.text-success {
    color: #16a34a !important;
    /* Premium success green */
}

.premium-balance-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 38px !important;
    border-radius: 10px !important;
    border: 1.5px solid #cbd5e1 !important;
    /* Standard border */
    background: #f8fafc !important;
    /* Neutral background */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.premium-balance-addon {
    height: 100% !important;
    width: 36px !important;
    background: #f1f5f9 !important;
    border-right: 1.5px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    color: #475569 !important;
    pointer-events: none !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
}

.premium-balance-value {
    height: 100% !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    color: #475569 !important;
    /* Neutral text */
    width: 100% !important;
    box-sizing: border-box !important;
    flex-grow: 1 !important;
    text-align: right !important;
    font-family: var(--font-body) !important;
}

/* Tick/Cross styling for row activation */
.item-row.row-unticked {
    opacity: 0.55 !important;
    background-color: #f8fafc !important;
}

.item-row.row-unticked input,
.item-row.row-unticked select,
.item-row.row-unticked button:not(.btn-toggle-tick) {
    background-color: #f1f5f9 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.item-row.row-unticked .action-cell,
.item-row.row-unticked .action-cell *,
.item-row.row-unticked .btn-toggle-tick {
    pointer-events: auto !important;
    cursor: pointer !important;
}

input[readonly],
select[readonly],
textarea[readonly] {
    background: #e7e9ea !important;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Mobile bottom sheet override for Save Confirmation Modal */
@media (max-width: 991.98px) {
    #saveConfirmModal {
        overflow: hidden !important;
    }

    #saveConfirmModal.modal.show {
        display: flex !important;
        align-items: flex-end !important;
        justify-content: center !important;
    }

    #saveConfirmModal.modal.fade .modal-dialog {
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1) !important;
        display: flex !important;
        align-items: flex-end !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
    }

    #saveConfirmModal.modal.show .modal-dialog {
        transform: translateY(0) !important;
    }

    #saveConfirmModal .modal-content {
        border-radius: 24px 24px 0 0 !important;
        max-height: 90vh !important;
        width: 100% !important;
        border: none !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    #saveConfirmModal .modal-body {
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Ensure top-navbar header is under modal backdrop overlay when saveConfirmModal is open */
body:has(#saveConfirmModal.show) #top-navbar,
body.modal-open #top-navbar {
    z-index: 1020 !important;
}

body:has(#saveConfirmModal.show) #top-navbar * {
    pointer-events: none !important;
}

body:has(#saveConfirmModal.show) .modal-backdrop,
body.modal-open:has(#saveConfirmModal.show) .modal-backdrop {
    z-index: 100050 !important;
}

#saveConfirmModal {
    z-index: 100060 !important;
}

/* saveConfirmModal Icon & Text Spacing */
#saveConfirmModal .modal-body label i,
#saveConfirmModal .modal-body .badge i,
#saveConfirmModal .modal-body summary i {
    margin-right: 6px !important;
}

#saveConfirmModal .modal-body button i {
    margin-right: 6px !important;
}

#saveConfirmModal .modal-footer button i {
    margin-right: 8px !important;
}

/* Blur effect on backdrop overlay when a modal is active */
.modal-backdrop.show {
    --bs-backdrop-opacity: 1 !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    background-color: rgba(15, 23, 42, 0.4) !important;
    /* Elegant glass overlay color */
}

/* Wizard default states - Hidden on PC/Desktop */
.mobile-wizard-container,
.mobile-wizard-nav-bar,
.wizard-step-5-finish,
.wizard-step-3-finish {
    display: none !important;
}

/* =========================================
   Mobile Wizard Styles for Step-by-Step Form
   ========================================= */
@media (max-width: 991.98px) {

    /* Add spacing to prevent elements from being covered by the sticky header and bottom buttons */
    .invoice-editor-wrapper {
        padding-bottom: 110px !important;
    }

    /* Hide non-matching wizard steps dynamically */
    .invoice-editor-wrapper[data-current-step="1"] [data-wizard-step]:not([data-wizard-step="1"]) {
        display: none !important;
    }

    .invoice-editor-wrapper[data-current-step="2"] [data-wizard-step]:not([data-wizard-step="2"]) {
        display: none !important;
    }

    .invoice-editor-wrapper[data-current-step="3"] [data-wizard-step]:not([data-wizard-step="3"]) {
        display: none !important;
    }

    .invoice-editor-wrapper[data-current-step="3"] .wizard-step-3-finish {
        display: block !important;
    }

    /* Hide Totals & Calculations card on mobile step 2 - show only in review card */
    .invoice-summary-card {
        display: none !important;
    }



    /* Fix action buttons in footer on mobile view - stacked above wizard indicator */
    /* Fix action buttons in footer on mobile view - stacked above wizard indicator */
    .invoice-actions {
        position: fixed !important;
        bottom: 48px !important;
        /* Raised to leave exact height for wizard container below it (48px) */
        left: 0 !important;
        right: 0 !important;
        background: #ffffff !important;
        border-top: 1px solid #e2e8f0 !important;
        padding: 6px 12px !important;
        /* Reduced padding to save space */
        margin: 0 !important;
        z-index: 1000 !important;
        box-shadow: none !important;
        /* Merge visually with progress bar */
        display: flex !important;
        justify-content: space-between !important;
        gap: 10px !important;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-radius: 0 !important;
    }

    .invoice-actions button {
        flex: 1 !important;
        max-width: 48% !important;
        height: 40px !important;
        /* Smaller buttons */
        border-radius: 10px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        margin: 0 !important;
        font-size: 1rem !important;
    }

    /* Fixed bottom Wizard Progress indicator */
    .mobile-wizard-container {
        display: block !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 48px !important;
        /* Set explicit height to prevent overlaps */
        background: #ffffff !important;
        padding: 5px 12px 0 12px !important;
        /* Vertically centered padding */
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
        border-top: 1px solid #f1f5f9 !important;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05) !important;
        z-index: 1000 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Hide wizard progress bar and adjust actions button position on scroll down */
    body.hide-wizard-progress .invoice-actions {
        bottom: 0 !important;
        border-top: 1px solid #cbd5e1 !important;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08) !important;
    }

    body.hide-wizard-progress .mobile-wizard-container {
        transform: translateY(100%) !important;
    }

    .wizard-progress-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }

    .wizard-progress-line {
        position: absolute;
        top: 11px;
        /* Centered relative to 22px icon */
        left: 5%;
        right: 5%;
        height: 3px;
        background: #e2e8f0;
        z-index: 1;
        transition: width 0.3s ease;
    }

    .wizard-progress-line-active {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        background: #161E54;
        width: 0%;
        transition: width 0.3s ease;
    }

    .wizard-step-node {
        position: relative;
        z-index: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        cursor: pointer;
        width: auto;
    }

    .wizard-step-node .node-icon {
        width: 22px;
        /* Smaller icon node */
        height: 22px;
        border-radius: 50%;
        background: #ffffff;
        border: 2px solid #cbd5e1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.65rem;
        /* Smaller font inside node */
        color: #64748b;
        transition: all 0.3s ease;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .wizard-step-node .node-label {
        font-size: 0.55rem;
        /* Compact label */
        font-weight: 700;
        color: #64748b;
        margin-top: 2px;
        /* Minimal margin */
        text-transform: uppercase;
        letter-spacing: 0.2px;
        text-align: center;
        transition: all 0.3s ease;
    }

    /* Active Step Styling */
    .wizard-step-node.active .node-icon {
        border-color: #161E54;
        color: #161E54;
        background: #f0f4ff;
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(22, 30, 84, 0.15);
    }

    .wizard-step-node.active .node-label {
        color: #161E54;
        font-weight: 800;
    }

    /* Completed Steps Styling */
    .wizard-step-node.completed .node-icon {
        background: #161E54;
        border-color: #161E54;
        color: #ffffff;
    }

    .wizard-step-node.completed .node-label {
        color: #161E54;
    }

    /* Bottom Wizard Nav Bar */
    .mobile-wizard-nav-bar {
        display: flex !important;
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #cbd5e1;
        padding: 10px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    }

    .mobile-wizard-nav-bar .btn {
        flex: 1;
        max-width: 48%;
        height: 46px;
        border-radius: 12px;
        font-weight: 700;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .btn-wizard-back {
        background: #f1f5f9;
        border: 1px solid #cbd5e1;
        color: #475569;
    }

    .btn-wizard-back:active {
        background: #e2e8f0;
    }

    .btn-wizard-next {
        background: #161E54;
        color: #ffffff;
        border: none;
    }

    .btn-wizard-next:active {
        background: #0f153a;
    }

    /* Step 5 Finish Review Styles */
    .wizard-step-5-finish,
    .wizard-step-3-finish {
        animation: fadeIn 0.3s ease;
        padding: 8px 4px;
    }

    .review-card {
        background: #ffffff;
        border-radius: 16px;
        border: 1px solid #cbd5e1;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        padding: 18px;
        margin-bottom: 16px;
    }

    .review-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 1px solid #e2e8f0;
    }

    .review-icon {
        font-size: 1.2rem;
        color: #161E54;
    }

    .review-title {
        font-size: 1rem;
        font-weight: 800;
        color: #1e293b;
        margin: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .review-body {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .review-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.85rem;
    }

    .review-label {
        color: #64748b;
        font-weight: 600;
    }

    .review-value {
        color: #1e293b;
        font-weight: 700;
    }

    .review-divider {
        margin: 8px 0;
        border-color: #e2e8f0;
        opacity: 0.8;
    }

    .review-row.highlight {
        background: #f0f4ff;
        padding: 8px 12px;
        border-radius: 10px;
        border-left: 4px solid #161E54;
        margin-top: 4px;
    }

    .review-row.highlight .review-label {
        color: #161E54;
        font-weight: 800;
    }

    .review-row.highlight .review-value {
        color: #161E54;
        font-size: 1.1rem;
        font-weight: 900;
    }

    .btn-wizard-save {
        width: 100%;
        height: 52px;
        background: #10b981;
        color: #ffffff;
        border: none;
        border-radius: 14px;
        font-weight: 800;
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
        transition: all 0.2s;
    }

    .btn-wizard-save:active {
        background: #059669;
        transform: scale(0.98);
    }

    /* Hide invoice form container when not on Step 1 to remove hidden spacing */
    .invoice-editor-wrapper[data-current-step]:not([data-current-step="1"]) .invoice-form-container {
        display: none !important;
    }
}

/* ==========================================================================
   ITEM DETAIL SHEET - Step 2 Form (sid-* = Sheet Item Detail)
   ========================================================================== */

.sheet-item-detail-panel {
    padding: 0 0 90px 0;
    overflow-y: visible;
    touch-action: pan-y;
}

/* Item Banner */
.sid-item-banner {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.sid-item-banner.out-of-stock {
    background: linear-gradient(135deg, #b10d0d 0%, #dc2626 100%);
}

.sid-item-banner.in-stock {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
}

.sid-item-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 5px;
    line-height: 1.3;
    text-transform: capitalize;
}

.sid-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
}

.sid-stock-ok {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sid-stock-out {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 20px;
    padding: 2px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Form Grid */
.sid-form-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 2px;
}

.sid-field-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.sid-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sid-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.sid-input {
    height: 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.18s;
    -webkit-appearance: none;
}

.sid-input:focus {
    border-color: #b10d0d;
    outline: none;
    box-shadow: 0 0 0 3px rgba(177, 13, 13, 0.1);
}

.sid-select {
    height: 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 26px;
    transition: border-color 0.18s;
}

.sid-select:focus {
    border-color: #b10d0d;
    outline: none;
    box-shadow: 0 0 0 3px rgba(177, 13, 13, 0.1);
}

/* Qty Stepper */
.sid-qty-stepper {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    height: 40px;
    background: #ffffff;
}

.sid-qty-btn {
    width: 36px;
    height: 40px;
    border: none;
    background: #f8fafc;
    color: #475569;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.sid-qty-btn:active {
    background: #fee2e2;
    color: #b10d0d;
}

.sid-qty-input {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: center !important;
    height: 38px !important;
    padding: 0 4px !important;
    -moz-appearance: textfield;
    flex: 1;
    min-width: 0;
}

.sid-qty-input::-webkit-outer-spin-button,
.sid-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Save Bar */
.sid-save-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
    background: transparent;
    border-top: 1px solid #f1f5f9;
    margin-top: 16px;
}

.sid-save-btn {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #b10d0d 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(177, 13, 13, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.sid-save-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(177, 13, 13, 0.25);
}

/* Hide More Details for rows added via the detail modal */
@media (max-width: 768px) {
    .invoice-items-table tr.item-row[data-added-via-modal="true"] .more-link {
        display: none !important;
    }

    /* Show a compact price × qty summary in its place */
    .invoice-items-table tr.item-row[data-added-via-modal="true"] .mobile-row-summary {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
    }
}

/* Step 2 header layout */
#sheet-step2-header {
    display: none;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Fullscreen Payment QR Download Overlay & Spinner */
#pdf-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    touch-action: none;
    overscroll-behavior: none;
}
#pdf-loading-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: all;
}
.pdf-loading-card {
    background: #ffffff;
    padding: 26px 36px;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#pdf-loading-overlay.active .pdf-loading-card {
    transform: scale(1);
}
.pdf-spinner-ring {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid #fee2e2;
    border-top-color: #eb1e3b;
    animation: pdfSpin 0.8s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #eb1e3b;
    font-size: 20px;
}
@keyframes pdfSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.pdf-loading-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
}
.pdf-loading-sub {
    font-size: 12px;
    color: #64748b;
}