/* Invoice Module Styles */

/* AI Notes Assistant Styles */
.ai-notes-suggestions {
    margin-top: 8px;
    border-radius: 6px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.ai-notes-suggestions .suggestions-header {
    padding: 8px 12px;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-notes-suggestions .suggestion-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-notes-suggestions .suggestion-item:hover {
    background: var(--hover-background);
}

.ai-notes-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.ai-notes-suggestions .suggestion-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
}

.ai-notes-suggestions .use-suggestion-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 8px;
}

.ai-notes-suggestions .use-suggestion-btn:hover {
    background: var(--primary-color);
    color: white;
}

.ai-notes-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.ai-suggestions-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ai-suggestions-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.clear-suggestions-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.clear-suggestions-btn:hover {
    background: var(--hover-background);
    border-color: var(--text-secondary);
}

/* Dark mode support for AI notes */
[data-theme="dark"] .ai-notes-suggestions {
    background: var(--card-background);
    border-color: var(--border-color);
}

[data-theme="dark"] .ai-notes-suggestions .suggestion-item:hover {
    background: var(--hover-background);
}

[data-theme="dark"] .ai-notes-suggestions .suggestion-text {
    color: var(--text-primary);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.25rem;
}

.page-header .subtitle {
    color: #666;
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--card-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    border: none;
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.primary-btn {
    background-color: #007ec7;
    color: white;
}

.primary-btn:hover {
    background-color: #0066a1;
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: #f0f0f0;
    color: #444;
}

.secondary-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
}

/* Invoice Table */
.invoice-table-container {
    background: rgb(255, 255, 255);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.table-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.table-header h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #222;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.data-table th {
    color: #777;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

.data-table tbody tr {
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table td {
    color: #333;
}

/* Status Styles */
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

.status i {
    margin-right: 6px;
}

/* Status Colors */
.status.gray {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status.blue {
    background-color: #e0f2fe;
    color: #0284c7;
}

.status.orange {
    background-color: #fff7ed;
    color: #ea580c;
}

.status.green {
    background-color: #f0fdf4;
    color: #16a34a;
}

.status.red {
    background-color: #fef2f2;
    color: #dc2626;
}

/* Timeline Styles */
.status-timeline {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    margin-right: 12px;
    margin-top: 4px;
}

.timeline-item.active .timeline-marker {
    background: var(--primary-color);
}

.timeline-content {
    flex: 1;
}

.timeline-date {
    display: block;
    font-size: 0.85em;
    color: #64748b;
    margin-bottom: 4px;
}

.timeline-title {
    font-weight: 500;
    color: #1e293b;
}

/* Status Action Buttons */
.status-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.status-actions button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s;
}

.status-actions button i {
    margin-right: 6px;
}

/* Status Badge in Invoice Header */
.invoice-view-header .status {
    font-size: 1em;
    padding: 6px 12px;
}

/* Status Filter Dropdown */
#statusFilter {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background-color: white;
    min-width: 150px;
}

#statusFilter option {
    padding: 8px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    font-size: 0.9rem;
}

.page-info {
    color: #666;
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    background-color: white;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    font-size: 0.85rem;
}

.pagination-btn.active {
    background-color: #007ec7;
    color: white;
    border-color: #007ec7;
}

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

.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    color: #777;
}

/* Chart Period Controls */
.chart-period-btn {
    background: #f0f0f0;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #555;
}

.chart-period-btn:hover {
    background: #e0e0e0;
}

.chart-period-btn.active {
    background: #007ec7;
    color: white;
}

/* Modal Styling */
.modal {
    display: none; 
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex; /* Show the modal when the active class is present */
    /* The other properties like position, z-index, etc., are inherited from .modal or can be redefined here if needed */
    /* Ensure it's centered or positioned as desired */
    align-items: center; /* Center content vertically */
    justify-content: center; /* Center content horizontally */
}

/* Prevent body scrolling when modal is active */
body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2); /* Reduced opacity for better visibility behind modal */
    z-index: 1000; /* Lower z-index than the modal */
}

.modal-overlay.active {
    display: block; /* Show the overlay when the active class is present */
}

.modal-content {
    background-color: #fff;
    margin: 1.5rem auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.3s;
    border: 1px solid #e0e0e0;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fafbfc;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #222;
    margin: 0;
}

.close-modal {
    font-size: 1.5rem;
    font-weight: 700;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #555;
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: var(--card-background);
}

/* Modal form specific styles */
.modal .form-group {
    margin-bottom: 1rem;
}

.modal .form-group:last-child {
    margin-bottom: 0;
}

/* Product modal specific styles */
#quickAddProductModal .modal-content {
    max-width: 500px;
    max-height: 80vh;
}

/* Dark mode support for quick add product modal */
[data-theme="dark"] #quickAddProductModal .modal-content {
    background: #23262f !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] #quickAddProductModal .modal-header {
    background: #23262f !important;
    border-bottom-color: #2a2d3a !important;
}

[data-theme="dark"] #quickAddProductModal .modal-header h3 {
    color: #60a5fa !important;
}

[data-theme="dark"] #quickAddProductModal .modal-body {
    background: #23262f !important;
}

[data-theme="dark"] #quickAddProductModal .modal-footer {
    background: #23262f !important;
    border-top-color: #2a2d3a !important;
}

[data-theme="dark"] #quickAddProductModal .form-group label {
    color: #e5e7eb !important;
}

[data-theme="dark"] #quickAddProductModal .form-group input,
[data-theme="dark"] #quickAddProductModal .form-group select {
    background: #181a20 !important;
    color: #fff !important;
    border-color: #2a2d3a !important;
}

[data-theme="dark"] #quickAddProductModal .form-group input:focus,
[data-theme="dark"] #quickAddProductModal .form-group select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

[data-theme="dark"] #quickAddProductModal .form-group input::placeholder {
    color: #aaa !important;
}

[data-theme="dark"] #quickAddProductModal .btn.secondary-btn {
    background: #2a2d3a !important;
    color: #e0e0e0 !important;
    border-color: #2a2d3a !important;
}

[data-theme="dark"] #quickAddProductModal .btn.primary-btn {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

/* Enhanced dark mode support for all modals */
[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.6) !important;
}

/* Force immediate application of dark mode styles */
[data-theme="dark"] * {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Industry Dropdown Styles */
.industry-dropdown-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    cursor: pointer;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.industry-dropdown-input .selected-text {
    color: #666;
}

.industry-dropdown-input i {
    font-size: 12px;
    color: #666;
}

.industry-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.industry-dropdown-list .search-container {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.industry-dropdown-list .industry-search {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 12px;
}

.industry-dropdown-list .industry-options {
    max-height: 150px;
    overflow-y: auto;
}

.industry-dropdown-list .industry-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
}

.industry-dropdown-list .industry-option:hover {
    background: #f8f9fa;
}

.industry-dropdown-list .industry-number {
    font-weight: bold;
    color: #333;
}

.industry-dropdown-list .industry-description {
    color: #666;
    text-align: right;
    flex: 1;
    margin-left: 10px;
}

.industry-dropdown-list .custom-option {
    padding: 8px 12px;
    cursor: pointer;
    border-top: 2px solid #007bff;
    background: #f8f9fa;
    font-style: italic;
    color: #007bff;
}

.industry-dropdown-list .custom-option i {
    margin-right: 5px;
}

/* Dark mode support for industry dropdown */
[data-theme="dark"] .industry-dropdown-input {
    background: #2a2d3a !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-input .selected-text {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-input i {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-list {
    background: #2a2d3a !important;
    border-color: #555 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .industry-dropdown-list .search-container {
    border-bottom-color: #444 !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-search {
    background: #181a20 !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-search::placeholder {
    color: #888 !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-option {
    border-bottom-color: #444 !important;
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-option:hover {
    background: #32353f !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-number {
    color: #60a5fa !important;
}

[data-theme="dark"] .industry-dropdown-list .industry-description {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .industry-dropdown-list .custom-option {
    background: #32353f !important;
    border-top-color: #60a5fa !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .modal-content {
    background: #23262f !important;
    color: #e0e0e0 !important;
    border-color: #2a2d3a !important;
}

[data-theme="dark"] .modal-header {
    background: #23262f !important;
    border-bottom-color: #2a2d3a !important;
}

[data-theme="dark"] .modal-header h3 {
    color: #60a5fa !important;
}

[data-theme="dark"] .modal-body {
    background: #23262f !important;
}

[data-theme="dark"] .modal-footer {
    background: #23262f !important;
    border-top-color: #2a2d3a !important;
}

[data-theme="dark"] .form-group label {
    color: #e5e7eb !important;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: #181a20 !important;
    color: #fff !important;
    border-color: #2a2d3a !important;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: #aaa !important;
}

/* Modal Action Button Styles */
.modal-footer .primary-btn,
.modal-footer .secondary-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-width: 120px;
    text-align: center;
}

.modal-footer .primary-btn {
    background-color: var(--primary-color, #007ec7);
    color: white;
    border-color: var(--primary-color, #007ec7);
}

.modal-footer .primary-btn:hover {
    background-color: #0066a1;
    border-color: #0066a1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 126, 199, 0.3);
}

.modal-footer .secondary-btn {
    background-color: #f8f9fa;
    color: #495057;
    border-color: #dee2e6;
}

.modal-footer .secondary-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Dark mode modal footer button styles */
[data-theme="dark"] .modal-footer {
    background: var(--card-background);
    border-top-color: var(--border-color);
}

[data-theme="dark"] .modal-footer .primary-btn {
    background-color: var(--primary-color, #2563eb);
    border-color: var(--primary-color, #2563eb);
    color: white;
}

[data-theme="dark"] .modal-footer .primary-btn:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

[data-theme="dark"] .modal-footer .secondary-btn {
    background-color: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

[data-theme="dark"] .modal-footer .secondary-btn:hover {
    background-color: #4b5563;
    border-color: #6b7280;
}

/* --- Dark mode and mobile improvements (sticky, visible step footer) --- */
/* Make the step footer sticky and clearly separated from content on all viewports */
.modal-invoice .step-footer {
  position: sticky;
  bottom: 0;
  background: var(--card-background, #fff);
  border-top: 1px solid var(--border-color, #e0e0e0);
  z-index: 5;
}

[data-theme="dark"] .modal-invoice .step-footer {
  background: #23262f !important;
  border-color: #2a2d3a !important;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.35);
}

[data-theme="dark"] .modal-invoice .step-footer .btn.primary-btn {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

[data-theme="dark"] .modal-invoice .step-footer .btn.secondary-btn {
  background: #2a2d3a !important;
  color: #e5e7eb !important;
  border: 1px solid #374151 !important;
}

/* Form Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #007ec7;
    outline: none;
    box-shadow: 0 0 0 2px rgb(255, 255, 255);
}

.form-group input[readonly] {
    background-color: var(--background-color);
    cursor: not-allowed;
}

/* Radio Button Styles */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.5rem 0;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.radio-label span {
    font-weight: 500;
}

/* Dark mode radio button styles */
[data-theme="dark"] .radio-label {
    color: var(--text-primary);
}

[data-theme="dark"] .radio-label input[type="radio"] {
    accent-color: var(--primary-color);
}

/* Items Table */
.items-table-container {
    margin-bottom: 1rem;
    border: 1px solid #c7c7c7;
    border-radius: 4px;
    overflow-x: auto; /* Allow horizontal scrolling */
    max-width: 100%;
    padding: 0.5rem;
}

.items-table {
    width: 100%;
    min-width: 800px; /* Ensure minimum width for all columns */
    border-collapse: collapse;
    table-layout: fixed; /* Fixed layout for better column control */
}

.items-table th,
.items-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    overflow: visible; 
    position: relative; /* Ensure positioning context for children */
    vertical-align: middle;
}

.items-table th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
}

.items-table input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-height: 36px;
    box-sizing: border-box;
}

.items-table select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-height: 36px;
    box-sizing: border-box;
    background: white;
}

.remove-item-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background-color: var(--background-color);
    color: #e55353;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-item-btn:hover {
    background-color: #fcebeb;
}

.invoice-totals {
    margin-top: 1.5rem;
    margin-left: auto;
    width: 300px;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #e9ecef;
}

.totals-row:last-child {
    border-bottom: none;
    font-weight: 600;
    font-size: 1rem;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    color: #007ec7;
}

.totals-row:last-child {
    font-weight: 600;
    font-size: 1rem;
    padding-top: 0.75rem;
    border-top: 2px solid #eee;
    margin-top: 0.5rem;
}

/* View Invoice Modal */
.invoice-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.invoice-view-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.invoice-view-info h3 {
    margin: 0;
    font-size: 1.2rem;
}

.invoice-view-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.template-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
}

.template-selector label {
    font-size: 0.85rem;
    color: #555;
}

.template-selector select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.invoice-preview-container {
    width: 100%;
    height: 100vh;
    overflow: auto;
    margin-bottom: 1.5rem;
    background: #f5f5f5;
    padding: 20px;
}

#invoicePreviewFrame {
    width: 100%;
    height: 100%;
    border: none;
}

.invoice-view-footer {
    margin-top: 1.5rem;
}

.payment-status h4 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 1rem;
}

/* Date Range Picker Styles */
.date-range-group {
    position: relative;
}

.custom-date-range {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color, #ddd);
    border-radius: var(--border-radius, 4px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    z-index: 1000;
    width: 300px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.custom-date-range[style*="display: block"] {
    opacity: 1;
    visibility: visible;
}

.date-range-group select:focus + .custom-date-range {
    display: block;
}

/* Close button for custom date range */
.custom-date-range::before {
    content: '×';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.custom-date-range::before:hover {
    color: #333;
}

/* Date Range Filter Styles */
.date-range-group {
    position: relative;
    margin-right: 1rem;
}

.date-range-group select {
    min-width: 150px;
}

.custom-date-range {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color, #ddd);
    border-radius: var(--border-radius, 4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    z-index: 1000;
    width: 300px;
}

.date-input-group {
    margin-bottom: 1rem;
}

.date-input-group:last-of-type {
    margin-bottom: 0.5rem;
}

.date-input-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted, #666);
}

.date-input-group input[type="date"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: var(--border-radius, 4px);
    font-size: 0.875rem;
}

#applyDateRange {
    width: 100%;
    padding: 0.5rem;
    background-color: var(--primary-color, #007bff);
    color: white;
    border: none;
    border-radius: var(--border-radius, 4px);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

#applyDateRange:hover {
    background-color: var(--primary-color-dark, #0056b3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .date-range-group {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .custom-date-range {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .invoice-view-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .invoice-view-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem auto;
    }
}

/* --- Robust [data-theme="dark"] rules for modal and table dark mode --- */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .invoice-table-container,
[data-theme="dark"] .items-table,
[data-theme="dark"] .items-table th,
[data-theme="dark"] .items-table td {
  background: #23262f !important;
  color: #fff !important;
  border-color: #2a2d3a !important;
}
[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .modal-body h3,
[data-theme="dark"] .modal-body h4,
[data-theme="dark"] .items-table th {
  color: #60a5fa !important;
}
[data-theme="dark"] .form-group label,
[data-theme="dark"] .modal label {
  color: #e5e7eb !important;
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: #181a20 !important;
  color: #fff !important;
  border-color: #2a2d3a !important;
}
[data-theme="dark"] .form-group input:disabled,
[data-theme="dark"] .form-group select:disabled,
[data-theme="dark"] .form-group textarea:disabled {
  background: #23262f !important;
  color: #aaa !important;
}
[data-theme="dark"] .modal-stepper .step-indicator {
  background: #181a20 !important;
  color: #aaa !important;
  border: 1px solid #333 !important;
  border-bottom: none !important;
}
[data-theme="dark"] .modal-stepper .step-indicator.active {
  background: #2563eb !important;
  color: #fff !important;
  border-bottom: 2px solid #60a5fa !important;
}
[data-theme="dark"] .modal-stepper .step-indicator:not(.active) {
  color: #aaa !important;
}
[data-theme="dark"] .modal-overlay {
    background: rgba(0,0,0,0.4) !important; /* Reduced opacity for better visibility behind modal in dark mode */
}

/* Dark mode – invoices table container and inner table (desktop + mobile) */
[data-theme="dark"] .invoice-table-container {
  background: #23262f !important;
  border-color: #2a2d3a !important;
}
[data-theme="dark"] .invoice-table-container .table-responsive {
  background: #23262f !important;
}
[data-theme="dark"] .invoice-table-container .data-table,
[data-theme="dark"] .invoice-table-container .data-table th,
[data-theme="dark"] .invoice-table-container .data-table td {
  background: #23262f !important;
  color: #fff !important;
  border-color: #2a2d3a !important;
}

[data-theme="dark"] .action-dropdown {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    color: #fff !important;
}

[data-theme="dark"] .dropdown-header {
    background-color: #181a20 !important;
    border-bottom-color: #2a2d3a !important;
    color: #60a5fa !important;
}

[data-theme="dark"] .dropdown-item {
    color: #e5e7eb !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #181a20 !important;
}

[data-theme="dark"] .dropdown-item i {
    color: #60a5fa !important;
}

[data-theme="dark"] .dropdown-item-danger {
    color: #f87171 !important;
}

[data-theme="dark"] .dropdown-item-danger:hover {
    background-color: #1f2937 !important;
}

[data-theme="dark"] .dropdown-item-danger i {
    color: #f87171 !important;
}
[data-theme="dark"] .btn,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn.secondary-btn {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
[data-theme="dark"] .btn:hover,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn.secondary-btn:hover {
  background: #1e40af !important;
  color: #fff !important;
}
[data-theme="dark"] ::-webkit-scrollbar {
  width: 12px;
  background: #23262f;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 6px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}
[data-theme="dark"] ::-webkit-scrollbar-corner {
  background: #23262f;
}
[data-theme="dark"] {
  scrollbar-color: #444 #23262f;
  scrollbar-width: thin;
}

/* Chart Card */
.chart-card {
    background: var(--card-background);
    color: var(--text-primary);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.suggestion-box {
    font-size: 14px;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}
  
.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.item-description-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

.product-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.product-suggestions .suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.product-suggestions .suggestion-item:hover {
    background-color: #f5f5f5;
}

.product-suggestions .suggestion-item .product-name {
    font-weight: 500;
}

.product-suggestions .suggestion-item .product-price,
.product-suggestions .suggestion-item .suggestion-price {
    color: #666;
    font-size: 0.9em;
}

/* Header and empty state for product suggestions */
.suggestions-header {
    position: sticky;
    top: 0;
    background: var(--background-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    z-index: 1;
}
.no-suggestions {
    padding: 10px 12px;
    color: #777;
}

/* Dark mode styling for suggestion dropdown */
[data-theme="dark"] .product-suggestions {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    box-shadow: 0 2px 8px #181a20 !important;
}
[data-theme="dark"] .suggestions-header {
    background: #181a20 !important;
    color: #60a5fa !important;
    border-bottom-color: #2a2d3a !important;
}
[data-theme="dark"] .product-suggestions .suggestion-item span { 
    color: #fff !important;
}
[data-theme="dark"] .product-suggestions .suggestion-item .product-price,
[data-theme="dark"] .product-suggestions .suggestion-item .suggestion-price {
    color: #60a5fa !important;
}
[data-theme="dark"] .no-suggestions {
    color: #9aa4b2 !important;
}

/* Strong light-mode isolation for content rendered inside PDF container */
[data-theme="dark"] .pdf-root { 
    background: #ffffff !important; 
    color: #000000 !important; 
}
[data-theme="dark"] .pdf-root .invoice-container { 
    background: #ffffff !important; 
    color: #000000 !important; 
}
[data-theme="dark"] .pdf-root .invoice-items td, 
[data-theme="dark"] .pdf-root .invoice-items tbody td, 
[data-theme="dark"] .pdf-root p,
[data-theme="dark"] .pdf-root span,
[data-theme="dark"] .pdf-root li,
[data-theme="dark"] .pdf-root .client-info,
[data-theme="dark"] .pdf-root .invoice-details { 
    color: #000000 !important; 
}
[data-theme="dark"] .pdf-root .invoice-items td { 
    border-bottom: 1px solid #eeeeee !important; 
}

.dropdown-menu {
    position: fixed; /* Use fixed position to avoid issues with table scrolling */
    background-color: var(--card-background); /* Use a variable or default */
    border: 1px solid var(--border-color, #e0e0e0); /* Use a variable or default */
    border-radius: var(--card-radius); /* Use the defined card radius */
    box-shadow: var(--box-shadow); /* Use the defined box shadow */
    z-index: 1000; /* Ensure it's above other content */
    min-width: 150px;
    display: none; /* Hidden by default, shown by JS */
    padding: 0.5rem 0; /* Add some vertical padding */
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem; /* Slightly smaller font size */
    color: var(--text-color, #333); /* Use a variable or default */
    display: flex; /* Use flexbox for icon and text alignment */
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
}

.dropdown-item:hover {
    background-color: var(--hover-background-color, #f0f0f0); /* Use a variable or default */
    color: var(--primary-color, #007ec7); /* Highlight text on hover */
}

.dropdown-item i {
    width: 1rem; /* Fixed width for icons */
    text-align: center;
}

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.export-buttons button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.export-buttons button i {
    font-size: 1rem;
}

.export-buttons .btn-success {
    background-color: #28a745;
    color: white;
}

.export-buttons .btn-success:hover {
    background-color: #218838;
}

.export-buttons .btn-primary {
    background-color: #007bff;
    color: white;
}

.export-buttons .btn-primary:hover {
    background-color: #0056b3;
}

.export-buttons button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.export-buttons button:disabled i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Action Menu */
.action-menu {
    position: relative;
    display: flex;
    justify-content: center;
}

.action-menu-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.action-menu-btn:hover {
    background-color: #f0f0f0;
    color: #007ec7;
}

/* Action Dropdown */
.action-dropdown {
    position: absolute;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 280px;
    z-index: 1000;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.dropdown-content {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: #666;
}

.dropdown-item span {
    flex: 1;
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 8px 0;
}

.dropdown-item-danger {
    color: #dc3545;
}

.dropdown-item-danger:hover {
    background-color: #fff5f5;
}

.dropdown-item-danger i {
    color: #dc3545;
}

/* Mobile responsive styles for action dropdown */
@media (max-width: 768px) {
    .action-dropdown {
        min-width: 180px;
        max-width: 250px;
        max-height: 70vh;
        font-size: 14px;
    }
    
    .dropdown-header {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .dropdown-item {
        padding: 8px 12px;
        font-size: 13px;
        gap: 8px;
    }
    
    .dropdown-item i {
        width: 14px;
        font-size: 12px;
    }
}

/* --- Modal Stepper Styles --- */
.modal-stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 0 8px;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--background-color, #f8f9fa);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.modal-stepper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color, #007ec7) 0%, rgba(0, 126, 199, 0.6) 100%);
  z-index: 1;
}

.step-indicator {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-bottom: 3px solid transparent;
  color: #888;
  font-weight: 500;
  position: relative;
  transition: all 0.3s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 2;
  border-radius: 0;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-indicator.active {
  color: var(--primary-color, #007ec7);
  background: rgba(0, 126, 199, 0.1);
  position: relative;
}

.step-indicator.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color, #007ec7);
  border-radius: 0;
}

.step-indicator:not(.active):hover {
  background: rgba(0, 126, 199, 0.05);
  color: var(--text-primary, #333);
}

.step-indicator:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  z-index: 1;
}

/* --- Step Content --- */
.step {
  display: none;
  animation: fadeIn 0.3s;
  margin-bottom: 1rem;
}
.step.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Step Footer Buttons --- */
.step-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* --- Review Section --- */
.review-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid #e9ecef;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.review-section table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.review-section th,
.review-section td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.9rem;
  background: white;
}

.review-section tr:last-child td {
  border-bottom: none;
  font-weight: 600;
  background: #f8f9fa;
}

.step-content-wrapper h3 {
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #007ec7;
  display: inline-block;
}

.review-section th {
  background: #e9ecef;
  font-weight: 600;
  color: #495057;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Responsive Modal --- */
@media (max-width: 600px) {
  .modal-content {
    padding: 8px;
    width: 95%;
    margin: 1rem auto;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
  }
  
  .items-table-container {
    padding: 0.25rem;
  }
  
  .items-table {
    min-width: 600px;
  }
  
  .invoice-totals {
    width: 100%;
    margin-left: 0;
    margin-top: 1rem;
  }
  
  .modal-invoice .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    margin: 1rem;
  }

  .modal-invoice .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    position: sticky;
    top: 0;
    background: var(--card-background);
    z-index: 10;
    border-radius: 16px 16px 0 0;
  }

  .modal-invoice .modal-body {
    padding: 1.5rem;
  }

  .modal-invoice .modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
    position: sticky;
    bottom: 0;
    background: var(--card-background);
    z-index: 10;
    border-radius: 0 0 16px 16px;
  }

  /* Extra emphasis for mobile dark mode footer */
  [data-theme="dark"] .modal-invoice .modal-footer {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.35) !important;
  }
  
  .modal-stepper {
    flex-direction: row;
    gap: 0;
    margin-bottom: 1rem;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
  }
  
  .step-indicator {
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem;
    min-height: 40px;
    font-weight: 700;
  }

  /* Mobile-optimized form groups */
  .form-group {
    margin-bottom: 1.5rem;
  }

  .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-primary, #333);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-height: 44px;
  }

  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    border-color: var(--primary-color, #007ec7);
    box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
    outline: none;
  }

  /* Mobile-optimized step footer */
  .step-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .step-footer .btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-height: 44px;
  }

  /* Mobile-optimized items table */
  .items-table-container {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #e0e0e0);
  }

  .items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }

  .items-table th {
    background: var(--background-color, #f8f9fa);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary, #666);
    border-bottom: 2px solid var(--border-color, #e0e0e0);
    font-size: 0.85rem;
  }

  .items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    vertical-align: top;
  }

  .items-table input,
  .items-table select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--card-background);
    color: var(--text-primary, #333);
    transition: all 0.2s ease;
  }

  .items-table input:focus,
  .items-table select:focus {
    border-color: var(--primary-color, #007ec7);
    box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
    outline: none;
  }

  /* Mobile-optimized item row cards */
  .item-row {
    background: var(--card-background);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
  }

  .item-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
  }

  .item-row td {
    border: none;
    padding: 0.75rem;
  }

  .item-description-wrapper {
    position: relative;
  }

  .item-description {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-background);
    color: var(--text-primary, #333);
    transition: all 0.2s ease;
  }

  .item-description:focus {
    border-color: var(--primary-color, #007ec7);
    box-shadow: 0 0 0 2px rgba(0, 126, 199, 0.1);
    outline: none;
  }

  /* Item description help text - smaller and less prominent */
  .item-description-help small {
    color: var(--text-light, #999) !important;
    font-size: 0.75rem !important;
    margin-top: 0.25rem;
    display: block;
    opacity: 0.8;
  }

  /* Mobile-optimized invoice totals */
  .invoice-totals {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-primary, #333);
  }

  .totals-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color, #e0e0e0);
  }

  .totals-row:last-child {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--primary-color, #007ec7);
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color, #e0e0e0);
  }

  /* Mobile-optimized items pagination */
  .items-pagination {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .pagination-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    font-weight: 500;
  }

  .pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .pagination-btn {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--card-background);
    color: var(--text-primary, #333);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
  }

  .pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color, #007ec7);
    background: rgba(0, 126, 199, 0.05);
  }

  .pagination-btn.active {
    background: var(--primary-color, #007ec7);
    color: white;
    border-color: var(--primary-color, #007ec7);
    box-shadow: 0 2px 4px rgba(0, 126, 199, 0.2);
  }

  .pagination-btn.active:hover {
    background: var(--primary-color, #007ec7);
    transform: none;
  }

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

  .items-limit-info {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-light, #999);
    font-style: italic;
  }

  /* Mobile-optimized item action buttons */
  .item-action-buttons {
    display: flex;
    gap: 0.75rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
  }

  .item-action-buttons .btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
  }

  /* Ensure buttons are properly aligned on mobile */
  @media (max-width: 480px) {
    .item-action-buttons {
      flex-direction: column;
      gap: 0.5rem;
      justify-content: flex-start;
    }

    .item-action-buttons .btn {
      flex: none;
      width: 100%;
      min-width: auto;
    }
  }
}

.item-discount-value {
  display: block !important;
  width: 80px;
  min-width: 60px;
  max-width: 120px;
}

/* Item Action Buttons */
.item-action-buttons {
    display: flex;
    gap: 0.75rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

.item-action-buttons .btn {
    flex: 0 1 auto;
    min-width: 160px;
    justify-content: center;
    height: 44px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Items Pagination Styles */
.items-pagination {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pagination-info {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: #495057;
    font-size: 0.95rem;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pagination-controls .pagination-btn {
    padding: 10px 18px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pagination-controls .pagination-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.pagination-controls .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pagination-controls .pagination-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
    font-weight: 600;
}

.pagination-controls .pagination-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#items-page-numbers {
    display: flex;
    gap: 5px;
}

#items-page-numbers .page-number {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

#items-page-numbers .page-number:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#items-page-numbers .page-number.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 600;
}

#items-page-numbers .page-number:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.items-limit-info {
    text-align: center;
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
}

/* Hide items that are not on the current page */
.item-row.hidden {
    display: none;
}

/* Show only items on the current page */
.item-row.visible {
    display: table-row;
}

/* REMOVED: These styles are now handled in invoices.html to avoid conflicts */

/* Removed conflicting dark mode styles - now handled above */
[data-theme="dark"] .invoice-preview-container {
  background: #fff !important;
}
/* Removed conflicting dark mode styles for invoice templates */

/* Removed conflicting dark mode styles - now handled above */

@media (max-width: 768px) {
  #invoiceModal .items-table thead {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
  }
  #invoiceModal .items-table tr {
    background: #f8fafc !important;
    border-radius: 18px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
    margin-bottom: 1rem !important;
    padding: 0.7rem 2rem 1rem 2rem !important; /* much more horizontal padding */
    transition: box-shadow 0.18s, transform 0.18s;
    border: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #invoiceModal .items-table tr:active,
  #invoiceModal .items-table tr:focus,
  #invoiceModal .items-table tr:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.13) !important;
    transform: translateY(-2px) scale(1.01);
  }
  #invoiceModal .items-table td {
    display: block !important;
    width: 100% !important;
    padding: 0.3rem 0.8rem !important; /* more left/right padding */
    border: none !important;
    position: relative !important;
    border-bottom: 1px solid #e5e7eb !important;
    font-size: 0.9em !important;
    margin-bottom: 0.15rem !important;
    background: transparent !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #invoiceModal .items-table td:last-child {
    border-bottom: none !important;
  }
  #invoiceModal .items-table td:before {
    content: attr(data-label) !important;
    display: block !important;
    font-weight: 600 !important;
    color: #555 !important;
    font-size: 0.9em !important;
    margin-bottom: 2px !important;
    text-align: left !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #invoiceModal .items-table input,
  #invoiceModal .items-table select {
    font-size: 0.9em !important;
    margin-bottom: 0.1rem !important;
    padding: 0.35em 0.6em !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }
  #invoiceModal .items-table .item-total,
  #invoiceModal .items-table td:last-child .item-total {
    font-weight: bold !important;
    color: #2563eb !important;
    font-size: 1.1em !important;
    letter-spacing: 0.01em;
  }
  #invoiceModal .items-table .remove-item-btn {
    margin-top: 0.7rem !important;
    background: #fff0f0 !important;
    border: 1px solid #fca5a5 !important;
    color: #e55353 !important;
    transition: background 0.18s, box-shadow 0.18s;
    box-shadow: 0 1px 4px rgba(252,165,165,0.10);
  }
  #invoiceModal .items-table .remove-item-btn:hover {
    background: #ffe4e6 !important;
    color: #b91c1c !important;
  }
}

@media (max-width: 768px) {
  [data-theme="dark"] #invoiceModal .items-table tr {
    background: #23262f !important;
    border-color: #2a2d3a !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(96,165,250,0.10) !important;
  }
  [data-theme="dark"] #invoiceModal .items-table td:before {
    color: #60a5fa !important;
  }
  [data-theme="dark"] #invoiceModal .items-table td {
    border-bottom: 1px solid #2a2d3a !important;
  }
}

@media (max-width: 768px) {
  #invoiceModal .items-table td:before {
    text-align: left !important;
  }
  #invoiceModal .items-table td:first-child,
  #invoiceModal .items-table td:first-child input {
    text-align: left !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 768px) {
  #invoiceModal .items-table td {
    display: block !important;
    width: 100% !important;
    padding: 0.4rem 0.2rem !important;
    border: none !important;
    position: relative !important;
    border-bottom: 1px solid #f0f0f0 !important;
    font-size: 0.8em !important;
    margin-bottom: 0.2rem !important;
  }
  #invoiceModal .items-table td:last-child {
    border-bottom: none !important;
  }
  #invoiceModal .items-table td:before {
    content: attr(data-label) !important;
    display: block !important;
    font-weight: 600 !important;
    color: #555 !important;
    font-size: 0.8em !important;
    margin-bottom: 2px !important;
    text-align: left !important;
    padding-right: 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    word-break: break-word !important;
  }
  #invoiceModal .items-table input,
  #invoiceModal .items-table select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    font-size: 0.8em !important;
    text-align: left !important;
  }
}

/* Mobile styles for invoice preview */
@media (max-width: 600px) {
  .invoice-preview-container {
    padding: 0 !important;
    font-size: 14px !important;
    height: 100%;
    overflow: auto;
  }
  
  #invoicePreviewContent {
    padding: 0.5rem !important;
    margin: 0 !important;
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 300px;
    overflow: auto;
  }
  
  .invoice-header, .company-info, .client-info, .invoice-info-box {
    width: 100% !important;
    box-sizing: border-box;
    margin: 0 0 8px 0 !important;
    padding: 8px !important;
    font-size: 14px !important;
    background: var(--card-background);
    border-radius: 4px;
  }
  
  .invoice-info-box {
    float: none !important;
    display: block !important;
    margin: 0 auto 8px auto !important;
    width: 100% !important;
    font-size: 13px !important;
    text-align: left !important;
  }
  
  .company-info h1, .company-info h2, .company-info h3 {
    font-size: 18px !important;
    margin-bottom: 4px !important;
  }
  
  .client-info {
    font-size: 13px !important;
    padding: 8px !important;
    margin-bottom: 8px !important;
  }
  
  /* Stack elements vertically */
  .invoice-header, .company-info, .invoice-info-box, .client-info {
    display: block !important;
    float: none !important;
    clear: both !important;
  }
  
  /* Remove excessive borders/shadows if any */
  .invoice-preview-container {
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  
  /* Ensure proper spacing */
  .invoice-preview-container > * {
    margin-bottom: 8px !important;
  }
  
  .invoice-preview-container > *:last-child {
    margin-bottom: 0 !important;
  }
}

/* Dark mode optimizations for mobile */
@media (max-width: 600px) {
  [data-theme="dark"] .modal-stepper {
    background: #2a2d3a;
  }

  [data-theme="dark"] .step-indicator {
    color: #a0a0a0;
  }

  [data-theme="dark"] .step-indicator.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
  }

  [data-theme="dark"] .items-table-container,
  [data-theme="dark"] .invoice-totals {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .items-table th {
    background: #2a2d3a;
    color: #a0a0a0;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .items-table input,
  [data-theme="dark"] .items-table select,
  [data-theme="dark"] .item-description {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .pagination-btn {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .modal-invoice .modal-header,
  [data-theme="dark"] .modal-invoice .modal-footer {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .form-group input,
  [data-theme="dark"] .form-group select,
  [data-theme="dark"] .form-group textarea {
    background: #181a20;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .form-group label {
    color: #e5e7eb;
  }

  /* Removed dark mode styles for totals rows during creation */

  [data-theme="dark"] .item-action-buttons .btn {
    background: #23262f;
    color: #fff;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .item-action-buttons .btn:hover {
    background: #2a2d3a;
    border-color: #60a5fa;
  }
}

/* View Invoice Modal - Improved Layout */
.modal-preview {
    z-index: 1100; /* Higher than other modals */
}

/* Email Modal should appear above the preview modal */
.modal-email {
    z-index: 1200;
}

.modal-preview .modal-content {
    width: 95%;
    max-width: 800px;
    max-height: 95vh;
    margin: 2.5vh auto;
    display: flex;
    flex-direction: column;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-preview .modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--card-background);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-preview .modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #333);
}

.modal-preview .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-preview .modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
    background: var(--card-background);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Invoice View Header - Improved Layout */
.invoice-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--card-background);
    flex-shrink: 0;
}

.invoice-view-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.invoice-view-info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.invoice-view-info .status {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
    width: fit-content;
}

.invoice-view-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.invoice-view-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Invoice Preview Container - Improved Layout */
.invoice-preview-container {
    flex: 1;
    overflow: auto;
    background: var(--background-color, #f8f9fa);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Invoice Content Styling - Improved Readability */
#invoicePreviewContent {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    background: var(--card-background);
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Invoice Header Styling */
#invoicePreviewContent .invoice-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

#invoicePreviewContent .company-info {
    margin-bottom: 1.5rem;
}

#invoicePreviewContent .company-info h1,
#invoicePreviewContent .company-info h2,
#invoicePreviewContent .company-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #333);
}

#invoicePreviewContent .company-info p {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary, #666);
}

/* Invoice Info Box Styling */
#invoicePreviewContent .invoice-info-box {
    background: linear-gradient(135deg, var(--primary-color, #007ec7) 0%, var(--primary-dark, #005a9e) 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 126, 199, 0.2);
}

#invoicePreviewContent .invoice-info-box h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: white;
}

#invoicePreviewContent .invoice-info-box p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Client Info Styling */
#invoicePreviewContent .client-info {
    background: var(--card-background);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#invoicePreviewContent .client-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary, #333);
}

#invoicePreviewContent .client-info p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary, #666);
}

/* Invoice Table Styling */
#invoicePreviewContent .invoice-table,
#invoicePreviewContent .invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#invoicePreviewContent .invoice-table th,
#invoicePreviewContent .invoice-items-table th {
    background: linear-gradient(135deg, var(--primary-color, #007ec7) 0%, var(--primary-dark, #005a9e) 100%);
    color: white;
    padding: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    border: none;
}

#invoicePreviewContent .invoice-table td,
#invoicePreviewContent .invoice-items-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    font-size: 0.85rem;
    color: var(--text-primary, #333);
}

#invoicePreviewContent .invoice-table tr:last-child td,
#invoicePreviewContent .invoice-items-table tr:last-child td {
    border-bottom: none;
}

#invoicePreviewContent .invoice-table tr:hover td,
#invoicePreviewContent .invoice-items-table tr:hover td {
    background: rgba(0, 126, 199, 0.05);
}

/* Invoice Totals Styling */
#invoicePreviewContent .invoice-totals {
    background: var(--card-background);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#invoicePreviewContent .invoice-totals .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-primary, #333);
}

#invoicePreviewContent .invoice-totals .totals-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

#invoicePreviewContent .invoice-totals .totals-row:last-child {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color, #007ec7);
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--primary-color, #007ec7);
}

/* Notes Section Styling */
#invoicePreviewContent .invoice-notes {
    background: var(--card-background);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

#invoicePreviewContent .invoice-notes h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #333);
}

#invoicePreviewContent .invoice-notes p {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    line-height: 1.4;
}

@media (max-width: 480px) {
    .invoice-view-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .invoice-view-actions .btn {
        width: 100%;
        justify-content: center;
    }

    #invoicePreviewContent {
        margin: 0.25rem;
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* Dark Mode Support for Invoice Preview */
@media (max-width: 600px) {
  [data-theme="dark"] .modal-preview .modal-content {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .modal-preview .modal-header,
  [data-theme="dark"] .modal-preview .modal-footer {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .modal-preview .modal-header h2 {
    color: #fff;
  }

  [data-theme="dark"] .invoice-view-header {
    background: #23262f;
    border-color: #2a2d3a;
  }

  [data-theme="dark"] .invoice-view-info h3 {
    color: #fff;
  }

  [data-theme="dark"] .invoice-view-info .status {
    background: #2a2d3a;
    color: #a0a0a0;
  }

  [data-theme="dark"] .invoice-preview-container {
    background: #1a1d24;
  }

  /* Removed conflicting dark mode styles for invoice templates */
}

/* Mobile Optimizations for Invoice Preview */
@media (max-width: 768px) {
    .modal-preview .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-preview .modal-header {
        padding: 1rem;
    }

    .modal-preview .modal-header h2 {
        font-size: 1.1rem;
    }

    .invoice-view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .invoice-view-info {
        width: 100%;
    }

    .invoice-view-info h3 {
        font-size: 1rem;
    }

    .invoice-view-actions {
        width: 100%;
        justify-content: space-between;
    }

    .invoice-view-actions .btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    #invoicePreviewContent {
        margin: 0.5rem;
        padding: 1rem;
        min-height: 300px;
        font-size: 0.9rem;
    }

    /* Mobile Invoice Content Improvements */
    #invoicePreviewContent .company-info h1,
    #invoicePreviewContent .company-info h2,
    #invoicePreviewContent .company-info h3 {
        font-size: 1.2rem;
    }

    #invoicePreviewContent .company-info p {
        font-size: 0.85rem;
    }

    #invoicePreviewContent .invoice-info-box {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    #invoicePreviewContent .invoice-info-box h3 {
        font-size: 1rem;
    }

    #invoicePreviewContent .invoice-info-box p {
        font-size: 0.8rem;
    }

    #invoicePreviewContent .client-info {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    #invoicePreviewContent .client-info h3 {
        font-size: 1rem;
    }

    #invoicePreviewContent .client-info p {
        font-size: 0.8rem;
    }

    #invoicePreviewContent .invoice-table th,
    #invoicePreviewContent .invoice-items-table th {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    #invoicePreviewContent .invoice-table td,
    #invoicePreviewContent .invoice-items-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    #invoicePreviewContent .invoice-totals {
        padding: 0.75rem;
    }

    #invoicePreviewContent .invoice-totals .totals-row {
        font-size: 0.8rem;
    }

    #invoicePreviewContent .invoice-totals .totals-row:last-child {
        font-size: 1rem;
    }

    .modal-preview .modal-footer {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .invoice-view-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .invoice-view-actions .btn {
        width: 100%;
        justify-content: center;
    }

    #invoicePreviewContent {
        margin: 0.25rem;
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    /* Extra Small Screen Invoice Content */
    #invoicePreviewContent .company-info h1,
    #invoicePreviewContent .company-info h2,
    #invoicePreviewContent .company-info h3 {
        font-size: 1.1rem;
    }

    #invoicePreviewContent .company-info p {
        font-size: 0.8rem;
    }

    #invoicePreviewContent .invoice-info-box {
        padding: 0.5rem;
    }

    #invoicePreviewContent .invoice-info-box h3 {
        font-size: 0.9rem;
    }

    #invoicePreviewContent .invoice-info-box p {
        font-size: 0.75rem;
    }

    #invoicePreviewContent .client-info {
        padding: 0.5rem;
    }

    #invoicePreviewContent .client-info h3 {
        font-size: 0.9rem;
    }

    #invoicePreviewContent .client-info p {
        font-size: 0.75rem;
    }

    #invoicePreviewContent .invoice-table th,
    #invoicePreviewContent .invoice-items-table th {
        padding: 0.4rem;
        font-size: 0.7rem;
    }

    #invoicePreviewContent .invoice-table td,
    #invoicePreviewContent .invoice-items-table td {
        padding: 0.4rem;
        font-size: 0.7rem;
    }

    #invoicePreviewContent .invoice-totals {
        padding: 0.5rem;
    }

    #invoicePreviewContent .invoice-totals .totals-row {
        font-size: 0.75rem;
    }

    #invoicePreviewContent .invoice-totals .totals-row:last-child {
        font-size: 0.9rem;
    }
}

/* Dark Mode Support for Invoice Content */
@media (max-width: 600px) {
  /* Removed conflicting dark mode styles for invoice preview content */
}

/* Hide add product hint in desktop mode */
@media (min-width: 769px) {
    .item-description-help {
        display: none !important;
    }
}

/* Dark mode should NOT affect invoice templates - ONLY for preview */
[data-theme="dark"] #invoicePreviewContent {
    background: #fff !important;
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .company-info h1,
[data-theme="dark"] #invoicePreviewContent .company-info h2,
[data-theme="dark"] #invoicePreviewContent .company-info h3 {
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .company-info p {
    color: #555 !important;
}

[data-theme="dark"] #invoicePreviewContent .client-info {
    background: #fff !important;
    border-color: #e0e0e0 !important;
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .client-info h3 {
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .client-info p {
    color: #555 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-table,
[data-theme="dark"] #invoicePreviewContent .invoice-items-table {
    background: #fff !important;
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-table th,
[data-theme="dark"] #invoicePreviewContent .invoice-items-table th {
    background: linear-gradient(135deg, #007ec7 0%, #005a9e 100%) !important;
    color: white !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-table td,
[data-theme="dark"] #invoicePreviewContent .invoice-items-table td {
    color: #222 !important;
    border-color: #e0e0e0 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-table tr:hover td,
[data-theme="dark"] #invoicePreviewContent .invoice-items-table tr:hover td {
    background: rgba(0, 126, 199, 0.05) !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-totals {
    background: #fff !important;
    border-color: #e0e0e0 !important;
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-totals .totals-row {
    color: #222 !important;
    border-color: #e0e0e0 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-totals .totals-row:last-child {
    color: var(--primary-color, #007ec7) !important;
    border-top-color: var(--primary-color, #007ec7) !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-notes {
    background: #fff !important;
    border-color: #e0e0e0 !important;
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-notes h3 {
    color: #222 !important;
}

[data-theme="dark"] #invoicePreviewContent .invoice-notes p {
    color: #555 !important;
}

/* Dark mode for invoice creation interface - keep dark */
[data-theme="dark"] .modal-invoice .invoice-totals {
    background: #181a20 !important;
    color: #fff !important;
    border-radius: 8px !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .review-section {
    background: #181a20 !important;
    color: #fff !important;
    border-radius: 8px !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .totals-row:not(#invoicePreviewContent .totals-row) {
    color: #fff !important;
}

[data-theme="dark"] .totals-row:not(#invoicePreviewContent .totals-row):last-child {
    color: #60a5fa !important;
}

/* Dark mode for invoice creation modal */
[data-theme="dark"] .modal-content {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .modal-header {
    background: #23262f !important;
    border-bottom: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .modal-header h2 {
    color: #fff !important;
}

[data-theme="dark"] .modal-body {
    background: #23262f !important;
    color: #fff !important;
}

[data-theme="dark"] .modal-footer {
    background: #23262f !important;
    border-top: 1px solid #2a2d3a !important;
}

/* Dark mode for items table in creation */
[data-theme="dark"] .items-table-container {
    background: #23262f !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

[data-theme="dark"] .items-table th,
[data-theme="dark"] .items-table td {
    background: #23262f !important;
    color: #fff !important;
    border-bottom: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .items-table tr {
    border-bottom: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .items-table input,
[data-theme="dark"] .items-table select,
[data-theme="dark"] .items-table textarea {
    background: #181a20 !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

/* Dark mode for pagination in creation */
[data-theme="dark"] .items-pagination {
    background: #181a20 !important;
    color: #fff !important;
    border-radius: 8px !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .pagination-controls .pagination-btn {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .pagination-controls .pagination-btn.active {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

[data-theme="dark"] .pagination-controls .pagination-btn:disabled {
    background: #23262f !important;
    color: #555 !important;
    opacity: 0.5;
}

/* Dark mode for suggestions in creation */
[data-theme="dark"] .suggestion-box,
[data-theme="dark"] .product-suggestions {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
    box-shadow: 0 2px 8px #181a20 !important;
}

[data-theme="dark"] .suggestion-item,
[data-theme="dark"] .product-suggestions .suggestion-item {
    background: #23262f !important;
    color: #fff !important;
    border-bottom: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .suggestion-item:hover,
[data-theme="dark"] .product-suggestions .suggestion-item:hover {
    background: #2563eb !important;
    color: #fff !important;
}

[data-theme="dark"] .product-suggestions .suggestion-item .product-price {
    color: #60a5fa !important;
}

[data-theme="dark"] .suggestion-item:last-child,
[data-theme="dark"] .product-suggestions .suggestion-item:last-child {
    border-bottom: none !important;
}

/* Dark mode for form elements in creation */
[data-theme="dark"] .form-group label {
    color: #e5e7eb !important;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: #181a20 !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

[data-theme="dark"] .form-group input:disabled,
[data-theme="dark"] .form-group select:disabled,
[data-theme="dark"] .form-group textarea:disabled {
    background: #2a2d3a !important;
    color: #6b7280 !important;
}

/* Dark mode for buttons in creation */
[data-theme="dark"] .btn {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .btn:hover {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

/* Dark mode for stepper in creation */
[data-theme="dark"] .modal-stepper .step-indicator {
    background: #2a2d3a !important;
    color: #6b7280 !important;
}

[data-theme="dark"] .modal-stepper .step-indicator.active {
    background: #2563eb !important;
    color: #fff !important;
}

[data-theme="dark"] .modal-stepper .step-indicator:not(.active) {
    background: #2a2d3a !important;
    color: #6b7280 !important;
}

/* Dark mode for overlay */
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Dark mode for dropdowns in creation */
[data-theme="dark"] .action-dropdown {
    background: #23262f !important;
    border: 1px solid #2a2d3a !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .dropdown-header {
    background: #181a20 !important;
    color: #fff !important;
    border-bottom: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .dropdown-item {
    color: #fff !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background: #2563eb !important;
    color: #fff !important;
}

[data-theme="dark"] .dropdown-item i {
    color: #6b7280 !important;
}

[data-theme="dark"] .dropdown-item-danger {
    color: #ef4444 !important;
}

[data-theme="dark"] .dropdown-item-danger:hover {
    background: #dc2626 !important;
    color: #fff !important;
}

[data-theme="dark"] .dropdown-item-danger i {
    color: #ef4444 !important;
}

/* Dark mode for scrollbars */
[data-theme="dark"] ::-webkit-scrollbar {
    background: #23262f !important;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #4b5563 !important;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #6b7280 !important;
}

[data-theme="dark"] ::-webkit-scrollbar-corner {
    background: #23262f !important;
}

/* Dark mode for table filters */
[data-theme="dark"] .table-filters label {
    color: #e5e7eb !important;
}

[data-theme="dark"] .table-filters select,
[data-theme="dark"] .table-filters input,
[data-theme="dark"] .search-input {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2a2d3a !important;
}

[data-theme="dark"] .table-filters button,
[data-theme="dark"] .search-clear-btn {
    background: #23262f !important;
    color: #fff !important;
    border: 1px solid #2563eb !important;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

[data-theme="dark"] .table-filters button:hover,
[data-theme="dark"] .search-clear-btn:hover {
    background: #2563eb !important;
    color: #fff !important;
    border-color: #2563eb !important;
}

[data-theme="dark"] .table-filters,
[data-theme="dark"] .search-bar {
    background: #23262f !important;
}

/* Review Step Styles */
.review-summary {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.review-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.review-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.review-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #007ec7;
}

.review-section p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.review-section p strong {
    color: #555;
    font-weight: 600;
}

.review-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.review-items-table th {
    background-color: #f8f9fa;
    padding: 0.5rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
}

.review-items-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.review-items-table tbody tr:hover {
    background-color: #f8f9fa;
}

.review-totals {
    background: #fff;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-top: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.total-row:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.total-row.total-final {
    font-weight: 600;
    font-size: 1rem;
    color: #007ec7;
    border-top: 2px solid #007ec7;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* Dark theme support for review step */
[data-theme="dark"] .review-summary {
    background: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .review-section h4 {
    color: #e2e8f0;
    border-bottom-color: #007ec7;
}

[data-theme="dark"] .review-section p {
    color: #cbd5e0;
}

[data-theme="dark"] .review-section p strong {
    color: #e2e8f0;
}

[data-theme="dark"] .review-items-table th {
    background-color: #4a5568;
    color: #e2e8f0;
    border-bottom-color: #718096;
}

[data-theme="dark"] .review-items-table td {
    color: #cbd5e0;
    border-bottom-color: #4a5568;
}

[data-theme="dark"] .review-items-table tbody tr:hover {
    background-color: #4a5568;
}

[data-theme="dark"] .review-totals {
    background: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .total-row {
    color: #cbd5e0;
}

[data-theme="dark"] .total-row:not(:last-child) {
    border-bottom-color: #4a5568;
}

[data-theme="dark"] .total-row.total-final {
    color: #007ec7;
    border-top-color: #007ec7;
}

/* Additional styles for the old implementation look */
.items-table-container {
    margin-top: 12px;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
}

.items-table th {
    background-color: #f8f9fa;
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.items-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.invoice-totals {
    margin-top: 16px;
    text-align: right;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.9rem;
}

.totals-row span:first-child {
    font-weight: 500;
}

.totals-row span:last-child {
    font-weight: 600;
}

/* Dark theme support for the old implementation */
[data-theme="dark"] .items-table th {
    background-color: #2d3748;
    color: #e2e8f0;
    border-bottom-color: #4a5568;
}

[data-theme="dark"] .items-table td {
    color: #e2e8f0;
    border-bottom-color: #4a5568;
}

[data-theme="dark"] .invoice-totals {
    color: #e2e8f0;
}

[data-theme="dark"] .totals-row {
    color: #e2e8f0;
}

/* Comprehensive Dark Mode Status Styles for Invoice Management */
[data-theme="dark"] .status {
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .status i {
    margin-right: 6px;
    opacity: 0.9;
}

[data-theme="dark"] .status.gray {
    background-color: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    border-color: rgba(156, 163, 175, 0.3);
}

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

[data-theme="dark"] .status.orange {
    background-color: rgba(234, 88, 12, 0.15);
    color: #f97316;
    border-color: rgba(234, 88, 12, 0.3);
}

[data-theme="dark"] .status.green {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .status.red {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Dark Mode Status Timeline */
[data-theme="dark"] .status-timeline {
    background: #1a1d24;
    border: 1px solid #2a2d3a;
}

[data-theme="dark"] .timeline-marker {
    background: #4a5568;
}

[data-theme="dark"] .timeline-item.active .timeline-marker {
    background: var(--primary-color);
}

[data-theme="dark"] .timeline-date {
    color: #9ca3af;
}

[data-theme="dark"] .timeline-title {
    color: #e2e8f0;
}

/* Dark Mode Status Action Buttons */
[data-theme="dark"] .status-actions button {
    background: #2a2d3a;
    color: #e2e8f0;
    border: 1px solid #4a5568;
}

[data-theme="dark"] .status-actions button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Dark Mode Invoice View Header Status */
[data-theme="dark"] .invoice-view-header .status {
    background: #2a2d3a;
    color: #e2e8f0;
    border: 1px solid #4a5568;
}

[data-theme="dark"] .invoice-view-info .status {
    background: #2a2d3a;
    color: #e2e8f0;
    border: 1px solid #4a5568;
}

/* Dark Mode Payment Information */
[data-theme="dark"] .payment-info-small {
    color: #9ca3af !important;
}

[data-theme="dark"] .payment-row {
    color: #d1d5db !important;
}

[data-theme="dark"] .progress-bar-small {
    background: rgba(156, 163, 175, 0.2) !important;
}

[data-theme="dark"] .progress-fill {
    background: #60a5fa !important;
}

/* Dark Mode Status Badge Enhancements */
[data-theme="dark"] .status-badge {
    background: #2a2d3a !important;
    color: #e2e8f0 !important;
    border: 1px solid #4a5568 !important;
}

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

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

[data-theme="dark"] .status-badge.status-overdue {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

[data-theme="dark"] .status-badge.status-partially_paid {
    background: rgba(234, 88, 12, 0.15) !important;
    color: #f97316 !important;
    border-color: rgba(234, 88, 12, 0.3) !important;
}

[data-theme="dark"] .status-badge.status-draft {
    background: rgba(156, 163, 175, 0.15) !important;
    color: #9ca3af !important;
    border-color: rgba(156, 163, 175, 0.3) !important;
}

/* Enhanced Invoice Modal Improvements */
/* Fixes for review step visibility and modal behavior */

/* Ensure modal content is properly contained */
.modal-invoice .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 95vh;
    overflow: hidden;
}

.modal-invoice .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--card-background, #ffffff);
}

/* Enhanced review step visibility */
.step-4 {
    min-height: auto;
}

.step-4 .review-section {
    background: var(--card-background, #ffffff);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.step-4 #invoiceReviewSummary {
    background: var(--background-color, #f8f9fa);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color, #e0e0e0);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.step-4 #invoiceReviewSummary h4 {
    color: var(--primary-color, #007ec7);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.step-4 #invoiceReviewSummary p {
    margin-bottom: 0.5rem;
    color: var(--text-primary, #333);
}

/* Ensure step footer is always visible in review step */
.step-4 .step-footer {
    position: sticky;
    bottom: 0;
    background: var(--card-background, #ffffff);
    border-top: 1px solid var(--border-color, #e0e0e0);
    margin: 1.5rem -1.5rem -1.5rem -1.5rem;
    padding: 1.5rem;
    border-radius: 0 0 12px 12px;
    z-index: 10;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark mode enhancements for review step */
[data-theme="dark"] .step-4 .review-section {
    background: #23262f;
    border-color: #2a2d3a;
}

[data-theme="dark"] .step-4 #invoiceReviewSummary {
    background: #181a20;
    border-color: #2a2d3a;
    color: #e5e7eb;
}

[data-theme="dark"] .step-4 .step-footer {
    background: #23262f;
    border-color: #2a2d3a;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35);
}

/* Mobile optimizations for review step */
@media (max-width: 768px) {
    .step-4 .review-section {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .step-4 #invoiceReviewSummary {
        padding: 1rem;
        margin-top: 0.75rem;
    }
    
    .step-4 .step-footer {
        padding: 1rem;
        margin: 1rem -1rem -1rem -1rem;
        border-radius: 0 0 12px 12px;
    }
}

@media (max-width: 480px) {
    .step-4 .review-section {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .step-4 #invoiceReviewSummary {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .step-4 .step-footer {
        padding: 0.75rem;
        margin: 0.75rem -0.75rem -0.75rem -0.75rem;
    }
}

/* Ensure proper spacing in review step */
.step-4 h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary, #333);
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color, #007ec7);
}

.step-4 .form-group {
    margin-bottom: 1.5rem;
}

.step-4 .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    font-size: 0.9rem;
}

.step-4 .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--card-background, #ffffff);
    color: var(--text-primary, #333);
    font-size: 16px;
    transition: all 0.2s ease;
    min-height: 80px;
    resize: vertical;
    box-sizing: border-box;
}

.step-4 .form-group textarea:focus {
    border-color: var(--primary-color, #007ec7);
    box-shadow: 0 0 0 3px rgba(0, 126, 199, 0.1);
    outline: none;
}

/* Enhanced modal stepper for better visibility */
.modal-invoice .modal-stepper {
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
}

.modal-invoice .step-indicator {
    flex: 1;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #666;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.modal-invoice .step-indicator:last-child {
    border-right: none;
}

.modal-invoice .step-indicator.active {
    background: #007ec7;
    color: white;
    box-shadow: 0 2px 6px rgba(0, 126, 199, 0.25);
}

.modal-invoice .step-indicator.completed {
    background: var(--success-color, #10b981);
    color: white;
}

/* Exchange rate display styling */
.exchange-rate-display {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1a1a1a;
    border-left: 3px solid #007ec7;
}

/* Preview button styling */
.preview-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.preview-action-section {
    text-align: center;
    margin: 1.5rem 0;
}

.eye-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") no-repeat center;
    mask-size: contain;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask-size: contain;
}

.exchange-rate-display .rate-row {
    margin: 2px 0;
    line-height: 1.4;
}

.exchange-rate-display .rate-row.small {
    font-size: 0.85em;
    color: #777;
    font-style: italic;
}

/* Dark mode stepper enhancements */
[data-theme="dark"] .modal-invoice .modal-stepper {
    background: #181a20;
    border-color: #2a2d3a;
}

[data-theme="dark"] .modal-invoice .step-indicator {
    background: #181a20;
    color: #a0a0a0;
    border-color: #2a2d3a;
}

[data-theme="dark"] .modal-invoice .step-indicator.active {
    background: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .modal-invoice .step-indicator.completed {
    background: #059669;
    color: #ffffff;
}

/* Dark mode exchange rate display */
[data-theme="dark"] .exchange-rate-display {
    background: #2a2d3a;
    color: #e0e0e0;
    border-left-color: #3b82f6;
}