/* FlowMetrics WordPress Plugin Styles */

/* Define variables on :root for modal (which gets moved to body) */
:root {
    --fm-bg: #000000;
    --fm-panel: #101a2e;
    --fm-panel2: #0f1a33;
    --fm-text: #e7eefc;
    --fm-muted: #a9b7d6;
    --fm-accent: #5cc8ff;
    --fm-border: rgba(255, 255, 255, 0.10);
    --fm-pass: #22c55e;
    --fm-fail: #ef4444;
    --fm-warning: #f59e0b;
    --fm-no-data: #6b7280;
}

#flowmetrics-app {
    --fm-bg: #000000;
    --fm-panel: #101a2e;
    --fm-panel2: #0f1a33;
    --fm-text: #e7eefc;
    --fm-muted: #a9b7d6;
    --fm-accent: #5cc8ff;
    --fm-border: rgba(255, 255, 255, 0.10);
    --fm-pass: #22c55e;
    --fm-fail: #ef4444;
    --fm-warning: #f59e0b;
    --fm-no-data: #6b7280;

    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--fm-bg);
    color: var(--fm-text);
    min-height: 600px;
    border-radius: 12px;
    overflow: hidden;
    padding: 20px;

    /* Full screen horizontal with small margins. fitAppWidth() in flowmetrics.js narrows
       this to the theme's page width when the theme clips wider content. */
    width: calc(100vw - 80px);
    max-width: calc(100vw - 80px);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    margin-right: 0;
}

#flowmetrics-app *,
#flowmetrics-app *::before,
#flowmetrics-app *::after {
    box-sizing: border-box;
}

/* Folder Info Bar */
#flowmetrics-app .fm-folder-info {
    display: none !important;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #1a2a44;
    border: 1px solid var(--fm-border);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 20px;
}

#flowmetrics-app .fm-folder-info.visible {
    display: flex !important;
}

#fm-folder-name {
    font-size: 14px;
    color: var(--fm-text);
    font-weight: 600;
}

#fm-instrument-count {
    font-size: 12px;
    color: var(--fm-muted);
}

.fm-refresh-btn {
    background: var(--fm-accent);
    border: none;
    color: #071022;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.fm-refresh-btn:hover {
    background: #7cf0ff;
}

.fm-clear-btn {
    background: transparent;
    border: none;
    color: var(--fm-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.fm-clear-btn:hover {
    color: var(--fm-text);
}

/* Directory Selection Section */
.fm-select-section {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.fm-dropzone {
    width: 100%;
    max-width: 400px;
    border: 2px dashed var(--fm-border);
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    transition: all 0.2s ease;
    background: var(--fm-panel);
}

.fm-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#flowmetrics-app .fm-dropzone-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 22px !important;
    font-weight: 900 !important;
    color: var(--fm-text) !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    font-family: inherit !important;
    background: none !important;
    border: none !important;
}

.fm-browse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fm-accent);
    color: #071022;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    border: 2px solid var(--fm-accent);
    height: 42px;
    box-sizing: border-box;
}

.fm-browse-btn:hover {
    background: #7cf0ff;
}

.fm-dropzone-hint {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--fm-muted);
    opacity: 0.8;
}

/* Dashboard */
.fm-dashboard {
    padding: 0;
}

/* Fleet Health Section */
.fm-fleet-section {
    background: var(--fm-panel);
    border: 1px solid var(--fm-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.fm-fleet-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.fm-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--fm-muted);
}

.fm-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.fm-legend-dot.pass { background: var(--fm-pass); }
.fm-legend-dot.fail { background: var(--fm-fail); }
.fm-legend-dot.warning { background: var(--fm-warning); }
.fm-legend-dot.no-data { background: var(--fm-no-data); }

.fm-legend-clickable {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fm-legend-clickable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.fm-legend-clickable.active {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--fm-warning);
}

/* Fleet Grid */
.fm-fleet-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.fm-fleet-tile {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.fm-fleet-tile:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.fm-fleet-tile.pass { background: var(--fm-pass); }
.fm-fleet-tile.fail { background: var(--fm-fail); }
.fm-fleet-tile.warning { background: var(--fm-warning); }
.fm-fleet-tile.no-data { background: var(--fm-no-data); }

.fm-fleet-tile.selected {
    outline: 3px solid var(--fm-accent);
    outline-offset: 2px;
}

/* Tooltip */
.fm-tooltip {
    position: fixed;
    background: #1a1a2e;
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    color: #e7eefc;
}

.fm-tooltip-title {
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}

.fm-tooltip-row {
    color: #c0c8d8;
    margin: 4px 0;
}

.fm-tooltip-status {
    font-weight: 600;
}

.fm-tooltip-status.pass { color: var(--fm-pass); }
.fm-tooltip-status.fail { color: var(--fm-fail); }
.fm-tooltip-status.warning { color: var(--fm-warning); }

/* Drill-Down Section */
.fm-drilldown-section {
    background: var(--fm-panel);
    border: 1px solid var(--fm-border);
    border-radius: 12px;
    padding: 16px;
}

/* Controls */
.fm-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.fm-controls-row2 {
    margin-bottom: 20px;
}

.fm-controls-row2 .fm-options {
    align-self: flex-end;
    padding-bottom: 4px;
}

.fm-controls-row2 .fm-trace-buttons {
    align-self: flex-end;
}

.fm-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fm-control-group label {
    font-size: 12px;
    color: var(--fm-muted);
    font-weight: 600;
}

.fm-control-group select,
.fm-control-group input[type="date"] {
    background: #1a2a44;
    border: 1px solid var(--fm-border);
    color: var(--fm-text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    min-width: 180px;
}

.fm-control-group select option {
    background: #1a2a44;
    color: var(--fm-text);
}

.fm-control-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.85);
}

.fm-date-range .fm-date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-date-range .fm-date-inputs span {
    color: var(--fm-muted);
}

.fm-date-range input[type="date"] {
    min-width: 140px;
}

/* Date Navigation Controls */
.fm-date-nav-group {
    min-width: auto !important;
}

.fm-date-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
}

.fm-date-nav-arrow {
    background: transparent !important;
    border: 1px solid var(--fm-border) !important;
    color: var(--fm-text) !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    flex-shrink: 0 !important;
}

.fm-date-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--fm-accent) !important;
    color: var(--fm-accent) !important;
}

.fm-date-nav-presets {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 6px !important;
    padding: 3px !important;
}

.fm-date-nav-preset {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--fm-muted) !important;
    border-radius: 4px !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.fm-date-nav-preset:hover {
    color: var(--fm-text) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

.fm-date-nav-preset.active {
    background: var(--fm-accent) !important;
    color: #000 !important;
    border-color: var(--fm-accent) !important;
}

#flowmetrics-app .fm-date-nav-custom {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid var(--fm-border) !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    padding: 5px 6px !important;
    font-size: 12px !important;
    text-align: center !important;
    -moz-appearance: textfield !important;
    flex-shrink: 0 !important;
}

.fm-date-nav-custom::-webkit-outer-spin-button,
.fm-date-nav-custom::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

#flowmetrics-app .fm-date-nav-custom:focus {
    outline: none !important;
    border-color: var(--fm-accent) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

#flowmetrics-app .fm-date-nav-custom.active {
    border-color: var(--fm-accent) !important;
    background: rgba(92, 200, 255, 0.15) !important;
}

#flowmetrics-app .fm-date-nav-custom::placeholder {
    color: #888888 !important;
}

.fm-date-nav-suffix {
    color: var(--fm-muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    margin-left: 2px !important;
    flex-shrink: 0 !important;
}

.fm-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--fm-text);
}

.fm-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--fm-accent);
}

.fm-trace-buttons {
    flex-direction: row !important;
    align-items: center !important;
}

.fm-btn-small {
    background: transparent;
    border: 1px solid var(--fm-border);
    color: var(--fm-text);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-btn-small:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--fm-accent);
}

/* Chart Container */
.fm-chart-container {
    margin-bottom: 20px;
}

.fm-chart {
    width: 100%;
    height: 500px;
    background: var(--fm-panel2);
    border-radius: 8px;
}

/* Shown in place of a chart when the date range has no QC */
.fm-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--fm-muted);
    font-size: 14px;
}

/* Excluded Points Panel */
.fm-excluded-panel {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.fm-excluded-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--fm-fail);
}

.fm-excluded-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.fm-excluded-item {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--fm-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-excluded-item:hover {
    background: rgba(239, 68, 68, 0.4);
}

.fm-excluded-item::after {
    content: ' \00d7';
    color: var(--fm-fail);
    font-weight: bold;
}

/* Comparison Chart Toggle Button */
.fm-compare-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: var(--fm-accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-compare-toggle:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

.fm-compare-toggle.active {
    background: rgba(59, 130, 246, 0.2);
}

.fm-compare-toggle.active .fm-compare-icon {
    transform: rotate(45deg);
}

.fm-compare-icon {
    font-size: 16px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

/* Comparison Chart Container */
.fm-chart2-container {
    border-top: 1px solid var(--fm-border);
    padding-top: 16px;
}

.fm-chart2-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.fm-chart2-header .fm-control-group {
    flex: 0 0 auto;
    min-width: 200px;
}

.fm-chart2-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: var(--fm-fail);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fm-chart2-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.fm-sync-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--fm-text-muted);
    cursor: pointer;
    user-select: none;
}

.fm-sync-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* QC History Table */
.fm-table-container {
    margin-top: 20px;
}

.fm-table-container h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--fm-text);
}

.fm-table-wrap {
    position: relative; /* anchors the "Top" button */
}

/* The table's own scroll area: once the page is scrolled down to the table it fills
   the window, and the header row stays pinned while the rows scroll */
.fm-table-scroll {
    overflow: auto;
    max-height: calc(100vh - 120px);
    border-radius: 8px;
    border: 1px solid var(--fm-border);
}

/* Responsive-table plugins can wrap every table on the site in a scrolling
   <div class="table-responsive">. That wrapper becomes the box the header row pins
   to, so the header scrolls away. FlowMetrics scrolls its tables itself, so the
   wrapper must not scroll or clip. */
#flowmetrics-app .table-responsive,
.fm-csv-modal .table-responsive {
    overflow: visible !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    width: 100% !important;
}

#fm-qc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 0; /* the theme adds a bottom margin to every table */
}

/* "Top" button: appears once the table is scrolled down */
.fm-back-to-top {
    position: absolute;
    right: 24px;   /* clear of the table's vertical scrollbar */
    bottom: 18px;  /* clear of a horizontal scrollbar */
    z-index: 20;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: var(--fm-accent);
    color: #000000;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.fm-back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.fm-back-to-top:hover {
    background: #7cf0ff;
}

#fm-qc-table th,
#fm-qc-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--fm-border);
}

#fm-qc-table th {
    background: #1a2a44;
    color: var(--fm-text);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 10;
}

#fm-qc-table tbody tr {
    transition: background 0.15s ease;
}

#fm-qc-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

#fm-qc-table tbody tr.pass-row {
    background: rgba(34, 197, 94, 0.08);
}

#fm-qc-table tbody tr.fail-row {
    background: rgba(239, 68, 68, 0.08);
}

#fm-qc-table tbody tr.pass-row:hover {
    background: rgba(34, 197, 94, 0.15);
}

#fm-qc-table tbody tr.fail-row:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Status Badge */
.fm-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.fm-status-badge.pass {
    background: var(--fm-pass);
    color: #ffffff;
}

.fm-status-badge.fail {
    background: var(--fm-fail);
    color: #ffffff;
}

.fm-status-badge.warning {
    background: var(--fm-warning);
    color: #000000;
}

/* Source Link */
.fm-source-link {
    color: var(--fm-accent);
    text-decoration: none;
    font-size: 12px;
}

.fm-source-link:hover {
    text-decoration: underline;
}

/* Key Metrics in Table */
.fm-key-metrics {
    font-size: 12px;
    color: var(--fm-muted);
}

.fm-metric-item {
    display: inline-block;
    margin-right: 12px;
}

.fm-metric-value {
    color: var(--fm-text);
    font-weight: 600;
}

.fm-metric-value.fail {
    color: var(--fm-fail);
}

/* Scrollbars */
.fm-table-scroll::-webkit-scrollbar {
    width: 14px;
    height: 10px;
}

.fm-table-scroll::-webkit-scrollbar-track {
    background: #0d1525;
    border-radius: 5px;
}

.fm-table-scroll::-webkit-scrollbar-thumb {
    background: #6080a0;
    border-radius: 5px;
}

.fm-table-scroll::-webkit-scrollbar-thumb:hover {
    background: #80a0c0;
}

/* Responsive */
@media (max-width: 1200px) {
    .fm-fleet-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
}

/* Side margins: keep in step with appSideMargins() in flowmetrics.js */
@media (max-width: 1100px) {
    #flowmetrics-app {
        width: calc(100vw - 40px);
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 900px) {
    .fm-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .fm-control-group select,
    .fm-control-group input[type="date"] {
        min-width: 100%;
    }

    .fm-date-range .fm-date-inputs {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    #flowmetrics-app {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        padding: 12px;
    }

    .fm-fleet-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 6px;
    }

    .fm-chart {
        height: 350px;
    }
}

/* Loading State */
.fm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--fm-muted);
}

.fm-loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--fm-border);
    border-top-color: var(--fm-accent);
    border-radius: 50%;
    animation: fm-spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes fm-spin {
    to { transform: rotate(360deg); }
}

/* No Data State */
.fm-no-data-message {
    text-align: center;
    padding: 40px;
    color: var(--fm-muted);
    font-size: 14px;
}

/* CSV Viewer Modal */
.fm-csv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fm-csv-modal-content {
    background: var(--fm-panel);
    border: 1px solid var(--fm-border);
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fm-csv-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fm-border);
    background: #1a2a44;
}

.fm-csv-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--fm-text);
}

.fm-csv-modal-close {
    background: transparent;
    border: none;
    color: var(--fm-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.fm-csv-modal-close:hover {
    color: var(--fm-text);
}

.fm-csv-modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.fm-csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: "Consolas", "Monaco", monospace;
}

.fm-csv-table th,
.fm-csv-table td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--fm-border);
}

/* Headers stay fixed width, no wrap */
.fm-csv-table th {
    white-space: nowrap;
    background: #1a2a44;
    color: var(--fm-text);
    font-weight: 700;
}

/* Body cells allow wrapping for long content (error messages, etc.) */
.fm-csv-table td {
    white-space: normal;
    word-break: break-word;
    max-width: 350px;
    min-width: 60px;
}

/* Prevent wrapping in first two columns (key-value rows like Testing Date) */
.fm-csv-table td:first-child,
.fm-csv-table td:nth-child(2) {
    white-space: nowrap;
}

/* Aurora/SpectroFlo tables - expand columns to prevent tall cells */
.fm-aurora-table td {
    white-space: nowrap;
    max-width: none;
}

/* NovoCyte Penteon tables - expand columns to prevent tall cells */
.fm-penteon-table td {
    white-space: nowrap;
    max-width: none;
}

/* CytExpert (CytoFLEX) tables - expand columns to prevent tall cells */
.fm-cytexpert-table td {
    white-space: nowrap;
    max-width: none;
}

.fm-csv-header-row th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.fm-csv-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.fm-csv-table tbody tr:hover {
    background: rgba(92, 200, 255, 0.1);
}

.fm-csv-table td {
    color: var(--fm-muted);
}

/* Failed cell highlighting in modal */
.fm-csv-table td.fm-cell-failed {
    background: rgba(239, 68, 68, 0.3);
    color: #ff6b6b;
    font-weight: 700;
}

/* Scrollbar for modal body */
.fm-csv-modal-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.fm-csv-modal-body::-webkit-scrollbar-track {
    background: #0d1525;
    border-radius: 5px;
}

.fm-csv-modal-body::-webkit-scrollbar-thumb {
    background: #6080a0;
    border-radius: 5px;
}

.fm-csv-modal-body::-webkit-scrollbar-thumb:hover {
    background: #80a0c0;
}

/* ========== PARSING PROGRESS INDICATOR ========== */

.fm-parsing-progress {
    background: var(--fm-panel2);
    border: 1px solid var(--fm-border);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fm-parsing-progress span {
    color: var(--fm-muted);
    font-size: 13px;
    text-align: center;
}

.fm-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.fm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fm-accent), #7b68ee);
    border-radius: 4px;
    transition: width 0.2s ease;
}

/* ========== LOAD MORE BUTTON ========== */

.fm-load-more-container {
    text-align: center;
    padding: 15px;
    border-top: 1px solid var(--fm-border);
}

.fm-load-more-btn {
    background: var(--fm-panel2);
    border: 1px solid var(--fm-border);
    color: var(--fm-accent);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.fm-load-more-btn:hover {
    background: var(--fm-accent);
    color: var(--fm-bg);
}

/* ========== TABLE FOOTER & EXPORT ========== */

.fm-table-footer {
    text-align: right;
    padding: 12px 15px;
    border-top: 1px solid var(--fm-border);
}

.fm-export-btn {
    background: var(--fm-panel2);
    border: 1px solid var(--fm-border);
    color: var(--fm-accent);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.fm-export-btn:hover {
    background: var(--fm-accent);
    color: var(--fm-bg);
}

/* ========== ATTUNE XENITH MODAL STYLES ========== */

.fm-xenith-section {
    margin-bottom: 20px;
}

.fm-xenith-table {
    border-radius: 6px;
    margin-top: 0;
}

.fm-xenith-table td,
.fm-xenith-table th {
    white-space: nowrap;
    min-width: 80px;
    padding: 8px 14px;
}

/* Sticky column headers for each section */
.fm-xenith-sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #1a2a44 0%, #0f1a33 100%);
    border-bottom: 2px solid var(--fm-accent);
}

/* Wider columns for specific content */
.fm-xenith-table td:first-child,
.fm-xenith-table th:first-child {
    min-width: 200px;
}

/* Failed row highlighting in modal */
.fm-row-failed {
    background: rgba(239, 68, 68, 0.15) !important;
}

.fm-row-failed:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}
