/* Invoice Editor - Compact Premium Design */

.invoice-editor-wrapper {
    background: #f1f5f9;
    min-height: 100vh;
    /* Fallback */
    /* height: 100dvh; */
    /* Mobile viewport fix */
    width: 100%;
    /* overflow: hidden; */
    /* Prevent body/wrapper scroll */
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Safeguard against horizontal scroll */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    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: #EF7722;
}

.toggle-btn.active {
    background: #ffffff;
    color: #EF7722;
    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: #EF7722;
    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: #EF7722;
    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: #EF7722;
    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: #EF7722;
    border-color: #EF7722;
}

.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: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.form-group-invoice:focus-within label {
    color: #EF7722;
    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 #edf2f7;
    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;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.02),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    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: none;
    border-color: #EF7722;
    background: #ffffff;
    box-shadow:
        0 0 0 4px rgba(239, 119, 34, 0.15),
        0 15px 30px -10px rgba(239, 119, 34, 0.2);
    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: #EF7722;
    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: #1e293b;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    background: #d2d2d2;
}

.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: #64748b;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-right: 1px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    background: #ffffff;
}

.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: 1px solid transparent;
    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: #EF7722 !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: #EF7722 !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: transparent;
    border: none;
    color: #ef4444;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 1;
    font-size: 0.82rem;
}

.btn-remove-row:hover {
    background: #fee2e2;
    color: #ef4444;
    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 */
.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: 50 !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:last-child {
    border-bottom: none;
}

.item-suggestion:hover,
.item-suggestion.highlighted {
    background: linear-gradient(to right, #fff7ed, #ffffff);
    border-left: 3px solid #EF7722;
    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: #EF7722;
    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: 0.8rem;
}

.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: 0.8rem;
}

.payment-row input {
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.8rem;
    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: #EF7722;
    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: #EF7722;
    border-style: dashed;
    color: #EF7722;
    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: #d2d2d2;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
}

.btn-invoice-primary {
    background: linear-gradient(135deg, #EF7722 0%, #f97316 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: #EF7722;
    color: #EF7722;
    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: #EF7722;
    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: #EF7722 !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: 10001;
    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);
    border-radius: 0 24px 24px 0;
    /* 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: 10px;
}

.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: #ef7722;
    color: white;
    border-color: #ef7722;
}

.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: #ef7722;
    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: 0.8rem;
    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-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: 0.8rem;
    /* 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,
    .sidebar-toggle-draggable,
    .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: #EF7722;
    /* Brand Color */
    border-color: #EF7722;
}

.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: #EF7722;
    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: #EF7722;
    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: #EF7722;
    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: 0.8rem;
    color: #64748b;
}

.btn-primary-custom {
    background: linear-gradient(135deg, #EF7722 0%, #f97316 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, #f97316 0%, #ea580c 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 {
        top: 0 !important;
        /* Sticky to top on mobile */
        z-index: 10;
        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: #EF7722;
        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: #EF7722;
        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: 1px solid #cbd5e1;
        border-radius: 4px;
        font-size: 0.82rem !important;
        height: 26px !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: #EF7722 !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: #EF7722;
        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: 28px !important;
        font-weight: 600;
        border-color: #EF7722;
    }

    .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: 0.8rem !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 {
        background: transparent !important;
        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 inputs - match laptop design on mobile */
    .payment-tracking-rows .form-group-invoice input {
        height: 36px !important;
        font-size: 0.75rem !important;
        text-align: left !important;
        border: 1.5px solid #edf2f7 !important;
        background: #ffffff !important;
        border-radius: 10px !important;
        padding: 0.4rem 0.6rem !important;
        padding-left: 2rem !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02), inset 0 2px 4px rgba(255, 255, 255, 0.8) !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;
        display: flex !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: #fed7aa !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 #EF7722 !important;
        color: #EF7722 !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: #EF7722;
        border-color: #EF7722;
    }

    #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;
        display: block;
        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) */
    #payment-mode,
    #reference-no,
    .invoice-note textarea,
    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;
        color: #1e293b !important;
        padding: 0 12px !important;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
        transition: all 0.2s;
        appearance: none;
        /* Remove default select arrow background if needed, but usually keep */
    }

    /* Specific for Textarea */
    .invoice-note textarea,
    textarea#invoice-note {
        height: auto !important;
        min-height: 80px !important;
        padding: 10px !important;
        line-height: 1.5;
    }

    /* Focus States */
    #payment-mode:focus,
    #reference-no:focus,
    .invoice-note textarea:focus,
    textarea#invoice-note:focus {
        border-color: #EF7722 !important;
        background: #fff !important;
        box-shadow: 0 0 0 3px rgba(239, 119, 34, 0.1) !important;
        outline: none !important;
    }

    /* Add custom arrow for select if needed, or just let default exist */
    #payment-mode {
        background-color: #ffffff !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;
    max-height: 100vh;
    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: #EF7722;
    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: 0.8rem !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: translateY(-4px) !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: 0.8rem !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, #EF7722 0%, #f97316 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, #f97316 0%, #ea580c 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: 0.8rem !important;
        font-weight: 800 !important;
        box-shadow: 0 8px 25px -4px rgba(239, 119, 34, 0.45) !important;
        background: linear-gradient(135deg, #EF7722 0%, #f97316 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: 0.8rem;
}

.sale-header-right {
    display: flex;
    gap: 0.75rem;
}

.btn-sale-primary {
    background: #EF7722;
    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: #FAA533;
    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: 0.8rem;
}

.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: 0.8rem;
    min-width: 120px;
    transition: all 0.3s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #EF7722;
    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: #EF7722;
    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: 0.8rem;
    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: #f59e0b !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-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.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, #f59e0b, #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: #EF7722;
    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: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-action:hover {
    border-color: #EF7722;
    color: #EF7722;
    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: 0.8rem;
}

.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: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-paid {
    background: #dcfce7;
    color: #16a34a;
}

.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-overdue {
    background: #fee2e2;
    color: #dc2626;
}

/* 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: 0.8rem;
        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: 0.8rem;
        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: #EF7722 !important;
        border-color: #EF7722 !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 #f59e0b;
    }

    /* 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: 1px solid rgba(226, 232, 240, 0.8); */
    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;
    animation: suggestPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: visible;
    /* Header contains correctly */
}

/* 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: transparent;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.premium-suggest-item:hover,
.premium-suggest-item.highlighted,
.item-suggestion:hover,
.item-suggestion.highlighted {
    background: #fff7ed !important;
    /* Very light orange background */
    border-color: rgba(239, 119, 34, 0.3) !important;
    box-shadow: 0 4px 12px rgba(239, 119, 34, 0.12) !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: #EF7722;
    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: 'Outfit', 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: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid #bae6fd;
}

.item-suggestion-price {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    border-color: #fed7aa;
}

.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: 0.8rem;
    font-weight: 300;
}

/* Add Button in Suggestions */
.premium-suggest-add,
.item-suggestion-add {
    font-weight: 700 !important;
    color: #EF7722 !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: #EF7722;
    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,
.item-suggestion-add:hover {
    background: #ffedd5 !important;
    border-style: solid !important;
    transform: translateY(-2px) !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 {
    padding-top: 0 !important;
}

/* =========================================
   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: #EF7722;
        box-shadow: 0 0 0 1px #EF7722;
        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 {
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* margin: 12px; */
    overflow: hidden;
}

.charges-card h6 {
    cursor: pointer;
    user-select: none;
}

.charges-card .toggle-icon {
    transition: transform 0.3s ease;
}

.charges-card.collapsed .toggle-icon {
    transform: rotate(-180deg);
}

.charges-content {
    max-height: 1000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.charges-card.collapsed .charges-content {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none;
}

.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: 2px 0;
    vertical-align: middle;
}

.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: 0.8rem;
}

.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: #f8fafc;
        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 #fed7aa;
    }

    /* 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: 'Outfit', 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: 'Outfit', 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: 'Outfit', 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: 'Outfit', 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: 0.8rem !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) */
.charges-card,
.invoice-summary-card,
.hisaab-calculator,
.barcode-scanner-compact,
.barcode-scanner-bar,
.invoice-items-section {
    border-radius: 10px !important;
    padding: 12px !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    background: #ffffff !important;
}

/* Specific spacing fix to prevent touching cards */
.charges-card {
    margin-bottom: 16px !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 input,
.qty-stepper button,
.btn-camera-compact,
.btn-settings-icon,
.payment-status-badge {
    border-radius: 8px !important;
}

/* 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: 1.5rem !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: Remove Bootstrap .row gutter padding inside invoice editor */
@media (max-width: 768px) {

    .invoice-editor-wrapper .row,
    .invoice-form-container .row {
        --bs-gutter-x: 0 !important;
        --bs-gutter-y: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .invoice-editor-wrapper .row>*,
    .invoice-form-container .row>* {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}