/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

/* Header */
header {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Logo styling */
.header-logo {
    flex: 0 0 auto;
}

.header-logo img {
    height: 80px;
    width: auto;
    object-fit: contain;
}

header h1 {
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 5px;
}

.header-actions button {
    padding: 6px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-actions button span {
    font-size: 14px;
}

.session-info {
    font-size: 14px;
    color: #666;
}

.target-month {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    display: none;
}

/* Project Selector */
.project-selector {
    background-color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.project-selector label {
    font-weight: 600;
    color: #555;
}

.project-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

/* Steps */
.step {
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.step h2 {
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e9ecef;
}

.step h3 {
    color: #34495e;
    font-size: 11px;
    margin-bottom: 6px;
}

/* Step Windows - Scrollable containers for Step 2 and 3 */
.step-window {
    height: 450px;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    position: relative;
    border: 1px solid #e0e0e0; /* Consistent border for both Step 2 and 3 */
    border-radius: 6px; /* Match the border radius of other elements */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Add shadow for definition */
}

/* Responsive heights */
@media (max-height: 900px) {
    .step-window {
        height: 400px;
    }
}

@media (max-height: 768px) {
    .step-window {
        height: 350px;
    }
}

/* Commented out - now using styled version from cards.css with gradient and white text
.step-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
    height: 60px;
    box-sizing: border-box;
}

.step-window-header h2 {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 14px !important;
    line-height: 1.2;
}
*/

.step-window-content {
    height: calc(100% - 60px); /* Subtract header height */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 20px;
    background-color: #fff;
    position: relative;
    box-sizing: border-box;
}

/* Custom scrollbar for step windows */
.step-window-content::-webkit-scrollbar {
    width: 12px;
    display: block !important;
}

.step-window-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.step-window-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
    border: 1px solid #666;
}

.step-window-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.step-window-content {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Force scrollbar visibility for testing */
.step-window#step2 .step-window-content {
    overflow-y: scroll !important;
}

/* Step 3 should not have outer scroll - only the table container scrolls */
.step-window#step3 .step-window-content {
    overflow-y: hidden !important;
    overflow-x: hidden !important;
}

/* Hide scrollbar for Step 3 outer container only */
.step-window#step3 .step-window-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

/* Step 1 and Step 4 should not have scroll - content fits naturally */
.step-window#step1,
.step-window#step4 {
    height: auto !important;
    max-height: none !important;
}

.step-window#step1 .step-window-content,
.step-window#step4 .step-window-content {
    overflow-y: hidden !important;
    overflow-x: hidden !important;
    height: auto !important;
    max-height: none !important;
}

/* Ensure scrollbar is visible for Step 3 preview table container */
#step3 .preview-table-container::-webkit-scrollbar {
    display: block !important;
    width: 12px !important;
}

#step3 .preview-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

#step3 .preview-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

#step3 .preview-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Popup button styling */
.popup-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.popup-btn:hover {
    background-color: #545b62;
}

/* Upload Section - Condensed */
.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.upload-box {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
}

.upload-box h3 {
    font-size: 12px !important;
    margin-bottom: 8px;
}

.file-drop-area {
    border: 1px dashed #cbd5e0;
    border-radius: 4px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.file-drop-area:hover {
    border-color: #4a90e2;
    background-color: #e3f2fd;
}

.file-drop-area.drag-over {
    border-color: #4a90e2;
    background-color: #e3f2fd;
}

.file-drop-area.disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.file-drop-area.file-loaded {
    cursor: default;
    pointer-events: none;
}

.file-drop-area p {
    color: #666;
    margin: 0;
    font-size: 10px !important;
    line-height: 1.2;
}

.file-info {
    margin-top: 5px;
    font-size: 10px !important;
    color: #666;
    line-height: 1.2;
}

.file-info.success {
    color: #27ae60;
}

/* Specific styling for Step 1 to make it more compact */
#step1 {
    padding: 8px 12px !important;
}

#step1 .upload-section {
    margin-bottom: 8px !important;
}

#step1 .range-section {
    margin-top: 8px !important;
}

/* Range Section - Condensed */
.range-section {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.range-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 10px;
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
}

.input-group input,
.input-group select {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 10px;
}

.input-with-button {
    display: flex;
    gap: 4px;
}

.input-with-button input {
    flex: 1;
}

.preview-btn {
    padding: 4px 8px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
}

.preview-btn:hover {
    background-color: #545b62;
}

/* Buttons */
button {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Step 1 Specific Button Styles */
#step1 button {
    padding: 4px 8px !important;
    font-size: 10px !important;
}

#scanProjectsBtn {
    margin-top: 5px;
}

#setRangesBtn {
    margin-top: 8px;
}

.primary-btn {
    background-color: #4a90e2;
    color: white;
}

.primary-btn:hover {
    background-color: #357abd;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #545b62;
}

#importMappingsBtn {
    background-color: #17a2b8;
}

#importMappingsBtn:hover {
    background-color: #138496;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mapping Controls - Condensed */
.mapping-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

#step2 .mapping-controls button,
#step3 .mapping-controls button,
.mapping-controls button {
    font-size: 8px !important;
    padding: 3px 6px !important;
    line-height: 1.1 !important;
}

#step2 .mapping-controls select,
.mapping-controls select {
    font-size: 8px !important;
    padding: 2px 4px !important;
    line-height: 1.1 !important;
}

#step2 .mapping-controls input[type="text"],
.mapping-controls input[type="text"] {
    margin-left: auto;
    padding: 2px 4px !important;
    border: 1px solid #ddd;
    border-radius: 3px;
    width: 150px !important;
    font-size: 8px !important;
    line-height: 1.1 !important;
}

/* Tables */
.mapping-table-container,
.preview-table-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 10px;
}

/* Inside step windows, tables should not have their own scroll */
.step-window-content .mapping-table-container {
    overflow-x: visible;
    overflow-y: visible;
}

/* Step 3 preview table container needs its own scroll for sticky headers */
#step3 .preview-table-container {
    height: calc(100% - 40px); /* Account for h3 title */
    overflow-y: auto !important;
    overflow-x: auto !important;
    position: relative;
    border: 1px solid #e0e0e0;
    margin: 10px 0;
}

/* Step 3 content should use flex to fill available space */
#step3 .step-window-content {
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}

#step3 .preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    height: 100%;
}

#step3 .preview-section h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    flex-shrink: 0;
}

/* Step 2 Main Window - Sticky Controls and Headers */
#step2 .step-window-content {
    overflow-y: visible !important; /* Override default scroll */
    display: flex;
    flex-direction: column;
    height: 100%;
}

#step2 .mapping-controls {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #fff;
    padding-bottom: 10px;
    margin-bottom: 0;
    border-bottom: 1px solid #e0e0e0;
}

#step2 .mapping-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    margin-top: 10px;
}

/* Make Step 2 main table headers sticky within the scrollable container */
#mappingTable {
    position: relative;
    table-layout: fixed;
    width: 100%;
}

#mappingTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}

#mappingTable thead th {
    background-color: #f8f9fa !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Column width distribution for Step 2 table (5 columns with checkbox) */
#mappingTable th:nth-child(1),
#mappingTable td:nth-child(1) {
    width: 5%; /* Checkbox column */
}

#mappingTable th:nth-child(2),
#mappingTable td:nth-child(2) {
    width: 28%; /* Account Description */
    word-wrap: break-word;
    word-break: break-word;
}

#mappingTable th:nth-child(3) {
    width: 17%; /* Source Amount header */
    /* Styles removed - handled by JavaScript */
}

#mappingTable td:nth-child(3) {
    width: 17%; /* Source Amount data */
    text-align: right !important;
    padding-right: 15px !important;
}

#mappingTable th:nth-child(4),
#mappingTable td:nth-child(4) {
    width: 30%; /* Mapped Account */
    word-wrap: break-word;
    word-break: break-word;
}

#mappingTable th:nth-child(5),
#mappingTable td:nth-child(5) {
    width: 20%; /* Confidence */
}

/* Project status at bottom */
#step2 #projectStatus {
    position: sticky;
    bottom: 0;
    background-color: #fff;
    padding-top: 10px;
    margin-top: auto;
}

/* Smaller checkboxes for condensed table */
.mapping-table-container input[type="checkbox"] {
    width: 10px;
    height: 10px;
    margin: 0;
    cursor: pointer;
}

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

thead {
    background-color: #f8f9fa;
}

th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
}

/* Override for condensed mapping table */
#step2 table th,
#step2 table td {
    padding: 2px 3px !important;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr.focused {
    outline: 2px solid #4a90e2;
    outline-offset: -2px;
    background-color: #e3f2fd;
}

.editable {
    cursor: pointer;
    position: relative;
}

.editable:hover {
    background-color: #e3f2fd;
}

/* Confidence Badges - Condensed */
#step2 .confidence-badge,
.mapping-table-container .confidence-badge {
    display: inline-block !important;
    padding: 1px 3px !important;
    border-radius: 2px !important;
    font-size: 7px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
}

.confidence-high {
    background-color: #d4edda;
    color: #155724;
}

.confidence-medium {
    background-color: #fff3cd;
    color: #856404;
}

.confidence-low {
    background-color: #f8d7da;
    color: #721c24;
}

.confidence-manual {
    background-color: #cce5ff;
    color: #004085;
}

/* Preview Section */
.preview-section {
    margin-top: 10px;
}

/* Ensure proper spacing in step windows */
.step-window-content .generate-info {
    margin-bottom: 10px;
}

.step-window-content .project-status-banner {
    margin-bottom: 8px;
}

.preview-section h3 {
    color: #34495e;
    font-size: 12px !important;
    margin-bottom: 8px;
    font-weight: 600;
}

.preview-section h4 {
    color: #34495e;
    font-size: 12px !important;
    margin-bottom: 8px;
    font-weight: 600;
}

.preview-info {
    margin-bottom: 15px;
    font-size: 16px;
}

/* Export Section */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.export-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 400px;
    justify-content: center;
}

.export-btn:hover {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.export-btn.secondary {
    background-color: #17a2b8;
}

.export-btn.secondary:hover {
    background-color: #138496;
}

.export-icon {
    font-size: 18px;
    font-weight: bold;
}

.export-status {
    padding: 15px;
    border-radius: 6px;
    display: none;
    text-align: center;
}

.export-status.success {
    background-color: #d4edda;
    color: #155724;
    display: block;
}

.export-status.error {
    background-color: #f8d7da;
    color: #721c24;
    display: block;
}

/* Status Message */
.status-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    background-color: #333;
    color: white;
    display: none;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    line-height: 1.5;
    white-space: pre-line;
}

.status-message.success {
    background-color: #27ae60;
}

.status-message.error {
    background-color: #e74c3c;
}

.status-message.show {
    display: block;
}

.status-message .download-link {
    color: white;
    text-decoration: underline;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.status-message .download-link:hover {
    color: #e0e0e0;
    background-color: rgba(255, 255, 255, 0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* Dialog */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Edit dialog should appear above popup windows */
#editDialog {
    z-index: 10000 !important;
}

#editDialog .dialog-content {
    position: relative;
    z-index: 10001;
}

.dialog-content {
    background-color: white;
    border-radius: 8px;
    padding: 25px;
    min-width: 400px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dialog-content.large {
    min-width: 800px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent dialog itself from scrolling */
}

/* Range Preview Dialog Specific Styles */
#previewDialog .dialog-content {
    min-width: 1000px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

/* Preview Dialog Header - Sticky */
#previewDialog .dialog-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: white;
    padding: 20px 25px 15px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#previewDialog .dialog-header h3 {
    margin: 0;
    color: #2c3e50;
}

#previewDialog .dialog-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 25px;
}

#previewDialog .preview-table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-top: 10px;
    background-color: #fff;
    min-height: 0;
}

#previewDialog #previewDataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

#previewDialog #previewDataTable th {
    background-color: #f8f9fa;
    padding: 2px 3px;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 8px;
    line-height: 1.1;
}

#previewDialog #previewDataTable td {
    padding: 2px 3px;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
    font-size: 9px;
    line-height: 1.1;
}

#previewDialog #previewDataTable tbody tr:hover {
    background-color: #f8f9fa;
}

#previewDialog #rangePreviewTableHead th {
    background-color: #f8f9fa;
    padding: 2px 3px;
    border-bottom: 1px solid #dee2e6;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 8px;
    line-height: 1.1;
}

#previewDialog #rangePreviewTableBody td {
    padding: 2px 3px;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
    font-size: 9px;
    line-height: 1.1;
}

#previewDialog .preview-info {
    background-color: #e3f2fd;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #2196f3;
}

/* Clean account list styling */
#previewDialog #rangePreviewTableBody tr:hover {
    background-color: #f0f8ff !important;
}

#previewDialog #rangePreviewTableBody td:first-child {
    background-color: #f8f9fa !important;
    font-weight: bold;
    color: #666;
    text-align: center;
    border-right: 2px solid #dee2e6;
}

#previewDialog #rangePreviewTableBody td:last-child {
    font-size: 9px;
    line-height: 1.1;
}

.dialog-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.dialog-body {
    margin-bottom: 20px;
}

.dialog-body p {
    margin-bottom: 15px;
}

.dialog-body label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.dialog-body input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.dialog-body input[type="text"]:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.dialog-body select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.dialog-body select[size] {
    padding: 4px;
}

.dialog-body select option {
    padding: 6px 8px;
}

.dialog-body select option:hover {
    background-color: #e3f2fd;
}

.dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.dialog-header h3 {
    margin: 0;
}

/* Step 2 Modal Specific Styles for Sticky Headers */
#step2Modal .dialog-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for Firefox */
    overflow: hidden;
    padding-bottom: 10px; /* Add some bottom padding since we removed the footer */
}

#step2Modal .mapping-controls {
    flex-shrink: 0; /* Keep controls fixed height */
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

#step2Modal .mapping-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Important for proper scrolling */
    border: none; /* Remove border that might be causing blue line */
    border-radius: 0;
    background-color: white;
    /* Remove duplicate overflow that was causing issues */
}

/* Disable sticky headers in modal to fix blue line issue */
#modalMappingTable {
    position: relative;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    table-layout: fixed;
}

/* Temporarily disable sticky positioning to test blue line issue
#modalMappingTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}
*/

#modalMappingTable thead {
    position: relative; /* Changed from sticky to relative */
    background-color: #f8f9fa;
}

#modalMappingTable thead th {
    position: relative;
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6;
}

/* Ensure dialog actions stay at bottom */
#step2Modal .dialog-actions {
    flex-shrink: 0;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #e0e0e0;
    background-color: white; /* Ensure white background */
    position: relative;
    z-index: 20; /* Above table content */
}

/* Ultra-condensed styles for Step 2 Modal */
#step2Modal .dialog-content {
    padding: 10px;
}

#step2Modal .dialog-header {
    margin-bottom: 6px;
}

#step2Modal .dialog-header h3 {
    font-size: 14px;
    line-height: 1.1;
}

#step2Modal .close-btn {
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 20px;
}

/* Ultra-condensed controls - single row layout */
#step2Modal .mapping-controls {
    gap: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap !important; /* Force single row */
}

#step2Modal .mapping-controls button {
    font-size: 11px !important;
    padding: 4px 8px !important;
    height: 24px !important;
    line-height: 1 !important;
    flex-shrink: 0;
}

#step2Modal .mapping-controls select {
    font-size: 11px !important;
    padding: 3px 6px !important;
    height: 24px !important;
    flex-shrink: 0;
    max-width: 150px;
}

#step2Modal .mapping-controls input[type="text"] {
    font-size: 11px !important;
    padding: 3px 6px !important;
    height: 24px !important;
    width: 160px !important;
    margin-left: 0 !important; /* Remove auto margin */
    flex-shrink: 0;
}

/* Ultra-condensed table */
#modalMappingTable {
    font-size: 11px !important;
}

#modalMappingTable thead th {
    padding: 2px 3px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    height: 20px !important;
    line-height: 1 !important;
    white-space: nowrap;
}

#modalMappingTable tbody td {
    padding: 1px 3px !important;
    font-size: 10px !important;
    height: 18px !important;
    line-height: 1 !important;
}

/* Condensed confidence badges in modal */
#modalMappingTable .confidence-badge {
    font-size: 9px !important;
    padding: 1px 4px !important;
    line-height: 1 !important;
}

/* Condensed dialog actions */
#step2Modal .dialog-actions button {
    font-size: 12px !important;
    padding: 5px 12px !important;
    height: 28px !important;
}

/* Tighter checkbox spacing */
#modalMappingTable input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
}

/* Column width distribution for modal table (5 columns including checkbox) */
#modalMappingTable th:nth-child(1),
#modalMappingTable td:nth-child(1) {
    width: 5%; /* Checkbox column */
}

#modalMappingTable th:nth-child(2),
#modalMappingTable td:nth-child(2) {
    width: 30%; /* Account Description */
    word-wrap: break-word;
    word-break: break-word;
}

#modalMappingTable th:nth-child(3),
#modalMappingTable td:nth-child(3) {
    width: 15%; /* Source Amount */
    text-align: right !important;
}

#modalMappingTable th:nth-child(4),
#modalMappingTable td:nth-child(4) {
    width: 30%; /* Mapped Account */
    word-wrap: break-word;
    word-break: break-word;
}

#modalMappingTable th:nth-child(5),
#modalMappingTable td:nth-child(5) {
    width: 20%; /* Confidence */
}

/* Fix blue line issue in Step 2 modal */
#step2Modal #modalMappingTable tbody tr:last-child td {
    border-bottom: none !important;
}

#step2Modal #modalMappingTable tbody tr {
    background-color: white !important;
}

#step2Modal #modalMappingTable tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* Remove any blue hover states in modal */
#step2Modal .editable:hover {
    background-color: #f0f0f0 !important;
}

/* Remove ::after element that might cause visual artifacts */
/* #step2Modal .mapping-table-container::after {
    content: '';
    display: block;
    height: 1px;
    background-color: white;
    position: relative;
    bottom: -1px;
} */

/* Remove bottom border and padding that might cause issues */
#step2Modal .mapping-table-container {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Style scrollbar to remove blue track */
#step2Modal .mapping-table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#step2Modal .mapping-table-container::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 4px;
}

#step2Modal .mapping-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#step2Modal .mapping-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Remove any box-shadow that might cause blue line */
#step2Modal .mapping-table-container,
#step2Modal #modalMappingTable {
    box-shadow: none !important;
}

/* Ensure table and tbody don't have any borders */
#step2Modal #modalMappingTable {
    border: none !important;
    border-bottom: none !important;
    border-collapse: collapse !important;
}

#step2Modal #modalMappingTable tbody {
    border: none !important;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
    background-color: #f0f0f0;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .upload-section {
        grid-template-columns: 1fr;
    }
    
    .range-inputs {
        grid-template-columns: 1fr;
    }
    
    .mapping-controls {
        flex-wrap: wrap;
    }
    
    .mapping-controls input[type="text"] {
        width: 100%;
        margin-left: 0;
        margin-top: 10px;
    }
}
/* Override Enhanced Confidence Badges for Condensed View */
#step2 .mapping-table-container .confidence-badge {
    padding: 1px 3px !important;
    font-size: 7px !important;
}
.confidence-high {
    background-color: #10b981 \!important;
    color: white \!important;
}
.confidence-medium {
    background-color: #f59e0b \!important;
    color: white \!important;
}
.confidence-low {
    background-color: #ef4444 \!important;
    color: white \!important;
}
.confidence-manual {
    background-color: #6366f1 \!important;
    color: white \!important;
}
.confidence-n\/a {
    background-color: #6b7280 \!important;
    color: white \!important;
}

/* Project Status */
.project-status {
    margin-top: 4px;
    padding: 3px 6px;
    background-color: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
}

.status-indicator {
    color: #10b981;
    font-weight: bold;
    font-size: 10px;
}

/* Step 3 Specific Styles */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.project-status-banner {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9px !important;
    line-height: 1.2;
}

.status-icon {
    font-size: 10px !important;
    font-weight: bold;
}

.generate-section {
    text-align: center;
    margin: 20px 0;
}

.generate-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.generate-btn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn-icon {
    font-size: 20px;
}

#previewSection h3 {
    color: #2c3e50;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Preview table - Condensed to match Step 2 */
#previewTable {
    font-size: 9px !important;
    position: relative;
}

/* Sticky headers for Step 3 preview table */
#previewTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}

#previewTable th,
#step3 table th {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
    padding: 2px 3px !important;
    text-align: left !important;
    border-bottom: 1px solid #dee2e6 !important;
    font-size: 8px !important;
    line-height: 1.2 !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Right align month column headers */
#previewTable th:not(:first-child),
#step3 table th:not(:first-child) {
    text-align: right !important;
}

#previewTable td,
#step3 table td {
    padding: 2px 3px !important;
    border-bottom: 1px solid #f5f5f5 !important;
    vertical-align: middle !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
}

#previewTable td:first-child {
    font-weight: 500;
}

#previewTable td:not(:first-child) {
    text-align: right;
    font-size: 9px !important;
}

/* Hover effect to match Step 2 */
#previewTable tr:hover,
#step3 table tr:hover {
    background-color: #f8f9fa !important;
}

/* Step 3 Modal Table - Condensed to match Step 2 */
#step3Modal table,
#modalPreviewTable {
    font-size: 9px !important;
    border-collapse: collapse;
    width: 100%;
}

#step3Modal table th,
#modalPreviewTable th {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
    padding: 2px 3px !important;
    text-align: left !important;
    border-bottom: 1px solid #dee2e6 !important;
    font-size: 8px !important;
    line-height: 1.1 !important;
}

#step3Modal table th:not(:first-child),
#modalPreviewTable th:not(:first-child) {
    text-align: right !important;
}

#step3Modal table td,
#modalPreviewTable td {
    padding: 2px 3px !important;
    border-bottom: 1px solid #f5f5f5 !important;
    vertical-align: middle !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
}

#step3Modal table td:first-child,
#modalPreviewTable td:first-child {
    font-weight: 500;
}

#step3Modal table td:not(:first-child),
#modalPreviewTable td:not(:first-child) {
    text-align: right;
}

#step3Modal table tr:hover,
#modalPreviewTable tr:hover {
    background-color: #f8f9fa !important;
}

/* Step 3 Modal Dialog - Condensed to match Step 2 */
#step3Modal .dialog-content {
    padding: 10px;
}

#step3Modal .dialog-header {
    margin-bottom: 6px;
}

#step3Modal .dialog-header h3 {
    font-size: 14px;
    line-height: 1.1;
}

#step3Modal .preview-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    border: none;
    border-radius: 0;
    background-color: white;
}

#step3Modal .preview-info {
    font-size: 9px;
    padding: 4px 8px;
    margin-bottom: 8px;
}

/* Enhanced Table Styling - Condensed Version */
#step2 .mapping-table-container table th,
.mapping-table-container table#mappingTable th {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
    padding: 2px 3px !important;
    text-align: left !important;
    border-bottom: 1px solid #dee2e6 !important;
    font-size: 9px !important;
    height: auto !important;
    line-height: 1.1 !important;
}

#step2 .mapping-table-container table td,
.mapping-table-container table#mappingTable td {
    padding: 2px 3px !important;
    border-bottom: 1px solid #f5f5f5 !important;
    vertical-align: middle !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    height: auto !important;
}

#step2 .mapping-table-container table tr:hover,
.mapping-table-container table#mappingTable tr:hover {
    background-color: #f8f9fa !important;
}

/* Editable cells */
#step2 .editable,
.mapping-table-container .editable {
    cursor: pointer !important;
    color: #0066cc !important;
}

#step2 .editable:hover,
.mapping-table-container .editable:hover {
    background-color: #e3f2fd !important;
    text-decoration: underline !important;
}

/* Update Month Files Section - Condensed */
.update-section {
    background-color: #fff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 8px 0;
    text-align: center;
}

#updateMonthFilesBtn {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 5px;
}

.update-help {
    color: #666;
    font-size: 10px;
    margin-bottom: 10px;
}

/* Progress Bar Component - Condensed */
.progress-container {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

#progressText {
    font-weight: 500;
    color: #333;
    font-size: 10px;
}

#progressPercent {
    font-weight: 600;
    color: #4a90e2;
    font-size: 10px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2 0%, #357abd 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    color: #666;
}

#currentProject {
    font-weight: 500;
}

#estimatedTime {
    font-style: italic;
}

/* Progress animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.progress-container.processing #progressText {
    animation: pulse 2s infinite;
}

/* File Selection UI - Condensed */
.file-selection-container {
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.file-selection-step {
    margin-bottom: 10px;
    padding: 8px;
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.file-selection-step h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 11px;
}

.file-selection-step button {
    margin-right: 5px;
    padding: 4px 8px !important;
    font-size: 10px !important;
}

.selected-file {
    display: inline-block;
    margin-left: 5px;
    color: #28a745;
    font-weight: 500;
    font-size: 9px;
}

.file-selection-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 10px;
}

.file-selection-actions button {
    padding: 5px 10px;
}

/* Generate Info Text - Condensed to match Step 2 */
.generate-info {
    text-align: center;
    padding: 8px 10px;
}

.info-text {
    color: #666;
    font-size: 9px !important;
    font-style: italic;
    line-height: 1.2;
}

/* Restore Dialog */
.restore-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.restore-dialog-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.restore-dialog-content h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
}

.restore-dialog-content p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.restore-dialog-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.restore-dialog-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.restore-dialog-actions .btn-primary {
    background: #28a745;
    color: white;
}

.restore-dialog-actions .btn-primary:hover {
    background: #218838;
}

.restore-dialog-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.restore-dialog-actions .btn-secondary:hover {
    background: #5a6268;
}

/* Dropdown styles for export button */
.dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 120px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 2px;
}

.dropdown-content a {
    color: #333;
    padding: 8px 12px;
    text-decoration: none;
    display: block;
    font-size: 12px;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Modal specific dropdown styling */
#step2Modal .dropdown-content {
    min-width: 120px;
}

#step2Modal .dropdown-content a {
    padding: 8px 12px;
    font-size: 11px;
}

/* Copyright Footer */
.copyright-footer {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 100;
}

.copyright-footer p {
    margin: 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Ensure body has min-height for footer positioning */
body {
    min-height: 100vh;
    position: relative;
}
