@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Rajdhani:wght@500;600;700&display=swap');

:root {
    /* High-Tech Blue Theme Variables (Light Mode) */
    --bg-main: #eef2f7;
    --bg-card: #ffffff;
    --bg-header: #07172b;
    --bg-business: #0a2540;
    
    --text-main: #111827;
    --text-muted: #6b7280;
    --text-light: #f3f4f6;
    
    --primary: #0052cc;
    --primary-hover: #0043a8;
    --accent: #00d2ff;
    
    --border: #d1d5db;
    --border-light: #e5e7eb;
    
    --success: #10b981;
    --danger: #ef4444;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.05);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --subtle-bg: #f8fafc;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --table-hover-bg: rgba(0, 82, 204, 0.02);
}

/* Dark Mode Theme Variables */
[data-theme="dark"] {
    --bg-main: #0c1427;
    --bg-card: #141f36;
    --bg-header: #070e1c;
    --bg-business: #091426;
    
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #f8fafc;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #38bdf8;
    
    --border: #233554;
    --border-light: #1b2a45;
    
    --success: #34d399;
    --danger: #f87171;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);

    --subtle-bg: #101a2e;
    --input-bg: #0e172a;
    --input-border: #2e4368;
    --table-hover-bg: rgba(59, 130, 246, 0.08);
}

/* 1. Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background-color: var(--bg-main);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(var(--border-light) 1px, transparent 1px);
    background-size: 20px 20px; /* High-tech grid feel */
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #9ca3af; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* Keyframes */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 2. Header & Business Bar */
.app-header {
    background-color: var(--bg-header);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--accent);
}

.app-logo { display: flex; gap: 16px; align-items: center; }
.app-logo-img { max-height: 40px; object-fit: contain; }

.app-logo h1 { 
    color: var(--text-light); 
    font-size: 1.5rem; 
    font-weight: 700; 
    letter-spacing: 0.05em; 
    font-family: 'Rajdhani', sans-serif; 
    text-transform: uppercase;
}

.header-date { color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; font-family: 'Rajdhani', sans-serif; }

.business-bar {
    background-color: var(--bg-business);
    padding: 12px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.business-bar-inner {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.business-bar-inner label {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

#business-gstin {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: #fff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    width: 220px;
    font-family: 'Rajdhani', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: border-color 0.2s;
}
#business-gstin:focus { outline: none; border-color: var(--accent); }

.gstin-state-badge {
    background: rgba(0, 210, 255, 0.15);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: none;
    border: 1px solid rgba(0, 210, 255, 0.3);
}
.gstin-state-badge.active { display: inline-block; }


/* 3. Main container */
.main-container { max-width: 1300px; margin: 0 auto; padding: 28px 24px; }

/* 4. Tab Navigation */
.tab-nav {
    display: flex; gap: 4px; background-color: var(--bg-card);
    padding: 6px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    margin-bottom: 24px; overflow-x: auto; border: 1px solid var(--border-light);
    justify-content: center;
}

.tab-btn {
    flex: 1; display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 16px; border: none; background: transparent;
    border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease; color: var(--text-muted);
    white-space: nowrap; font-family: 'Rajdhani', sans-serif; text-transform: uppercase;
    letter-spacing: 0.05em;
}


.tab-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 82, 204, 0.3);
}
.tab-btn:hover:not(.active) { background-color: var(--bg-main); color: var(--primary); }

/* 5. Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* Summary Bar */
.summary-bar { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.summary-card {
    flex: 1; min-width: 200px; background-color: var(--bg-card);
    padding: 18px 22px; border-radius: var(--radius-md);
    box-shadow: var(--shadow-md); border-left: 4px solid var(--primary);
}
.summary-card .summary-label {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); font-weight: 600; margin-bottom: 6px; font-family: 'Rajdhani', sans-serif;
}
.summary-card .summary-value {
    font-size: 1.5rem; font-weight: 700; color: var(--text-main); font-family: 'Rajdhani', sans-serif;
}

/* 6. Section Header */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header h2 { 
    font-size: 1.25rem; font-weight: 700; color: var(--primary); 
    font-family: 'Rajdhani', sans-serif; text-transform: uppercase; letter-spacing: 0.05em;
}
.section-header .bill-count {
    background-color: var(--bg-card); padding: 6px 14px; border-radius: 20px;
    font-size: 0.8rem; color: var(--text-main); font-weight: 600; border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* Filters Bar */
.filter-bar {
    background-color: var(--bg-card); padding: 16px; border-radius: var(--radius-md);
    margin-bottom: 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 150px; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.filter-group input, .filter-group select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.85rem; font-family: inherit; width: 100%; transition: border-color 0.2s;
    background-color: var(--bg-card); color: var(--text-main);
}
.filter-group input:focus, .filter-group select:focus { border-color: var(--primary); outline: none; }
.btn-filter-reset {
    align-self: flex-end; padding: 8px 16px; background-color: var(--bg-main);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: 0.2s;
    height: 35px;
}
.btn-filter-reset:hover { background-color: var(--border-light); color: var(--text-main); }


/* 7. Entry Card */
.entry-card {
    background-color: var(--bg-card); border-radius: var(--radius-lg); padding: 28px;
    box-shadow: var(--shadow-md); margin-bottom: 24px; border: 1px solid var(--border-light);
}
.entry-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
}
.entry-card-header h3 { font-size: 1.1rem; font-weight: 600; color: var(--primary); font-family: 'Rajdhani', sans-serif; text-transform: uppercase;}
.collapse-btn {
    background: var(--bg-main); border: 1px solid var(--border); width: 32px; height: 32px;
    border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center; color: var(--text-main);
}
.collapse-btn:hover { background-color: var(--border-light); }

/* 8. File Upload */
.file-upload-area {
    border: 2px dashed var(--primary); border-radius: var(--radius-md); padding: 32px;
    text-align: center; cursor: pointer; transition: all 0.2s ease; margin-bottom: 24px;
    background-color: rgba(0, 82, 204, 0.02);
}
.file-upload-area:hover, .file-upload-area.dragover { background-color: rgba(0, 82, 204, 0.08); }
.upload-icon { font-size: 2rem; margin-bottom: 8px; display: inline-block; filter: grayscale(100%); opacity: 0.7;}
.upload-text { color: var(--text-muted); font-size: 0.9rem; }
.upload-text strong { color: var(--primary); font-weight: 600; }
.file-preview {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    background-color: var(--bg-main); border-radius: var(--radius-sm); margin-bottom: 24px;
    border: 1px solid var(--border-light);
}
.file-preview .file-info { flex: 1; text-align: left; }
.file-preview .file-name { font-weight: 600; font-size: 0.85rem; color: var(--text-main); margin-bottom: 2px; }
.file-preview .file-size { font-size: 0.75rem; color: var(--text-muted); }
.file-preview .remove-file {
    background: none; border: none; color: var(--danger); cursor: pointer;
    font-size: 1.1rem; padding: 4px; transition: all 0.2s ease;
}

/* Preview Button */
.btn-view-preview {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}
.btn-view-preview:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Bill Preview Panel */
.bill-preview-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 800px; }
}
.preview-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-header);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 600;
}
.preview-close-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.preview-close-btn:hover { opacity: 1; }
.preview-panel-body {
    padding: 16px;
    max-height: 500px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #f8f9fa;
}
.preview-panel-body img {
    max-width: 100%;
    max-height: 470px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.preview-panel-body iframe {
    width: 100%;
    height: 470px;
    border: none;
    border-radius: var(--radius-sm);
}

/* 9. Form Grid */
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label {
    font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.9rem; font-family: inherit; background-color: var(--bg-card);
    transition: all 0.2s ease; color: var(--text-main);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.15);
}

/* 10. GST Auto Badge */
.gst-auto-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 24px;
    font-size: 0.85rem; font-weight: 600;
    background: var(--bg-main); color: var(--text-muted);
    border: 1px solid var(--border);
}
.gst-auto-badge.intra { background: rgba(0, 82, 204, 0.1); color: var(--primary); border-color: rgba(0, 82, 204, 0.2); }
.gst-auto-badge.inter { background: rgba(0, 210, 255, 0.1); color: #007bb5; border-color: rgba(0, 210, 255, 0.2); }
.gst-auto-badge.eou { background: rgba(99, 102, 241, 0.12); color: #4338ca; border-color: rgba(99, 102, 241, 0.35); }
[data-theme="dark"] .gst-auto-badge.eou { background: rgba(99, 102, 241, 0.25); color: #a5b4fc; border-color: rgba(99, 102, 241, 0.5); }

.eou-checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1.5px solid #6366f1;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: #4338ca;
    margin-bottom: 0;
    user-select: none;
    transition: all 0.2s ease;
}
[data-theme="dark"] .eou-checkbox-container {
    background: rgba(99, 102, 241, 0.18);
    border-color: #818cf8;
    color: #c7d2fe;
}
.eou-checkbox-container:hover {
    background: rgba(99, 102, 241, 0.16);
}

/* 11. Line Items Section */
.items-section {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.items-section-header {
    background: var(--bg-main); padding: 14px 20px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.items-label { font-weight: 600; font-size: 0.95rem; color: var(--text-main); text-transform: uppercase; letter-spacing: 0.05em; font-family: 'Rajdhani', sans-serif;}
.btn-add-item {
    background: var(--bg-card); border: 1px solid var(--primary); padding: 6px 12px;
    border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; color: var(--primary);
}
.btn-add-item:hover { background: var(--primary); color: #fff; }

.items-col-headers {
    display: flex; padding: 12px 20px; background: var(--bg-card);
    border-bottom: 1px solid var(--border-light); font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; gap: 12px;
}
.item-row {
    display: flex; padding: 12px 20px; background: var(--bg-card);
    border-bottom: 1px solid var(--border-light); gap: 12px; align-items: center;
}
.item-row:last-child { border-bottom: none; }
.item-field input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.85rem; font-family: inherit;
}
.item-field input:focus { border-color: var(--primary); outline: none; }

/* Column Widths */
.ih-desc, .item-field-desc { flex: 3; min-width: 150px; }
.ih-hsn, .item-field-hsn { flex: 1; min-width: 80px; }
.ih-price, .item-field-price { flex: 1; min-width: 100px; }
.ih-qty, .item-field-qty { flex: 1; min-width: 80px; }
.ih-discount, .item-field-discount { flex: 0.8; min-width: 70px; }
.ih-freight, .item-field-freight { flex: 0.8; min-width: 80px; }
.ih-amount, .item-field-amount { flex: 1.5; min-width: 100px; text-align: right; }
.ih-action, .item-field-action { width: 32px; text-align: center; }

/* Custom Category & Import Fields */
.ih-cat, .item-field-cat { flex: 1.5; min-width: 120px; }
.ih-cat select, .item-field-cat select { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg-card); }
.ih-source, .item-field-source { flex: 1.2; min-width: 100px; }
.ih-source select, .item-field-source select { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg-card); }
.ih-cbm, .item-field-cbm { flex: 1; min-width: 80px; }
.ih-landed-unit, .item-field-landed-unit { flex: 1.5; min-width: 110px; text-align: right; font-weight: 600; color: var(--text-main); }
.ih-landed-total, .item-field-landed-total { flex: 1.5; min-width: 110px; text-align: right; font-weight: 700; color: var(--primary); }

/* Small File Uploader CSS */
.small-upload {
    padding: 16px 8px !important;
    border: 2px dashed var(--border) !important;
    background: var(--bg-card) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-height: 80px;
    transition: all 0.2s ease;
}
.small-upload:hover {
    border-color: var(--primary) !important;
    background: #f0f7ff !important;
}
.small-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f1f5f9 !important;
    border: 1px solid var(--border-light) !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0 !important;
    padding: 8px 12px !important;
}


.item-amount-value { font-weight: 700; font-size: 0.95rem; color: var(--text-main); font-family: 'Rajdhani', sans-serif;}
.item-remove-btn { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 4px; line-height: 1; transition: color 0.2s; }
.item-remove-btn:hover { color: var(--danger); }

/* 12. Calculated Totals */
.calculated-fields {
    display: flex; justify-content: flex-end; gap: 32px; margin-top: 16px;
    padding: 20px; background-color: var(--bg-main); border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}
.calc-field { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.calc-field .calc-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.calc-field .calc-value { font-size: 1.15rem; font-weight: 700; color: var(--text-main); font-family: 'Rajdhani', sans-serif;}
.calc-field-total .calc-value { font-size: 1.5rem; color: var(--primary); }

/* 13. Form Actions */
.form-actions {
    display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px;
    padding-top: 20px; border-top: 1px solid var(--border-light);
}
.btn {
    padding: 12px 28px; border-radius: var(--radius-sm); font-size: 0.9rem; text-transform: uppercase;
    font-weight: 700; cursor: pointer; transition: all 0.2s ease; border: none; font-family: 'Rajdhani', sans-serif; letter-spacing: 0.05em;
}
.btn-primary { background-color: var(--primary); color: #ffffff; box-shadow: 0 4px 14px rgba(0, 82, 204, 0.3); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background-color: var(--bg-main); color: var(--text-main); border: 1px solid var(--border); }
.btn-secondary:hover { background-color: var(--border-light); }
.btn-excel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #107c41;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius-sm, 6px);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 124, 65, 0.25);
    font-family: inherit;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
}
.btn-excel:hover {
    background-color: #0b5c30;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 124, 65, 0.35);
}
.btn-excel:active {
    transform: translateY(0);
}

/* 14. Bills Table & Badges */
.bills-table-container {
    background-color: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: auto;
    border: 1px solid var(--border-light);
}
.bills-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.bills-table thead { background-color: var(--bg-main); border-bottom: 2px solid var(--border); }
.bills-table th {
    padding: 16px 20px; text-align: left; font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.bills-table td {
    padding: 16px 20px; font-size: 0.9rem; color: var(--text-main);
    border-bottom: 1px solid var(--border-light); vertical-align: middle; font-weight: 500;
}
.bills-table tr:hover { background-color: rgba(0, 82, 204, 0.02); }

/* Badges */
.gst-tag { font-size: 0.7rem; padding: 4px 10px; border-radius: 20px; font-weight: 700; display: inline-block; text-transform: uppercase;}
.gst-tag.intra { background: rgba(0, 82, 204, 0.1); color: var(--primary); border: 1px solid rgba(0, 82, 204, 0.2);}
.gst-tag.inter { background: rgba(0, 210, 255, 0.1); color: #007bb5; border: 1px solid rgba(0, 210, 255, 0.2);}

.item-count-badge { background: var(--bg-main); color: var(--text-muted); font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; margin-left: 6px; border: 1px solid var(--border);}
.hsn-code { background: var(--bg-main); padding: 4px 8px; border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--text-muted); font-family: 'Rajdhani', monospace; border: 1px solid var(--border-light);}

.stock-badge { font-size: 0.85rem; padding: 4px 12px; border-radius: 20px; font-weight: 700; display: inline-block; min-width: 48px; text-align: center; font-family: 'Rajdhani', sans-serif;}
.stock-positive { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2);}
.stock-negative { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2);}
.stock-zero { background: var(--bg-main); color: var(--text-muted); border: 1px solid var(--border);}

.bill-thumbnail, .bill-thumbnail-placeholder { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.bill-thumbnail { object-fit: cover; border: 1px solid var(--border); box-shadow: var(--shadow-sm);}
.bill-thumbnail-placeholder { background-color: var(--bg-main); font-size: 1.2rem; color: var(--text-muted); border: 1px solid var(--border-light);}

.invoice-number, .amount-cell { font-weight: 700; color: var(--bg-business); font-family: 'Rajdhani', sans-serif; font-size: 1rem;}

.view-btn {
    background: var(--bg-main); border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--text-main); transition: all 0.2s ease; text-transform: uppercase;
}
.view-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff;}
.delete-btn { background: none; border: none; padding: 6px; cursor: pointer; color: var(--text-muted); font-size: 1.2rem; transition: all 0.2s ease; }
.delete-btn:hover { color: var(--danger); }

/* 15. Empty State */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.3; filter: grayscale(100%);}
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; font-family: 'Rajdhani', sans-serif; text-transform: uppercase; letter-spacing: 0.05em;}
.empty-subtitle { font-size: 0.9rem; color: #9ca3af; }

/* 16. Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(7, 23, 43, 0.7); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    opacity: 0; visibility: hidden; transition: all 0.2s ease;
}
.modal-overlay.active,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
    opacity: 1 !important;
    visibility: visible !important;
}

#expense-payment-modal-overlay {
    z-index: 1050;
}
#expense-payment-modal-overlay.active,
#expense-payment-modal-overlay[style*="display: flex"],
#expense-payment-modal-overlay[style*="display:flex"] {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}
.modal {
    background-color: var(--bg-card); border-radius: var(--radius-lg); max-width: 900px; width: 90%;
    max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 24px 48px rgba(0,0,0,0.3);
    border: 1px solid rgba(0, 210, 255, 0.3);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 28px; border-bottom: 1px solid var(--border-light); background: var(--bg-main); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em;}
.modal-close { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: var(--text-muted); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 28px; overflow-y: auto; flex: 1; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.detail-item { display: flex; flex-direction: column; gap: 6px; }
.detail-item .detail-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em;}
.detail-item .detail-value { font-size: 1rem; font-weight: 600; color: var(--text-main); }

.modal-items-table { width: 100%; border-collapse: collapse; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm);}
.modal-items-table th { background: var(--bg-main); padding: 12px 16px; text-align: left; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; border-bottom: 2px solid var(--border); font-weight: 700;}
.modal-items-table td { padding: 12px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--border-light); font-weight: 500;}
.modal-totals { margin-top: 24px; border-top: 2px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.modal-total-row { display: flex; justify-content: space-between; width: 280px; font-size: 0.95rem; color: var(--text-muted); font-weight: 600;}
.modal-total-row.total { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); font-family: 'Rajdhani', sans-serif;}

/* 17. Toast */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 12px; }
.toast {
    padding: 16px 24px; background-color: var(--bg-business); color: #ffffff; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 500; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: slideIn 0.3s ease;
    display: flex; align-items: center; gap: 12px; border-left: 4px solid var(--primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* 18. Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-bottom: 24px; }
.dashboard-card {
    background-color: var(--bg-card); border-radius: var(--radius-lg); padding: 28px;
    box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--border-light);
}
.dashboard-card-title { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; font-family: 'Rajdhani', sans-serif;}
.dashboard-card-value { font-size: 2.2rem; font-weight: 700; color: var(--bg-business); letter-spacing: -0.02em; font-family: 'Rajdhani', sans-serif;}
.dashboard-card-subtitle { font-size: 0.8rem; color: #9ca3af; margin-top: 4px; font-weight: 500;}
.dashboard-card.highlight-card { background-color: var(--primary); border: none; box-shadow: 0 10px 25px rgba(0, 82, 204, 0.3);}
.dashboard-card.highlight-card .dashboard-card-title, .dashboard-card.highlight-card .dashboard-card-subtitle { color: rgba(255,255,255,0.8); }
.dashboard-card.highlight-card .dashboard-card-value { color: #ffffff; }
.dashboard-card-value.profit { color: var(--success); }
.dashboard-card-value.loss { color: var(--danger); }

/* 19. Authentication & User Roles */
#login-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; background-color: var(--bg-main); background-image: radial-gradient(var(--border-light) 1px, transparent 1px); background-size: 20px 20px;
}
.login-card {
    background-color: var(--bg-card); border-radius: var(--radius-lg); padding: 40px;
    box-shadow: 0 15px 35px rgba(10, 37, 64, 0.1); width: 100%; max-width: 400px;
    border: 1px solid var(--border-light); border-top: 4px solid var(--primary); text-align: center;
}
.login-card img { max-width: 200px; margin-bottom: 24px; }
.login-card h2 { font-family: 'Rajdhani', sans-serif; font-size: 1.5rem; color: var(--bg-business); margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.05em;}
.login-card .form-group { text-align: left; margin-bottom: 16px; }
.login-card .btn { width: 100%; margin-top: 8px; }

.header-user-info { display: flex; align-items: center; gap: 12px; margin-left: auto; margin-right: 24px; }
.sync-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.03em;
}
.sync-status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    transition: background 0.3s ease;
}
.user-badge {
    background: rgba(0, 210, 255, 0.1); color: var(--accent); padding: 6px 12px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 700; border: 1px solid rgba(0, 210, 255, 0.3);
    font-family: 'Rajdhani', sans-serif; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px;
}
.btn-logout {
    background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #fff;
    padding: 6px 14px; border-radius: var(--radius-sm); font-size: 0.8rem; cursor: pointer; transition: 0.2s;
    font-family: 'Rajdhani', sans-serif; text-transform: uppercase; font-weight: 600;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.5); color: var(--danger); }

/* Role Based Visibility */
body.role-sales_clerk .admin-only, body.role-sales_clerk .manager-only { display: none !important; }
body.role-inside_sales .admin-only { display: none !important; }
body.role-manager .admin-only { display: none !important; }

/* 20. AI Integration */
.btn-ai {
    background: linear-gradient(90deg, #10b981, #059669); color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); border: none; font-size: 1rem;
    padding: 12px 20px;
}
.btn-ai:hover {
    background: linear-gradient(90deg, #059669, #047857);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
}
.ai-icon { font-size: 1.2rem; }
.ai-settings-card { border-top: 4px solid #10b981; }

.ai-loading-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(10, 37, 64, 0.85); backdrop-filter: blur(8px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.ai-spinner-container {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    background: var(--bg-card); padding: 32px 48px; border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.ai-spinner {
    width: 50px; height: 50px; border: 4px solid rgba(16, 185, 129, 0.2);
    border-top: 4px solid #10b981; border-radius: 50%;
    animation: spin 1s linear infinite;
}
.ai-loading-text { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: 600; color: #10b981; letter-spacing: 0.05em; text-transform: uppercase; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 21. Responsive */
@media (max-width: 768px) {
    .main-container { padding: 16px 12px; }
    .form-grid { grid-template-columns: 1fr; }
    .calculated-fields { flex-direction: column; align-items: stretch; gap: 16px; }
    .calc-field { align-items: flex-start; }
    .items-col-headers { display: none; }
    .item-row { flex-direction: column; align-items: stretch; position: relative; padding-bottom: 40px; }
    .item-field input { margin-bottom: 8px; }
    .ih-desc::before, .ih-hsn::before, .ih-price::before, .ih-qty::before, .ih-discount::before, .ih-freight::before, .ih-amount::before {
        content: attr(placeholder); display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600;
    }
    .item-field-action { position: absolute; bottom: 12px; right: 20px; }
    .app-header { flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px; }
    .business-bar-inner { flex-direction: column; align-items: stretch; }
    #business-gstin { width: 100%; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .btn-filter-reset { align-self: stretch; }
}

/* ── Expense Day Type Toggle ── */
.expense-day-type-group {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}
.day-type-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.day-type-option input[type="radio"] {
    display: none;
}
.day-type-label {
    padding: 7px 18px;
    border-radius: 8px;
    border: 2px solid var(--border);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    background: var(--bg-card);
    user-select: none;
}
.day-type-option input[type="radio"]:checked + .day-type-label.office {
    border-color: #0052cc;
    background: #e8f0fe;
    color: #0052cc;
}
.day-type-option input[type="radio"]:checked + .day-type-label.travel {
    border-color: #d97706;
    background: #fef3c7;
    color: #92400e;
}

/* ── Admin Expense User Cards ── */
.expense-user-card {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.18s ease;
    min-width: 160px;
    box-shadow: var(--shadow-sm);
}
.expense-user-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.expense-user-card .euc-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.expense-user-card .euc-total {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
}
.expense-user-card .euc-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Day Type Badge in table ── */
.day-type-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.day-type-badge.office { background: #e8f0fe; color: #1a56db; }
.day-type-badge.travel { background: #fef3c7; color: #92400e; }

/* ══════════════════════════════════════════
   ── Payment Badges ──
══════════════════════════════════════════ */
.pay-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.pay-badge.unpaid  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.pay-badge.partial { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.pay-badge.paid    { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ══════════════════════════════════════════
   ── Payment Modal ──
══════════════════════════════════════════ */
.payment-modal {
    width: 680px;
    max-width: 96vw;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
}

/* Summary strip */
.payment-summary-strip {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: 22px;
}
.pss-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px;
    background: var(--bg-main);
    border-right: 1px solid var(--border-light);
}
.pss-item:last-child { border-right: none; }
.pss-item.pss-balance { background: #fff7ed; }
.pss-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.pss-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}
.pss-value.paid    { color: var(--success); }
.pss-value.balance { color: #ea580c; }

/* Payment history */
.payment-history-section,
.add-payment-section {
    margin-bottom: 20px;
}
.payment-history-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 12px;
}
.payment-history-list-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 14px 0;
}
.payment-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    transition: background 0.15s;
}
.payment-entry:hover { background: #f1f5f9; }
.pe-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    min-width: 80px;
}
.pe-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}
.pe-mode {
    display: inline-block;
    background: #e8f0fe;
    color: #1a56db;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.74rem;
    font-weight: 600;
}
.pe-note {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}
.pe-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger);
    font-size: 0.95rem;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.pe-delete:hover { opacity: 1; background: #fef2f2; }

/* Pay button in bills table */
.pay-btn {
    background: linear-gradient(135deg, #0052cc, #0073e6);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 11px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.pay-btn:hover { background: linear-gradient(135deg, #0043a8, #005fcc); transform: translateY(-1px); }
.pay-btn.fully-paid {
    background: linear-gradient(135deg, #15803d, #16a34a);
}

/* ==========================================
   Advanced Sidebar Layout & Analytics Styles
   ========================================== */
.nav-section-title {
    display: none;
}

.layout-advanced .main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 24px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}

.layout-advanced .tab-nav {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: calc(100vh - 200px);
    position: sticky;
    top: 24px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    gap: 6px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
}

.layout-advanced .tab-btn {
    flex: none;
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.layout-advanced .nav-section-title {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-top: 14px;
    margin-bottom: 4px;
    padding-left: 8px;
    opacity: 0.7;
}

.layout-advanced #nav-title-analytics { margin-top: 0; }

/* Advanced Analytics Layout */
.advanced-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light);
    font-size: 0.88rem;
}
.advanced-breakdown-row:last-child {
    border-bottom: none;
}
.advanced-breakdown-name {
    color: var(--text-color);
    font-weight: 500;
}
.advanced-breakdown-val {
    font-weight: 600;
    color: var(--text-color);
}
.advanced-breakdown-perc {
    font-size: 0.75rem;
    background: rgba(0, 82, 204, 0.1);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Responsive adjustments for advanced sidebar */
@media (max-width: 900px) {
    .layout-advanced .main-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .tab-nav,
    .layout-advanced .tab-nav {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        height: auto !important;
        position: static !important;
        overflow-x: visible !important;
        padding: 8px !important;
        width: 100% !important;
        margin-bottom: 20px !important;
    }
    .tab-btn,
    .layout-advanced .tab-btn {
        width: 100% !important;
        flex: none !important;
        justify-content: center !important;
        padding: 10px 8px !important;
        font-size: 0.82rem !important;
        white-space: normal !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }
    .nav-section-title,
    .layout-advanced .nav-section-title {
        display: none !important;
    }
}

/* Global Remarks Tooltip Popover Dialog */
.global-remarks-tooltip {
    position: absolute;
    display: none;
    z-index: 9999;
    max-width: 320px;
    min-width: 220px;
    background: var(--bg-card);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
    white-space: pre-wrap;
    pointer-events: none; /* User can click through the tooltip */
    transition: opacity 0.15s ease;
}

.global-remarks-tooltip-header {
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.global-remarks-tooltip::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--bg-card) transparent transparent transparent;
}

/* ══════════════════════════════════════════ */
/* ── Logistics Tab Styles ── */
/* ══════════════════════════════════════════ */
.logistics-pill-btn {
    background: transparent;
    color: var(--text-muted);
}
.logistics-pill-btn:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    color: var(--text-color);
}
.logistics-pill-btn.active {
    background: var(--primary-color, #2563eb) !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.logistics-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}
.logistics-type-badge.inward {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.logistics-type-badge.outward {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.logistics-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-subtle, #f3f4f6);
    color: var(--text-color, #374151);
    border: 1px solid var(--border-color, #e5e7eb);
}

.logistics-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: var(--text-color);
    transition: all 0.15s;
}
.logistics-file-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}
.logistics-file-btn.has-file {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
    font-weight: 600;
}

/* ══════════════════════════════════════════ */
/* ── Expense Settlement & Status Styles ── */
/* ══════════════════════════════════════════ */
.expense-pill-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.expense-pill-btn:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    color: var(--text-color);
}
.expense-pill-btn.active {
    background: var(--primary-color, #2563eb) !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.expense-pill-btn .pill-badge {
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0,0,0,0.08);
}
.expense-pill-btn.active .pill-badge {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.expense-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.expense-status-badge.pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.expense-status-badge.paid {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ── Customer Visited Badge & Chips ── */
.expense-customer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 0.74rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    white-space: nowrap;
    margin: 1px 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.expense-customer-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-weight: 500;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 14px;
    user-select: none;
}
.expense-customer-chip .chip-remove {
    background: none;
    border: none;
    color: #0284c7;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    font-weight: 700;
}
.expense-customer-chip .chip-remove:hover {
    color: #b91c1c;
}

/* ── Expense Visit Target Mode Toggle ── */
.expense-target-type-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    background: var(--bg-secondary, #f1f5f9);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
}
.btn-toggle-target {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted, #475569);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-toggle-target:hover {
    color: var(--text-color, #1e293b);
}
.btn-toggle-target.active {
    background: var(--bg-card, #ffffff);
    color: var(--primary, #2563eb);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── Prospect Badge & Chip Variants ── */
.expense-customer-badge.prospect {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}
.expense-customer-chip.prospect {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}
.expense-customer-chip.prospect .chip-remove {
    color: #9333ea;
}
.expense-customer-chip.prospect .chip-remove:hover {
    color: #b91c1c;
}

.btn-mark-paid {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #16a34a;
    color: #fff;
    border: 1px solid #15803d;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-mark-paid:hover {
    background: #15803d;
}

.btn-revert-paid {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-revert-paid:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.expense-bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: fadeIn 0.2s ease-in-out;
}
.expense-bulk-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #065f46;
}
.expense-bulk-actions {
    display: flex;
    gap: 8px;
}

.expense-payment-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.expense-payment-meta strong {
    color: var(--text-color);
}

/* ==========================================
   Dark Mode Component Overrides & Theme Toggle
   ========================================== */
[data-theme="dark"] body {
    background-color: var(--bg-main);
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    color: var(--text-main);
}

[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg-main); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #475569; }

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: var(--input-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--input-border) !important;
}

[data-theme="dark"] select option {
    background-color: #141f36;
    color: #f1f5f9;
}

[data-theme="dark"] .bills-table thead,
[data-theme="dark"] .data-table thead,
[data-theme="dark"] .modal-items-table th {
    background-color: #0d1627 !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .bills-table th,
[data-theme="dark"] .data-table th {
    color: var(--text-muted);
}

[data-theme="dark"] .bills-table td,
[data-theme="dark"] .data-table td,
[data-theme="dark"] .modal-items-table td {
    border-color: var(--border-light) !important;
    color: var(--text-main);
}

[data-theme="dark"] .bills-table tr:hover,
[data-theme="dark"] .data-table tr:hover {
    background-color: var(--table-hover-bg) !important;
}

[data-theme="dark"] .invoice-number,
[data-theme="dark"] .amount-cell,
[data-theme="dark"] .dashboard-card-value,
[data-theme="dark"] .login-card h2,
[data-theme="dark"] .summary-card .summary-value {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

[data-theme="dark"] #login-container {
    background-color: var(--bg-main);
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

[data-theme="dark"] .items-section,
[data-theme="dark"] .items-col-headers,
[data-theme="dark"] .item-row {
    background-color: var(--bg-card);
    border-color: var(--border-light);
}

[data-theme="dark"] .items-section-header {
    background-color: var(--subtle-bg);
    border-color: var(--border-light);
}

[data-theme="dark"] .btn-add-item {
    background: var(--input-bg);
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .btn-add-item:hover {
    background: var(--primary);
    color: #fff;
}

[data-theme="dark"] .btn-secondary {
    background-color: var(--subtle-bg);
    color: var(--text-main);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: var(--border);
}

[data-theme="dark"] .btn-filter-reset {
    background-color: var(--subtle-bg);
    border-color: var(--border);
    color: var(--text-muted);
}

[data-theme="dark"] .btn-filter-reset:hover {
    background-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .btn-excel {
    background-color: #15803d;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.3);
}

[data-theme="dark"] .btn-excel:hover {
    background-color: #166534;
}

[data-theme="dark"] .collapse-btn {
    background: var(--subtle-bg);
    border-color: var(--border);
    color: var(--text-main);
}

[data-theme="dark"] .collapse-btn:hover {
    background: var(--border);
}

[data-theme="dark"] .calculated-fields {
    background-color: var(--subtle-bg);
    border-color: var(--border-light);
}

[data-theme="dark"] .hsn-code,
[data-theme="dark"] .item-count-badge,
[data-theme="dark"] .stock-zero {
    background: var(--subtle-bg);
    border-color: var(--border);
    color: var(--text-muted);
}

[data-theme="dark"] .modal {
    background-color: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-header {
    background-color: var(--subtle-bg);
    border-color: var(--border-light);
}

[data-theme="dark"] .pss-item {
    background: var(--bg-card);
    border-color: var(--border-light);
}

[data-theme="dark"] .pss-item.pss-balance {
    background: rgba(234, 88, 12, 0.15);
}

[data-theme="dark"] .payment-entry {
    background: var(--subtle-bg);
    border-color: var(--border-light);
}

[data-theme="dark"] .payment-entry:hover {
    background: #1a2740;
}

[data-theme="dark"] .pe-mode {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .logistics-mode-badge {
    background: var(--subtle-bg);
    color: var(--text-main);
    border-color: var(--border);
}

[data-theme="dark"] .logistics-type-badge.inward {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .logistics-type-badge.outward {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border-color: rgba(168, 85, 247, 0.3);
}

[data-theme="dark"] .logistics-pill-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .expense-pill-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .expense-status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .expense-status-badge.paid {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .expense-customer-badge {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .expense-customer-chip {
    background: rgba(14, 165, 233, 0.18);
    color: #7dd3fc;
    border-color: rgba(14, 165, 233, 0.35);
}
[data-theme="dark"] .expense-customer-chip .chip-remove {
    color: #38bdf8;
}
[data-theme="dark"] .expense-customer-chip .chip-remove:hover {
    color: #f87171;
}

[data-theme="dark"] .expense-target-type-toggle {
    background: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .btn-toggle-target {
    color: #94a3b8;
}
[data-theme="dark"] .btn-toggle-target.active {
    background: #334155;
    color: #60a5fa;
}

[data-theme="dark"] .expense-customer-badge.prospect {
    background: rgba(147, 51, 234, 0.18);
    color: #c084fc;
    border-color: rgba(147, 51, 234, 0.35);
}
[data-theme="dark"] .expense-customer-chip.prospect {
    background: rgba(168, 85, 247, 0.18);
    color: #d8b4fe;
    border-color: rgba(168, 85, 247, 0.35);
}
[data-theme="dark"] .expense-customer-chip.prospect .chip-remove {
    color: #c084fc;
}
[data-theme="dark"] .expense-customer-chip.prospect .chip-remove:hover {
    color: #f87171;
}

[data-theme="dark"] .btn-revert-paid {
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .btn-revert-paid:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

[data-theme="dark"] .expense-bulk-bar {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .expense-bulk-info {
    color: #6ee7b7;
}

[data-theme="dark"] .bill-thumbnail-placeholder {
    background-color: var(--subtle-bg);
    border-color: var(--border);
}

[data-theme="dark"] .global-remarks-tooltip {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border);
}

[data-theme="dark"] .global-remarks-tooltip::after {
    border-color: var(--bg-card) transparent transparent transparent;
}

[data-theme="dark"] .advanced-breakdown-row {
    border-color: var(--border-light);
}

/* Header theme toggle button */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.08);
    border-color: var(--accent);
}

/* Theme option cards in Settings */
.theme-card-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-card);
    transition: all 0.2s ease;
    min-width: 230px;
    user-select: none;
}
.theme-card-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.theme-card-option.active {
    border-color: var(--primary) !important;
    background: rgba(59, 130, 246, 0.08) !important;
    box-shadow: 0 0 0 2px var(--primary);
}

/* ══════════════════════════════════════════
   ── Ageing Analysis Cards ──
══════════════════════════════════════════ */
.ageing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.ageing-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ageing-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.ageing-current { border-top-color: #22c55e; }
.ageing-due { border-top-color: #eab308; }
.ageing-overdue { border-top-color: #f97316; }
.ageing-critical { border-top-color: #ef4444; }
.ageing-label { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.ageing-sublabel { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; }
.ageing-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.ageing-count { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 768px) {
    .ageing-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════
   ── WhatsApp Button ──
══════════════════════════════════════════ */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #25D366;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.btn-whatsapp:hover { background: #1da851; transform: translateY(-1px); }
.btn-whatsapp-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 4px;
}
.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}
.btn-print:hover { background: var(--border-light); }

/* ══════════════════════════════════════════
   ── Customer Ledger Styles ──
══════════════════════════════════════════ */
.ledger-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.ledger-summary-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    background: var(--subtle-bg, #f1f5f9);
    border: 1px solid var(--border-light);
}
.ledger-summary-card .ledger-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.ledger-summary-card .ledger-amount { font-size: 1.2rem; font-weight: 700; }
.ledger-summary-card.credit .ledger-amount { color: #22c55e; }
.ledger-summary-card.debit .ledger-amount { color: #3b82f6; }
.ledger-summary-card.balance .ledger-amount { color: #ef4444; }
.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.ledger-table th, .ledger-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
.ledger-table th {
    background: var(--subtle-bg, #f1f5f9);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}
.ledger-table tr:hover { background: var(--table-hover-bg, rgba(59, 130, 246, 0.04)); }

@media (max-width: 768px) {
    .ledger-summary { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   ── Dark Theme Overrides for New Features ──
══════════════════════════════════════════ */
[data-theme="dark"] .ageing-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .ageing-value { color: var(--text-main); }
[data-theme="dark"] .btn-print {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border);
}
[data-theme="dark"] .btn-print:hover { background: var(--border-light); }
[data-theme="dark"] .ledger-summary-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .ledger-table th {
    background: var(--bg-header);
}

/* ══════════════════════════════════════════
   ── Print Stylesheet (Tax Invoice / Delivery Challan) ──
══════════════════════════════════════════ */
@media print {
    body > *:not(#print-invoice-container) { display: none !important; }
    #print-invoice-container {
        display: block !important;
        position: absolute;
        top: 0; left: 0;
        width: 100%;
        background: #fff;
        color: #000;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 8.5pt;
        line-height: 1.3;
    }

    .inv-page {
        width: 200mm;
        margin: 0 auto;
        padding: 5mm;
        box-sizing: border-box;
    }

    .inv-box {
        border: 1.5px solid #000;
        background: #fff;
        color: #000;
    }

    .inv-title-bar {
        text-align: center;
        font-weight: 700;
        font-size: 11pt;
        padding: 4px 0;
        border-bottom: 1.5px solid #000;
        letter-spacing: 1px;
    }

    .inv-header-grid {
        display: flex;
        border-bottom: 1.5px solid #000;
    }

    .inv-seller-cell {
        flex: 1.1;
        padding: 6px 8px;
        border-right: 1.5px solid #000;
        font-size: 8pt;
        line-height: 1.35;
    }

    .inv-meta-grid {
        flex: 0.9;
        display: flex;
        flex-direction: column;
    }

    .inv-meta-row {
        display: flex;
        flex: 1;
        border-bottom: 1px solid #000;
    }
    .inv-meta-row:last-child { border-bottom: none; }

    .inv-meta-col {
        flex: 1;
        padding: 4px 6px;
        font-size: 7.5pt;
        border-right: 1px solid #000;
    }
    .inv-meta-col:last-child { border-right: none; }

    .inv-consignee-box {
        padding: 6px 8px;
        border-bottom: 1.5px solid #000;
        font-size: 8pt;
        line-height: 1.35;
    }

    /* Strict Table Geometry for Print */
    .inv-table {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: fixed !important;
        border-bottom: 1.5px solid #000 !important;
        font-size: 8pt !important;
    }

    .inv-table thead { display: table-header-group !important; }
    .inv-table tbody { display: table-row-group !important; }
    .inv-table tfoot { display: table-footer-group !important; }

    .inv-table tr,
    .inv-table tr.inv-tr-item,
    .inv-table tr.calc-row,
    .inv-table tr.filler-row {
        display: table-row !important;
    }

    .inv-table th,
    .inv-table td {
        display: table-cell !important;
        border-right: 1px solid #000 !important;
        padding: 3px 5px !important;
        box-sizing: border-box !important;
        word-break: break-word !important;
    }
    .inv-table th:last-child,
    .inv-table td:last-child {
        border-right: none !important;
    }

    .inv-table th {
        border-bottom: 1.5px solid #000 !important;
        font-weight: 700 !important;
        text-align: center !important;
        background: #fff !important;
        vertical-align: middle !important;
        padding: 4px 3px !important;
    }

    .inv-table td {
        vertical-align: top !important;
    }

    .inv-table tr.inv-tr-item td {
        border-bottom: none !important;
        padding: 4px 4px !important;
    }

    .inv-table tr.filler-row td {
        height: 140px !important;
        border-bottom: none !important;
    }

    .inv-table tr.calc-row td {
        padding: 3px 5px !important;
        border-bottom: none !important;
    }

    .inv-table tfoot td {
        border-top: 1.5px solid #000 !important;
        border-bottom: 1.5px solid #000 !important;
        font-weight: 700 !important;
        padding: 4px 5px !important;
    }

    .inv-words-row {
        display: flex;
        justify-content: space-between;
        padding: 4px 8px;
        border-bottom: 1px solid #000;
        font-size: 8pt;
    }

    .inv-tax-grid {
        display: flex;
        border-bottom: 1px solid #000;
    }

    .inv-bank-cell {
        flex: 1;
        padding: 5px 8px;
        border-right: 1.5px solid #000;
        font-size: 7.5pt;
        line-height: 1.35;
    }

    .inv-tax-table-cell {
        flex: 1.2;
    }

    .inv-tax-subtable {
        width: 100%;
        border-collapse: collapse;
        font-size: 7.5pt;
        table-layout: fixed;
    }
    .inv-tax-subtable th, .inv-tax-subtable td {
        border-bottom: 1px solid #000;
        border-right: 1px solid #000;
        padding: 3px 4px;
        text-align: center;
    }
    .inv-tax-subtable th:last-child, .inv-tax-subtable td:last-child { border-right: none; }
    .inv-tax-subtable tr:last-child td { border-bottom: none; }

    .inv-tax-words-bar {
        padding: 4px 8px;
        border-bottom: 1px solid #000;
        font-size: 7.5pt;
    }

    .inv-footer-row {
        display: flex;
    }

    .inv-decl-cell {
        flex: 1.2;
        border-right: 1.5px solid #000;
        font-size: 8pt;
        line-height: 1.4;
        display: flex;
        flex-direction: column;
    }

    .inv-decl-subcell {
        padding: 4px 8px;
        border-bottom: 1px solid #000;
        min-height: 28px;
        box-sizing: border-box;
    }

    .inv-terms-subcell {
        padding: 4px 8px;
        min-height: 36px;
        box-sizing: border-box;
    }

    .inv-sig-cell {
        flex: 0.8;
        padding: 6px 8px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        text-align: right;
        font-size: 8pt;
    }

    .inv-sig-line {
        margin-top: 45px;
        font-weight: 700;
    }

    .inv-computer-notice {
        text-align: center;
        font-size: 8pt;
        margin-top: 4px;
    }
}

/* Global safeguards to prevent form CSS (.item-row) from affecting the invoice */
#print-invoice-container .inv-table,
#print-invoice-container table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
}
#print-invoice-container tr {
    display: table-row !important;
}
#print-invoice-container th,
#print-invoice-container td {
    display: table-cell !important;
}


