/* ================================================================
   mx-sheets — Aircraft Maintenance Record Cleanup Tool
   
   Design philosophy: Feel like a tool, not a website.
   - Muted, professional colors
   - Dense data display (Marv works with hundreds of rows)
   - Clear status indicators (good/suspect/bad)
   - Excel-familiar grid layout
   ================================================================ */

/* ----------------------------------------------------------------
   RESET & BASE
   ---------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #1a1d23;
    --bg-mid: #22252b;
    --bg-light: #2a2d35;
    --bg-surface: #31343d;
    --border: #3d4150;
    --text: #d4d4d8;
    --text-dim: #8b8fa3;
    --text-bright: #f0f0f5;
    --accent: #5b9bd5;
    --accent-hover: #6fb3eb;
    --good: #4caf50;
    --good-bg: rgba(76, 175, 80, 0.12);
    --suspect: #ff9800;
    --suspect-bg: rgba(255, 152, 0, 0.12);
    --bad: #f44336;
    --bad-bg: rgba(244, 67, 54, 0.12);
    --fixed: #5b9bd5;
    --fixed-bg: rgba(91, 155, 213, 0.12);
    --ignored-bg: rgba(139, 143, 163, 0.08);
    --chop-red: #ff4444;
    --grid-line: #2e3140;
    --header-height: 48px;
    --font-mono: 'Consolas', 'Menlo', 'Monaco', monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-size: 13px;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.4;
}

/* ----------------------------------------------------------------
   APP HEADER
   ---------------------------------------------------------------- */
.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--header-height);
    padding: 0 1rem;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
}

.app-header h1 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.subtitle, .file-badge {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.file-badge {
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* Review header: spread items */
.review-header {
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-stats {
    display: flex;
    gap: 0.5rem;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.stat-num {
    font-weight: 700;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-good { background: var(--good-bg); color: var(--good); }
.stat-suspect { background: var(--suspect-bg); color: var(--suspect); }
.stat-bad { background: var(--bad-bg); color: var(--bad); }
.stat-total { background: var(--bg-surface); color: var(--text); }

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-nav:hover {
    background: var(--bg-light);
    color: var(--text-bright);
}

.issue-counter {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    min-width: 70px;
    text-align: center;
}

.nav-separator {
    color: var(--border);
    margin: 0 2px;
}

.btn-export {
    background: var(--good) !important;
    color: white !important;
    text-decoration: none;
    font-weight: 600;
}

/* ----------------------------------------------------------------
   ISSUE BAR
   ---------------------------------------------------------------- */
.issue-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 1rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    min-height: 36px;
}

.issue-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.severity-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.severity-bad { background: var(--bad-bg); color: var(--bad); }
.severity-suspect { background: var(--suspect-bg); color: var(--suspect); }
.severity-info { background: var(--bg-surface); color: var(--text-dim); }
.severity-fixed { background: var(--fixed-bg); color: var(--fixed); }
.severity-good { background: var(--good-bg); color: var(--good); }
.severity-ignored { background: var(--ignored-bg); color: var(--text-dim); }

.issue-desc {
    font-size: 0.8rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.issue-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-action {
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-fix {
    background: var(--accent);
    color: white;
}
.btn-fix:hover { background: var(--accent-hover); }

.btn-good {
    background: var(--good);
    color: white;
}
.btn-good:hover { opacity: 0.9; }

.btn-ignore {
    background: var(--bg-surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.btn-ignore:hover {
    background: var(--bg-mid);
    color: var(--text);
}

/* ----------------------------------------------------------------
   MAIN LAYOUT: Side-by-side panels
   ---------------------------------------------------------------- */
.review-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.review-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-pdf {
    width: 40%;
    border-right: 1px solid var(--border);
}

.panel-grid {
    flex: 1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 28px;
    flex-shrink: 0;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-sm {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.btn-sm:hover {
    background: var(--bg-light);
    color: var(--text);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
    text-transform: none;
    font-weight: 400;
}

.toggle-label input {
    margin: 0;
}

.panel-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Handsontable container must fill parent for virtual scrolling */
#hot-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Grid container needs no overflow — HOT manages scrolling */
#grid-container {
    overflow: hidden;
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.no-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
}

.no-pdf p { margin: 0.3rem 0; }

/* Resize handle */
.resize-handle {
    width: 5px;
    cursor: col-resize;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.15s;
}

.resize-handle:hover {
    background: var(--accent);
}

/* ----------------------------------------------------------------
   DATA GRID
   ---------------------------------------------------------------- */
.data-grid {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    table-layout: auto;
}

.data-grid th {
    position: sticky;
    top: 0;
    background: var(--bg-mid);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 6px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
    z-index: 10;
}

.data-grid td {
    padding: 3px 6px;
    border-bottom: 1px solid var(--grid-line);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    vertical-align: top;
}

.data-grid td:hover {
    background: rgba(91, 155, 213, 0.08);
}

.row-num-col {
    color: var(--text-dim);
    font-size: 0.65rem;
    text-align: right;
    padding-right: 8px !important;
    width: 40px;
    min-width: 40px;
    user-select: none;
}

/* Row classification colors */
.row-data { }
.row-header { background: rgba(91, 155, 213, 0.05); }
.row-continuation { color: var(--text-dim); }
.row-parts { color: var(--text-dim); font-style: italic; }
.row-unknown { background: var(--suspect-bg); }
.row-mega { background: var(--bad-bg); }
.row-has-mega { background: var(--bad-bg); }

/* Cell states */
.cell-empty {
    background: transparent;
}

.cell-mega {
    background: rgba(244, 67, 54, 0.15) !important;
    border-left: 2px solid var(--bad);
    cursor: pointer;
}

.cell-mega:hover {
    background: rgba(244, 67, 54, 0.25) !important;
}

.cell-edited {
    background: rgba(91, 155, 213, 0.15) !important;
    border-left: 2px solid var(--accent);
}

/* Highlighted issue row */
.row-highlight {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.row-highlight td {
    background: rgba(91, 155, 213, 0.1);
}

/* ----------------------------------------------------------------
   MODALS
   ---------------------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-mid);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 800px;
    width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1rem;
    color: var(--text-bright);
}

.chopper-subtitle {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.btn-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-close:hover { color: var(--text-bright); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}

/* ----------------------------------------------------------------
   CHOPPER — Multi-column parallel view
   ---------------------------------------------------------------- */
.chopper-content {
    max-width: 95vw;
    width: 95vw;
    max-height: 85vh;
}

.chopper-body {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
}

.chopper-instructions {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: 4px;
}

.chop-table {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    width: 100%;
}

.chop-header-row {
    display: flex;
    gap: 1px;
    background: var(--bg-mid);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.chop-col-header {
    flex: 1;
    min-width: 80px;
    padding: 4px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chop-line-row {
    display: flex;
    gap: 1px;
    min-height: 22px;
}

.chop-line-row:hover {
    background: rgba(91, 155, 213, 0.05);
}

.chop-line-num {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    padding: 2px 6px;
    text-align: right;
    color: var(--text-dim);
    font-size: 0.65rem;
    user-select: none;
    flex-shrink: 0;
}

.chop-cell {
    flex: 1;
    min-width: 80px;
    padding: 2px 8px;
    background: var(--bg-dark);
    border-left: 1px solid var(--grid-line);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chop-cell:hover {
    white-space: normal;
    word-break: break-all;
    background: var(--bg-light);
}

.chop-cell-empty {
    color: var(--text-dim);
    font-style: italic;
    background: transparent;
}

/* Split divider row */
.chop-divider-row {
    display: flex;
    align-items: center;
    height: 6px;
    cursor: pointer;
    background: var(--bg-mid);
    transition: all 0.15s;
    position: relative;
}

.chop-divider-row:hover {
    height: 10px;
    background: rgba(255, 68, 68, 0.2);
}

.chop-scissor {
    width: 32px;
    min-width: 32px;
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-dim);
    user-select: none;
    flex-shrink: 0;
}

.chop-div-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    transition: all 0.15s;
}

.chop-divider-row:hover .chop-div-line {
    height: 3px;
    background: rgba(255, 68, 68, 0.5);
}

.chop-divider-row:hover .chop-scissor {
    color: var(--chop-red);
}

.chop-divider-row.chop-active {
    height: 8px;
    background: rgba(255, 68, 68, 0.3);
}

.chop-divider-row.chop-active .chop-div-line {
    height: 3px;
    background: var(--chop-red);
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.4);
}

.chop-divider-row.chop-active .chop-scissor {
    color: var(--chop-red);
    font-size: 0.7rem;
}

/* ----------------------------------------------------------------
   EDIT MODAL
   ---------------------------------------------------------------- */
.edit-body {
    padding: 12px 16px;
}

.edit-textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-dark);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px;
    resize: vertical;
    line-height: 1.5;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ----------------------------------------------------------------
   UPLOAD PAGE
   ---------------------------------------------------------------- */
.upload-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
    padding: 2rem;
}

.upload-card {
    background: var(--bg-mid);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
}

.upload-card h2 {
    font-size: 1.2rem;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}

.help-text {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.file-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.file-group {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}

.file-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.file-icon {
    font-size: 1.5rem;
}

.file-label {
    font-weight: 600;
    color: var(--text-bright);
}

.file-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.file-group input[type="file"] {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text);
}

.file-name {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 0.3rem;
}

.btn-process {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-process:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-process:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ----------------------------------------------------------------
   TOAST NOTIFICATIONS
   ---------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 56px;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-bright);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    animation: toast-in 0.3s ease;
}

.toast-error {
    background: rgba(244, 67, 54, 0.9);
    border-color: var(--bad);
    color: white;
}

.toast-fade-out {
    animation: toast-out 0.4s ease forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

/* ----------------------------------------------------------------
   PER-COLUMN ALIGNMENT INDICATOR (Smart Knife)
   ---------------------------------------------------------------- */
.chop-cell-aligned {
    background: rgba(91, 155, 213, 0.2) !important;
    border-left: 2px solid var(--accent) !important;
}

/* ----------------------------------------------------------------
   LOADING / DISABLED BUTTON STATE
   ---------------------------------------------------------------- */
.btn-loading {
    opacity: 0.6;
    cursor: wait !important;
    pointer-events: none;
}

/* ----------------------------------------------------------------
   CONTENT BAR (formula bar)
   ---------------------------------------------------------------- */
.content-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
    height: 32px;
    flex-shrink: 0;
}

.content-bar-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text);
    white-space: nowrap;
    min-width: 100px;
}

.content-bar-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: var(--bg-dark);
    color: var(--text-bright);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 8px;
    height: 26px;
}

.content-bar-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ----------------------------------------------------------------
   HANDSONTABLE DARK THEME OVERRIDES
   ---------------------------------------------------------------- */
.handsontable {
    font-family: var(--font-mono) !important;
    font-size: 0.875rem !important;
    color: var(--text-bright) !important;
}

.handsontable .wtHolder {
    background: var(--bg-dark) !important;
}

.handsontable table {
    background: var(--bg-dark) !important;
}

.handsontable th {
    background: #2a3040 !important;
    color: #ffffff !important;
    border-color: var(--border) !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.02em !important;
    padding: 6px 8px !important;
}

.handsontable td {
    background: var(--bg-dark) !important;
    color: var(--text-bright) !important;
    border-color: var(--grid-line) !important;
    padding: 5px 8px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4 !important;
    vertical-align: top !important;
}

.handsontable td:hover {
    background: rgba(91, 155, 213, 0.08) !important;
}

/* Active header highlight */
.handsontable th.ht__active_highlight {
    background: var(--bg-surface) !important;
    color: var(--accent) !important;
}

/* Selection border */
.handsontable .wtBorder {
    background-color: var(--accent) !important;
}

/* Editor input */
.handsontable .handsontableInput {
    background: var(--bg-dark) !important;
    color: var(--text-bright) !important;
    border: 2px solid var(--accent) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.875rem !important;
    box-shadow: 0 0 4px rgba(91, 155, 213, 0.3) !important;
}

/* Row classification colors — dark tinted backgrounds so white text stays readable.
   Prefixed with .handsontable td to beat the base dark-theme rule. */
.handsontable td.hot-row-data {
    background: #1a261a !important;
    border-left: 3px solid #4caf50 !important;
    color: #ffffff !important;
}

.handsontable td.hot-row-unknown {
    background: #2a2215 !important;
    border-left: 3px solid #ff9800 !important;
    color: #ffffff !important;
}

.handsontable td.hot-row-mega {
    background: #2e1a1a !important;
    border-left: 3px solid #f44336 !important;
    color: #ffffff !important;
}

.handsontable td.hot-row-continuation {
    color: #b0b4c8 !important;
}

.handsontable td.hot-row-header {
    background: #1a1e2a !important;
    border-left: 3px solid var(--accent) !important;
    color: #ffffff !important;
}

/* Mega-cell indicator */
.handsontable td.hot-cell-mega {
    background: #2e1a1a !important;
    border-left: 3px solid #f44336 !important;
    color: #ffffff !important;
}

/* Highlighted issue row */
.handsontable td.hot-row-highlight {
    background: #1a2540 !important;
    outline: 2px solid var(--accent);
    color: #ffffff !important;
}

/* Synced-row highlight — blue tint on entire row when grid↔PDF synced.
   Must come AFTER classification rules so it wins the cascade. */
.handsontable td.hot-synced-row {
    background: #1a2a3a !important;
}

/* Anchor indicator on first column of synced row */
.handsontable td.hot-synced-anchor {
    border-left: 4px solid #1565C0 !important;
}

/* Corner and scrollbars */
.handsontable .ht_master .wtHolder {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) var(--bg-dark);
}

.handsontable .wtSpreader {
    background: var(--bg-dark);
}

/* Fix autocomplete and context menu if used */
.handsontable .htContextMenu {
    background: var(--bg-mid) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* ----------------------------------------------------------------
   PDF.js VIEWER
   ---------------------------------------------------------------- */
.pdf-viewer {
    background: #333;
    padding: 8px 0;
}

.pdf-page-wrapper {
    position: relative;
    margin: 0 auto 8px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    line-height: 0;
    width: fit-content;
}

.pdf-canvas {
    display: block;
}

.pdf-text-layer {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    opacity: 0.25;
    line-height: 1;
}

.pdf-text-layer span {
    position: absolute;
    white-space: pre;
    color: transparent;
    cursor: pointer;
}

.pdf-text-layer span::selection {
    background: rgba(91, 155, 213, 0.4);
}

.pdf-text-layer span:hover {
    background: rgba(91, 155, 213, 0.15);
}

.pdf-page-indicator {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-right: 8px;
}

/* ----------------------------------------------------------------
   WELDER (Row Merge) — Modal + multi-select toolbar
   ---------------------------------------------------------------- */
.welder-content {
    max-width: 95vw;
    width: 95vw;
    max-height: 85vh;
}

.welder-body {
    flex: 1;
    overflow: auto;
    padding: 12px 16px;
}

.welder-instructions {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: 4px;
}

.welder-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.welder-table th {
    background: var(--bg-mid);
    color: var(--text-dim);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.welder-table td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--grid-line);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.welder-source-row td {
    background: var(--bg-dark);
    color: var(--text);
}

.welder-merged-row td {
    background: #1a2a1a !important;
    border-left: 3px solid var(--good) !important;
    color: var(--text-bright);
    font-weight: 600;
}

.welder-divider td {
    background: var(--bg-mid);
    padding: 2px;
    border-bottom: 2px solid var(--accent);
}

.merge-toolbar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 8px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.merge-toolbar .merge-label {
    font-size: 0.8rem;
    color: var(--text);
}

.btn-merge {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-merge:hover {
    background: var(--accent-hover);
}

/* Multi-select highlight in grid */
.handsontable td.hot-row-merge-selected {
    background: #1a2540 !important;
    outline: 1px solid var(--accent);
    color: #ffffff !important;
}

/* Upload page: primary file group highlight */
.file-group-primary {
    border-color: var(--accent);
    border-width: 2px;
}

/* ----------------------------------------------------------------
   WIZARD STEP INDICATOR
   ---------------------------------------------------------------- */
.step-indicator {
    display: flex;
    gap: 1.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.step-active {
    color: var(--accent);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 2px;
}

.wizard-buttons-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-back {
    color: var(--text-dim);
    text-decoration: underline;
    font-size: 0.9rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.btn-back:hover {
    color: var(--text-bright);
}

/* ----------------------------------------------------------------
   RECONCILE BAR + BUTTON
   ---------------------------------------------------------------- */
.btn-reconcile {
    background: #28a745 !important;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.btn-reconcile:hover {
    background: #218838 !important;
}

.reconcile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    font-size: 12px;
    color: var(--text);
}

.reconcile-summary {
    flex: 1;
}

.reconcile-downloads {
    display: flex;
    gap: 8px;
}

.btn-download {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.btn-download:hover {
    background: var(--accent-hover);
}

/* ----------------------------------------------------------------
   LOGOUT BUTTON
   ---------------------------------------------------------------- */
.btn-logout {
    margin-left: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
}

.btn-logout:hover {
    background: var(--bg-light);
    color: var(--text-bright);
}

/* In review header, logout is inside .header-nav, so don't auto-push */
.header-nav .btn-logout {
    margin-left: 0;
}

/* ----------------------------------------------------------------
   UTILITY
   ---------------------------------------------------------------- */
.hidden {
    display: none !important;
}
