/* CSS Variables - Brand Style Guide */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --brand-orange: #E95623;
    --brand-navy: #0D1846;
    --brand-lite-blue: #406FB7;
    --brand-off-white: #E3E3E3;
    --brand-white: #FFFFFF;
    
    /* Semantic Mappings */
    --bg-primary: var(--brand-white);
    --bg-secondary: var(--brand-off-white);
    --bg-tertiary: #D4D4D4;
    --bg-hover: #F5F5F5;
    
    /* Text */
    --text-primary: var(--brand-navy);
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: var(--brand-white);
    
    /* Accents */
    --accent: var(--brand-orange);
    --accent-hover: #D14A1E;
    --accent-muted: rgba(233, 86, 35, 0.1);
    --accent-secondary: var(--brand-lite-blue);
    --match-highlight: #10b981;
    --match-highlight-rgb: 16, 185, 129;
    
    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* UI Elements */
    --border: #cbd5e0;
    --shadow: rgba(13, 24, 70, 0.1);
    
    /* Typography */
    --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Typography - Headlines use Montserrat Bold, sentence case */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: none; /* Sentence case - not uppercase */
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    --active-tab-accent-rgb: 233, 86, 35;
}

.app-container[data-active-table="errors"] {
    --active-tab-accent-rgb: 233, 86, 35;
}

.app-container[data-active-table="discrepancies_consolidated"] {
    --active-tab-accent-rgb: 64, 111, 183;
}

.app-container[data-active-table="prior_year_review"] {
    --active-tab-accent-rgb: 49, 130, 206;
}

.app-container[data-active-table="checklist"] {
    --active-tab-accent-rgb: 47, 133, 90;
}

/* Header */
.header {
    padding: 1.5rem 2rem;
    background: var(--brand-navy);
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-inverse);
    letter-spacing: -0.02em;
}

.header .subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 0.25rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

/* Left Panel */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    overflow-y: auto;
    overflow-x: auto;
    min-width: 300px;
    min-height: 0;
}

.app-container.mode-results .left-panel {
    padding-top: 0;
}

.app-container.mode-results .results-section::before {
    content: '';
    display: block;
    height: 10px;
    margin-bottom: 0.25rem;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(
        180deg,
        rgba(var(--active-tab-accent-rgb), 0.34) 0%,
        rgba(var(--active-tab-accent-rgb), 0.12) 50%,
        rgba(var(--active-tab-accent-rgb), 0) 100%
    );
    pointer-events: none;
}

/* Panel Resizer */
.panel-resizer {
    width: 8px;
    cursor: col-resize;
    background: var(--bg-tertiary);
    transition: background 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.panel-resizer:hover,
.panel-resizer.active {
    background: var(--accent);
}

.panel-resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 60px;
    background: var(--text-muted);
    border-radius: 2px;
    opacity: 0.7;
    transition: opacity 0.2s ease, height 0.2s ease, background 0.2s ease;
}

.panel-resizer:hover::before,
.panel-resizer.active::before {
    opacity: 1;
    height: 80px;
    background: var(--text-primary);
}

/* Upload Section */
.upload-section {
    margin-bottom: 0.75rem;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1.5rem 1.5rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}

.upload-or {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.upload-button {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.upload-button:hover {
    background: var(--accent-hover);
}

/* Upload button wrapper */
.upload-button-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.upload-button-wrapper:hover {
    background: var(--accent-hover);
}

.upload-button-text {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.upload-button-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.file-name {
    font-family: var(--font-mono);
    color: var(--accent);
}

.process-button {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.process-button:hover {
    background: #2d8e47;
    transform: translateY(-1px);
}

/* Resume Section */
.resume-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 12px;
    border: 2px solid var(--accent);
}

.resume-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

.resume-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

.resume-details {
    margin-bottom: 1.25rem;
}

.resume-file {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.resume-file span {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.resume-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.resume-step {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.resume-step.completed {
    background: var(--success);
    color: white;
}

.resume-step.pending {
    background: var(--bg-primary);
    color: var(--text-muted);
    border: 1px dashed var(--border);
}

.resume-step.next {
    background: var(--accent);
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.resume-actions {
    display: flex;
    gap: 1rem;
}

.resume-button {
    flex: 1;
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.resume-button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.restart-button {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-button:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Progress Section */
.progress-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.progress-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.progress-bar-container {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.checklist-tailoring-wait-note {
    margin: 0 0 1rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(255, 247, 237, 0.95);
    color: #9a3412;
    font-size: 0.84rem;
    font-weight: 600;
    text-align: center;
}

.step-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checklist-notification-panel {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.checklist-notification-panel.opted-in {
    border-color: #86efac;
    background: rgba(16, 185, 129, 0.08);
}

.checklist-notification-text {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checklist-notification-panel.opted-in .checklist-notification-text {
    color: var(--success);
}

.checklist-notify-btn {
    white-space: nowrap;
}

@media (max-width: 700px) {
    .checklist-notification-panel {
        flex-direction: column;
        align-items: flex-start;
    }

    .checklist-notify-btn {
        width: 100%;
    }
}

.step {
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.step.active {
    background: #ff8c00 !important;  /* Orange color for in-progress */
    color: white !important;
}

.step.completed {
    background: var(--success) !important;  /* Green color for completed */
    color: white !important;
}

/* Pipeline Controls */
.progress-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header-row h3 {
    margin-bottom: 0;
}

.pipeline-controls {
    display: flex;
    gap: 0.5rem;
}

.pipeline-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pipeline-btn.pause-btn {
    background: #f59e0b;
    color: #fff;
}

.pipeline-btn.pause-btn:hover {
    background: #d97706;
}

.pipeline-btn.resume-btn {
    background: var(--success, #22c55e);
    color: #fff;
}

.pipeline-btn.resume-btn:hover {
    background: #16a34a;
}

.pipeline-btn.cancel-btn {
    background: var(--error, #ef4444);
    color: #fff;
}

.pipeline-btn.cancel-btn:hover {
    background: #dc2626;
}

.progress-bar.paused {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.progress-section.paused-state .progress-text {
    color: #f59e0b;
    font-weight: 600;
}

#progressSection {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f4f7fc 100%);
    border: 1px solid #d8dfec;
    box-shadow: 0 12px 28px rgba(13, 24, 70, 0.08);
}

#progressSection::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -80px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(64, 111, 183, 0.15) 0%, rgba(64, 111, 183, 0) 70%);
    pointer-events: none;
}

#progressSection .progress-header-row {
    align-items: flex-start;
    gap: 1rem;
}

.progress-heading-group {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.progress-kicker {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-lite-blue);
}

.progress-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.progress-percent-pill {
    min-width: 58px;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(64, 111, 183, 0.35);
    background: rgba(64, 111, 183, 0.1);
    color: #1f4679;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

#progressSection .progress-bar-container {
    height: 10px;
    margin-bottom: 0.65rem;
    background: #e6ebf5;
}

#progressSection .progress-bar {
    position: relative;
    background: linear-gradient(90deg, #e95623 0%, #406fb7 100%);
}

#progressSection .progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
    animation: progressShimmer 2.2s linear infinite;
}

@keyframes progressShimmer {
    to {
        transform: translateX(100%);
    }
}

#progressSection .progress-text {
    margin-bottom: 0.2rem;
    color: #1f325c;
    font-size: 0.95rem;
    font-weight: 600;
}

.progress-subtext {
    margin: 0 0 0.9rem;
    color: var(--text-secondary);
    font-size: 0.83rem;
}

#progressSection .pipeline-btn {
    box-shadow: 0 2px 8px rgba(13, 24, 70, 0.15);
}

#progressSection .step-indicators {
    margin-top: 0.85rem;
    gap: 0.45rem;
}

#progressSection .step {
    border: 1px solid #d5deed;
    border-radius: 999px;
    background: #ffffff;
    color: #5c6680;
    font-size: 0.72rem;
    padding: 0.32rem 0.68rem;
}

#progressSection .step.active {
    background: #fff2e8 !important;
    border-color: #f8b07b;
    color: #ac4f15 !important;
    box-shadow: 0 0 0 2px rgba(233, 86, 35, 0.16);
}

#progressSection .step.completed {
    background: #ecfdf4 !important;
    border-color: #86efac;
    color: #166534 !important;
}

.processing-hint-card {
    margin-top: 0.95rem;
    padding: 0.72rem 0.95rem;
    border-radius: 10px;
    border: 1px solid #dbe5f3;
    background: #f9fbff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.processing-hint-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--brand-lite-blue);
    box-shadow: 0 0 0 0 rgba(64, 111, 183, 0.55);
    animation: processingDotPulse 1.8s ease-in-out infinite;
}

@keyframes processingDotPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(64, 111, 183, 0.55);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(64, 111, 183, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(64, 111, 183, 0);
    }
}

.processing-hint-text {
    margin: 0;
    color: #2f456f;
    font-size: 0.82rem;
    font-weight: 500;
}

@media (max-width: 900px) {
    #progressSection .progress-header-row {
        flex-direction: column;
    }

    .progress-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    #progressSection .pipeline-controls {
        width: 100%;
    }
}

/* Live Console Panel */
.console-panel {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--brand-navy);
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #161b22;
    border-bottom: 1px solid var(--border);
}

.console-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.console-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s ease;
}

.console-toggle:hover {
    color: var(--text-primary);
}

.console-body {
    max-height: 300px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.console-body.collapsed {
    max-height: 0;
}

.console-output {
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.5;
    max-height: 280px;
    overflow-y: auto;
    color: #c9d1d9;
}

.console-line {
    display: flex;
    gap: 0.5rem;
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.console-line:last-child {
    border-bottom: none;
}

.console-timestamp {
    color: #6e7681;
    flex-shrink: 0;
}

.console-level {
    flex-shrink: 0;
    font-weight: 600;
    min-width: 60px;
}

.console-level.INFO {
    color: var(--brand-lite-blue);
}

.console-level.SUCCESS {
    color: #3fb950;
}

.console-level.ERROR {
    color: #f85149;
}

.console-level.WARN {
    color: #d29922;
}

.console-message {
    color: #c9d1d9;
    word-break: break-word;
}

.console-message.separator {
    color: #6e7681;
}

/* Results Section */
.results-section {
    flex: 1 0 auto; /* Allow growing to fit content */
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
}

/* Sticky Sub-tabs row - keeps filter buttons visible when scrolling */
.subtabs-sticky {
    position: sticky;
    top: 0;
    z-index: 30; /* Increased z-index to stay above everything */
    background: #ffffff !important; /* Force solid white background */
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
    /* Add a shadow to cover any sub-pixel gaps above the element when scrolling */
    box-shadow: 0 -10px 0 10px #ffffff;
}

.app-container.mode-results .subtabs-sticky {
    padding-top: 0.2rem;
}

/* Table headers should stick below the sticky subtabs row */
.subtabs-sticky + .table-container .results-table th {
    position: sticky;
    top: var(--sticky-header-top, 70px); /* Use dynamic height from JS, fallback to dashboard-aligned header height */
    z-index: 10;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Tab grouping for visual organization */
.tab-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    background: #f0f4f8; /* Light blue-gray for review tabs group */
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-group .tab {
    margin: 0;
}

/* Checklist tab - separate styling with different light color */
.tab[data-table="checklist"] {
    background: #fef3e7; /* Light orange/peach for checklist */
}

.tab[data-table="checklist"]:hover:not(.active) {
    background: #fce4c4; /* Slightly darker orange on hover */
}

.tab {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Sub-tabs */
.sub-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0;
    flex-wrap: nowrap; /* Prevent wrapping to maintain constant height for sticky headers */
    overflow-x: auto; /* Allow horizontal scrolling if buttons don't fit */
    scrollbar-width: none; /* Hide scrollbar for cleaner look */
    -ms-overflow-style: none;
}

.sub-tabs-select {
    /* Only shown when the subtabs row is in "compact" mode (JS toggles the class). */
    display: none;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-navy);
    background: #ffffff;
    min-width: 220px;
    max-width: 100%;
}

.subtabs-row.subtabs-compact #errorSubTabs {
    display: none;
}

.subtabs-row.subtabs-compact #errorSubTabsSelect {
    display: inline-block;
}

.sub-tabs::-webkit-scrollbar {
    display: none;
}

.sub-tabs.hidden {
    display: none;
}

.subtabs-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* Allow the row to wrap based on *container* width (left panel can be narrow even on wide viewports). */
    flex-wrap: wrap;
    margin-bottom: 0.5rem; /* smaller gap before table */
}

.subtabs-row .sub-tabs {
    flex: 1 1 auto;
    /* Allow the pills row to shrink inside the flex layout so it doesn't bleed under table controls. */
    min-width: 0;
}

.subtabs-row .table-controls {
    margin-left: auto;
    padding: 0; /* remove extra vertical padding */
    /* Don't let table controls shrink down so far they force the pills into unreadable chips. */
    flex: 0 0 auto;
    flex-wrap: wrap;
}

#primarySubtabsRow {
    flex-wrap: nowrap;
}

#primarySubtabsRow .table-controls {
    flex-wrap: nowrap;
}

#primarySubtabsRow .sub-tabs {
    overflow-x: auto;
    white-space: nowrap;
}

/* Sub-tab pills should scroll horizontally rather than compressing into unreadable chips. */
.sub-tabs .sub-tab {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Keep the search input from overflowing narrow panels (esp. when the PDF panel is open). */
.subtabs-row .table-controls .table-search-input {
    width: min(200px, 100%);
}

.checklist-controls-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

#checklistTableControlsMount {
    display: flex;
    align-items: center;
}

#checklistTableControlsMount > .table-controls {
    margin-left: 0;
    padding: 0;
}

.table-description {
    display: inline-flex;
    align-items: center;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-left: 1.5rem;
    line-height: 1.2;
    font-weight: 600;
    font-family: var(--font-heading);
}

@media (max-width: 900px) {
    .table-description {
        margin-left: 0.5rem;
    }
}

.sub-tab {
    padding: 0.45rem 0.9rem;
    background: #f1f5ff;
    border: 1px solid #c7d5ee;
    border-radius: 8px;
    color: var(--brand-navy);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-tab:hover {
    background: #e2ebfb;
    color: var(--brand-navy);
    border-color: #a9c0e6;
}

.sub-tab.active {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
    color: var(--text-inverse);
    box-shadow: 0 2px 8px rgba(13, 24, 70, 0.25);
}

.sub-tab .count {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.4rem;
    background: rgba(13, 24, 70, 0.12);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--brand-navy);
}

.sub-tab.active .count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-inverse);
}

.sub-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sub-tab.disabled:hover {
    background: var(--brand-white);
    color: var(--text-secondary);
    border-color: var(--border);
}

.sub-tab.disabled .count {
    background: rgba(0, 0, 0, 0.05);
}

.table-container {
    flex: 1 0 auto; /* Allow growing */
    min-height: 0;
    /* Remove max-height so container grows with content */
    /* Remove overflow so sticky headers work relative to parent (.left-panel) */
    overflow: visible; 
    background: var(--brand-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    max-width: 100%;
}

/* Ensure left-panel handles horizontal scroll for wide tables */
.left-panel {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: var(--brand-white);
    table-layout: fixed; /* Fixed layout to prevent column shifting when rows expand */
}

/* Fixed column widths for results-table to prevent resizing when rows expand.
   With table-layout: fixed, widths are determined by th elements in the header row. */
.results-table th[data-column="page_number"] {
    width: 60px;
}

.results-table th[data-column="severity"] {
    width: 112px;
    min-width: 112px;
    max-width: 112px;
}

.results-table th[data-column="pages"] {
    /*
      Discrepancies can show 1-2 page badges + a separator.
      Keep this wide enough to avoid clipping/crowding in fixed-table layouts.
    */
    width: 160px;
    min-width: 160px;
    max-width: 160px;
}

.results-table th {
    position: sticky;
    top: 0;
    /*
      IMPORTANT: Avoid per-<th> gradients.
      A gradient on each header cell looks inconsistent because each column has a different width
      (small columns appear darker, wide columns appear lighter).
      Use a solid brand header + subtle accent line for a clean, consistent look.
    */
    /* White header with dark text */
    background: #ffffff;
    padding: 0.65rem 0.85rem;
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    color: var(--brand-navy);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    z-index: 10;
}

/* Slightly larger headers for discrepancies table to fit multi-page labels */
.results-table.discrepancy-table th {
    font-size: 0.85rem; /* Match base header size */
    padding: 0.65rem 0.85rem; /* Match base header padding */
}

.results-table th:last-child {
    border-right: none;
}

.results-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
    position: relative;
    padding-right: 1.75rem;
}

.results-table th.sortable:hover {
    background-color: var(--bg-hover);
}

.results-table th.sortable::after {
    content: '\21C5';
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1;
    pointer-events: none;
}

.results-table th.sortable.sorted::after {
    opacity: 1;
    color: var(--brand-navy);
}

.results-table th.sortable.sorted.asc::after {
    content: '\2191';
}

.results-table th.sortable.sorted.desc::after {
    content: '\2193';
}

.results-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.results-table tr.clickable {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    background: #f8f9fa;
}

.checklist-table tr.clickable {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    background: #ffffff;
}

.results-table tr.clickable:hover {
    background: #f0f4f8;
}

.checklist-table tr.clickable:hover {
    background: #f5f5f5;
}

.results-table tr.selected {
    background: #e8f1ff;
    border-left: 4px solid #2f62ad;
    box-shadow: inset 0 0 0 1px rgba(47, 98, 173, 0.22);
}

.results-table tr.selected td {
    background: #e8f1ff;
}

.results-table tr.selected td:first-child {
    padding-left: calc(1rem - 4px);
}

/* Swipe-away dismissal for auto-hidden reviewed rows */
.results-table tr.review-row-swipe-away {
    pointer-events: none;
}

.results-table tr.review-row-swipe-away td {
    animation: review-row-swipe-away 220ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes review-row-swipe-away {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(44px);
        opacity: 0;
    }
}

/* Expanded Row Styles */
.results-table tr.expanded {
    background: #fef6f2;
}

.results-table tr.expanded td {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
    padding: 1rem;
    line-height: 1.6;
    vertical-align: top;
    color: var(--brand-navy);
    border-top: 1px solid var(--border);
}

.results-table tr.expanded td:first-child {
    border-left: 3px solid var(--accent);
    padding-left: calc(1rem - 3px);
}

.results-table tr.expanded td:last-child {
    border-right: 1px solid var(--border);
}

/* Severity and Confidence cells */
.results-table td.severity-cell,
.results-table td.confidence-cell {
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem 0.25rem;
    width: 80px;
    min-width: 70px;
    max-width: 90px;
}

/* Severity Labels */
.severity-label {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.severity-low {
    background: #d4edda;
    color: #155724;
}

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

.severity-high {
    background: #f8d7da;
    color: #721c24;
}

/* Error Type Badges */
.error-type-cell {
    text-align: center;
}

.error-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

.error-type-spelling {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.error-type-mathematical {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

.error-type-illogical {
    background: #fff8e1;
    color: #f57c00;
    border: 1px solid #ffcc80;
}

.error-type-compliance {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}


/* Confidence Score Label */
.confidence-label {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--brand-white);
    min-width: 38px;
    text-align: center;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem !important;
}

.no-data-container {
    text-align: center;
    padding: 4rem 2rem !important;
    background: var(--bg-secondary);
}

.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.no-data-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.no-data-icon-check {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.no-data-icon-check svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.no-data-icon-info {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.no-data-icon-info svg {
    width: 32px;
    height: 32px;
}

.no-data-text {
    font-size: 1.125rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.01em;
}

.no-data-run-full-review-btn {
    padding: 0.62rem 1rem;
    border: 1px solid #c2410c;
    border-radius: 10px;
    background: linear-gradient(180deg, #fb923c 0%, #f97316 100%);
    color: #fff;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.no-data-run-full-review-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(249, 115, 22, 0.28);
    filter: brightness(1.03);
}

.no-data-run-full-review-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.free-review-restriction-notice {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    margin: 0 0 0.75rem;
    padding: 0.72rem 0.82rem;
    border-radius: 12px;
    border: 1px solid rgba(180, 83, 9, 0.28);
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    color: #92400e;
}

.free-review-restriction-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.62rem;
    min-width: 0;
}

.free-review-restriction-icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.22);
    color: #92400e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.free-review-restriction-icon svg {
    width: 1rem;
    height: 1rem;
}

.free-review-restriction-text {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.free-review-restriction-text strong {
    color: #7c2d12;
    font-size: 0.82rem;
}

.free-review-restriction-text span {
    color: #9a3412;
    font-size: 0.79rem;
}

.free-review-restriction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 0.45rem 0.72rem;
    border-radius: 8px;
    background: #b45309;
    color: #fff;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid #92400e;
}

.free-review-restriction-btn:hover {
    background: #92400e;
    color: #fff;
}

.results-table tr.free-review-blurred-row,
.checklist-table tr.free-review-blurred-row {
    background: #f1f5f9;
    cursor: not-allowed;
}

.results-table tr.free-review-blurred-row:hover,
.checklist-table tr.free-review-blurred-row:hover {
    background: #e2e8f0;
}

.results-table tr.free-review-blurred-row td,
.checklist-table tr.free-review-blurred-row td {
    filter: blur(1.15px);
    opacity: 0.72;
    pointer-events: none;
    user-select: none;
}

.results-table tr.free-review-blurred-row td.free-review-lock-cell,
.checklist-table tr.free-review-blurred-row td.free-review-lock-cell {
    filter: none;
    opacity: 1;
}

.results-table td.free-review-lock-cell,
.checklist-table td.free-review-lock-cell {
    position: relative;
}

.free-review-locked-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.26rem;
    margin-left: 0.45rem;
    padding: 0.12rem 0.38rem;
    border-radius: 999px;
    border: 1px solid rgba(180, 83, 9, 0.44);
    background: rgba(255, 237, 213, 0.95);
    color: #9a3412;
    font-size: 0.67rem;
    font-weight: 700;
    vertical-align: middle;
}

.free-review-locked-chip svg {
    width: 0.72rem;
    height: 0.72rem;
    flex-shrink: 0;
}

.action-free-review-banner {
    margin: 0 1.25rem 0.7rem;
    padding: 0.58rem 0.72rem;
    border-radius: 10px;
    border: 1px solid rgba(180, 83, 9, 0.3);
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    color: #92400e;
    font-size: 0.77rem;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 0.55rem;
}

.action-free-review-icon {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-free-review-icon svg {
    width: 0.8rem;
    height: 0.8rem;
}

.action-free-review-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.action-free-review-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #92400e;
    background: #b45309;
    color: #fff;
    text-decoration: none;
    font-size: 0.73rem;
    font-weight: 700;
    white-space: nowrap;
}

.action-free-review-btn:hover {
    background: #92400e;
    color: #fff;
}

.action-item-card.free-review-blurred-card {
    position: relative;
    overflow: hidden;
}

.action-item-card.free-review-blurred-card .item-content-sections {
    filter: blur(1.9px);
    opacity: 0.66;
    pointer-events: none;
    user-select: none;
}

.action-item-card.free-review-blurred-card .quick-status-section {
    opacity: 0.42;
    pointer-events: none;
}

.action-locked-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.88);
    z-index: 40;
}

.action-locked-overlay-card {
    max-width: 360px;
    border-radius: 12px;
    border: 1px solid rgba(180, 83, 9, 0.35);
    background: #fff7ed;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.15);
    padding: 0.85rem 0.92rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    text-align: center;
}

.action-locked-overlay-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-locked-overlay-icon svg {
    width: 1rem;
    height: 1rem;
}

.action-locked-overlay-copy {
    color: #9a3412;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.action-locked-overlay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.42rem 0.72rem;
    border-radius: 8px;
    border: 1px solid #92400e;
    background: #b45309;
    color: #fff;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
}

.action-locked-overlay-btn:hover {
    background: #92400e;
    color: #fff;
}

.dashboard-free-review-banner {
    border-color: rgba(180, 83, 9, 0.35);
    background: linear-gradient(180deg, #fff7ed 0%, #fffbeb 100%);
    color: #92400e;
    display: none;
    align-items: center;
    gap: 0.62rem;
}

.dashboard-free-review-icon {
    width: 1.72rem;
    height: 1.72rem;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-free-review-icon svg {
    width: 0.9rem;
    height: 0.9rem;
}

.dashboard-free-review-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-free-review-copy strong {
    color: #7c2d12;
    font-size: 0.82rem;
}

.dashboard-free-review-copy span {
    font-size: 0.76rem;
    color: #9a3412;
}

.dashboard-free-review-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 0.34rem 0.62rem;
    border-radius: 8px;
    border: 1px solid #92400e;
    background: #b45309;
    color: #fff;
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 700;
}

.dashboard-free-review-btn:hover {
    background: #92400e;
    color: #fff;
}

/* Loading state for tables still processing */
.loading-state {
    padding: 2rem;
}

.loading-spinner-container {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Right Panel - PDF Viewer */
.right-panel {
    width: 40%;
    min-width: 300px;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    flex-shrink: 1;
    flex-grow: 0;
    box-sizing: border-box;
    transition: width 0.3s ease, min-width 0.3s ease;
    border-left: 1px solid var(--border);
    position: relative;
}

/* Minimized State */
.right-panel.minimized {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    overflow: hidden;
    cursor: pointer;
}

.right-panel.minimized:hover {
    background: var(--bg-tertiary);
}

.right-panel.minimized .pdf-header {
    padding: 0;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    border-bottom: none;
}

.right-panel.minimized .pdf-header h3,
.right-panel.minimized .pdf-controls,
.right-panel.minimized .pdf-viewer {
    display: none;
}

.right-panel.minimized::after {
    content: 'PDF Viewer';
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.right-panel.minimized::before {
    content: '◀';
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: var(--accent);
}

.right-panel * {
    box-sizing: border-box;
}

.pdf-page-wrapper,
.pdf-page-wrapper * {
    max-width: none !important;
}

body.resizing {
    user-select: none;
    cursor: col-resize !important;
}

body.resizing * {
    cursor: col-resize !important;
}

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 3rem 0.35rem 0.75rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    gap: 0.4rem;
}

.pdf-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 2rem; /* keep controls clear of absolute-positioned close button */
    overflow: visible;
    row-gap: 0.25rem;
}

.pdf-controls button {
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.72rem;
    padding: 0 0.35rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.pdf-controls button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.page-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    white-space: nowrap;
}

.page-info input {
    width: 48px;
    padding: 0.15rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.7rem;
}

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

#zoomLevel {
    color: var(--text-secondary);
    font-size: 0.7rem;
    min-width: 32px;
    text-align: center;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    margin-right: 0.25rem;
    flex: 1 1 180px;
    min-width: 140px;
    max-width: 280px;
}

.pdf-search-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.2rem 0.4rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.72rem;
    transition: all 0.2s ease;
}

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

.pdf-search-input::placeholder {
    color: var(--text-muted);
}

.search-nav-btn {
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.7rem;
    padding: 0;
}

.search-nav-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent);
}

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

.search-results {
    color: var(--text-secondary);
    font-size: 0.7rem;
    min-width: 42px;
    text-align: center;
}

.search-clear-btn {
    width: 20px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pdf-viewer {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    display: block;
    background: #1a1a1a;
    width: 100%;
    box-sizing: border-box;
}

.pdf-viewer.loading {
    opacity: 0.6;
}

.pdf-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 1rem;
}

#pdfCanvas {
    display: none;
    box-shadow: 0 4px 20px var(--shadow);
    background: white;
    max-width: none;
    height: auto;
    object-fit: contain;
    box-sizing: border-box;
}

/* PDF Page Wrapper */
.pdf-page-wrapper {
    position: relative;
    display: block;
    box-shadow: 0 4px 20px var(--shadow);
    max-width: none;
    width: fit-content;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

.pdf-page-wrapper #pdfCanvas {
    display: block;
    box-shadow: none;
    max-width: none;
    height: auto;
}

/* PDF Text Layer */
.pdf-text-layer {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    opacity: 0.2;
    line-height: 1;
    pointer-events: none;
}

.pdf-text-layer span {
    position: absolute;
    white-space: pre;
    color: transparent;
    transform-origin: 0 0;
    pointer-events: auto;
    cursor: text;
}

.pdf-text-layer span.highlighted {
    background: rgba(255, 220, 50, 0.58);
    color: transparent;
    border-radius: 2px;
}

/* PDF Highlight Layer */
.pdf-highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.pdf-highlight {
    position: absolute;
    background: rgba(255, 165, 0, 0.24);
    border-radius: 3px;
    mix-blend-mode: normal;
}

.pdf-highlight.primary {
    background: rgba(64, 111, 183, 0.30);
}

.pdf-highlight.secondary {
    background: rgba(255, 165, 0, 0.24);
}

@keyframes highlightPulse {
    0% {
        opacity: 0;
        transform: scale(1.1);
    }
    20% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes highlightPulsePrimary {
    0%, 100% {
        box-shadow: 0 0 8px rgba(64, 111, 183, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(64, 111, 183, 0.8), 0 0 24px rgba(64, 111, 183, 0.4);
    }
}

.pdf-highlight-canvas {
    z-index: 2;
}

@keyframes canvasHighlightPulse {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* PDF Controls Divider */
.control-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 0.15rem;
}

/* Magnifier Toggle Button */
.magnifier-btn {
    font-size: 1rem !important;
}

.magnifier-btn.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 8px rgba(233, 86, 35, 0.4);
}

/* PDF Magnifier Glass */
.pdf-magnifier {
    position: fixed;
    width: 480px;
    height: 180px;
    border-radius: 8px;
    border: 2px solid var(--accent);
    box-shadow: 
        0 0 0 1px rgba(13, 24, 70, 0.9),
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(233, 86, 35, 0.15);
    overflow: hidden;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transform: scale(0.95) translateX(-10px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    background: var(--brand-white);
}

.pdf-magnifier.visible {
    opacity: 1;
    transform: scale(1) translateX(0);
}

.pdf-magnifier .magnifier-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pdf-magnifier .magnifier-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.pdf-magnifier .magnifier-crosshair::before,
.pdf-magnifier .magnifier-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(233, 86, 35, 0.5);
}

.pdf-magnifier .magnifier-crosshair::before {
    width: 1px;
    height: 30px;
    left: 0;
    top: -15px;
}

.pdf-magnifier .magnifier-crosshair::after {
    width: 30px;
    height: 1px;
    left: -15px;
    top: 0;
}

.pdf-magnifier::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* ==========================================================================
   PDF Text Selection Mode
   ========================================================================== */

.selection-mode-btn,
.table-mode-btn {
    width: 26px;
    min-width: 26px;
    font-size: 0.85rem !important;
    padding: 0.2rem !important;
}

.selection-mode-btn svg,
.table-mode-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.selection-mode-btn.active,
.table-mode-btn.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 8px rgba(233, 86, 35, 0.4);
    color: white !important;
}

.selection-mode-btn.active svg,
.table-mode-btn.active svg {
    stroke: white;
}

/* Selection Rectangle Overlay */
.pdf-selection-rect {
    position: absolute;
    border: 2px dashed var(--accent-secondary);
    background: rgba(64, 111, 183, 0.15);
    pointer-events: none;
    z-index: 5;
    border-radius: 3px;
}

/* Selection Mode Cursor */
.pdf-page-wrapper.selection-mode {
    cursor: crosshair !important;
}

.pdf-page-wrapper.selection-mode * {
    cursor: crosshair !important;
}

/* ==========================================================================
   PDF Table Extraction Mode
   ========================================================================== */

/* Table Region Rectangle */
.pdf-table-region {
    position: absolute;
    border: 2px dashed var(--success);
    background: rgba(16, 185, 129, 0.1);
    pointer-events: none;
    z-index: 4;
    border-radius: 3px;
}

/* Table Mode Cursor */
.pdf-page-wrapper.table-mode {
    cursor: crosshair !important;
}

.pdf-page-wrapper.table-mode * {
    cursor: crosshair !important;
}

/* Table Grid Overlay Canvas */
.pdf-table-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 6;
}

/* When adjusting dividers, allow interaction */
.pdf-table-overlay.interactive {
    pointer-events: auto;
    cursor: default;
}

/* Divider Lines on Canvas (drawn programmatically) */
/* These classes are for reference - actual dividers drawn on canvas */

/* Table Divider Handles (for mouse interaction) */
.table-divider-handle {
    position: absolute;
    z-index: 7;
}

.table-divider-handle.row {
    width: 100%;
    height: 8px;
    margin-top: -4px;
    cursor: row-resize;
}

.table-divider-handle.col {
    width: 8px;
    height: 100%;
    margin-left: -4px;
    cursor: col-resize;
}

.table-divider-handle:hover {
    background: rgba(16, 185, 129, 0.3);
}

.table-divider-handle.dragging {
    background: rgba(16, 185, 129, 0.5);
}

/* Table Actions Floating Panel */
.table-actions-panel {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: var(--brand-navy);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 8;
}

.table-actions-panel button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.table-actions-panel button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.table-actions-panel button.primary {
    background: var(--success);
    border-color: var(--success);
}

.table-actions-panel button.primary:hover {
    background: #0d9f6e;
}

/* ==========================================================================
   Table Preview Modal
   ========================================================================== */

.table-preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 24, 70, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 2rem;
}

.table-preview-modal-overlay.visible {
    display: flex;
}

.table-preview-modal {
    background: var(--brand-white);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 80vh;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.table-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.table-preview-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.table-preview-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.table-preview-close:hover {
    background: var(--error);
    color: white;
}

.table-preview-body {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    min-height: 200px;
}

.table-preview-content {
    width: 100%;
}

.table-preview-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table-preview-content th,
.table-preview-content td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.table-preview-content th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.table-preview-content tr:nth-child(even) td {
    background: var(--bg-secondary);
}

.table-preview-content tr:hover td {
    background: var(--bg-hover);
}

.table-preview-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.table-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.table-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--brand-white);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.table-action-btn svg {
    width: 14px;
    height: 14px;
}

.table-close-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    background: var(--text-muted);
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-close-btn:hover {
    background: var(--text-secondary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Clickable Fact Cells */
.results-table td.fact-cell {
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
    padding-right: 24px;
}

.results-table td.fact-cell:hover {
    background: rgba(233, 86, 35, 0.1);
    border-left-color: var(--accent);
    color: var(--accent);
}

.results-table td.fact-cell.active {
    background: rgba(233, 86, 35, 0.15);
    border-left-color: var(--accent);
}

.results-table td.fact-cell::before {
    content: '→';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    color: var(--accent);
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.results-table td.fact-cell:hover::before {
    opacity: 1;
}

/* Clickable Text Cells (errors table - original text column) */
.results-table td.clickable-text {
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-left: 3px solid transparent;
    padding-right: 28px;
}

.results-table td.clickable-text:hover {
    background: rgba(233, 86, 35, 0.1);
    border-left-color: var(--accent);
}

.results-table td.clickable-text:hover .cell-text {
    color: var(--accent);
}

/* Use ::before for the icon since ::after is used for tooltip */
.results-table td.clickable-text::before {
    content: 'View';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    font-size: 0.85rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.results-table td.clickable-text:hover::before {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* Clickable Field Cells */
.results-table td.field-cell {
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-left: 3px solid transparent;
    padding-right: 24px;
}

.results-table td.field-cell:hover {
    background: rgba(64, 111, 183, 0.12);
    border-left-color: var(--brand-lite-blue);
}

.results-table td.field-cell:hover .field-value-text {
    color: var(--brand-lite-blue);
}

/* Use ::before for the icon since ::after may be used for tooltip */
.results-table td.field-cell::before {
    content: '→';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    color: var(--brand-lite-blue);
    font-size: 0.8rem;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.results-table td.field-cell:hover::before {
    opacity: 0.7;
}

.results-table td.field-cell.selected {
    background: rgba(64, 111, 183, 0.2);
    border-left-color: var(--brand-lite-blue);
}

.results-table td.field-cell.selected .field-value-text {
    color: var(--brand-lite-blue);
    font-weight: 600;
}

/* App Header with Navigation */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 1.25rem;
    height: 72px;
    background: var(--brand-navy);
    border-bottom: none;
    flex-shrink: 0;
    gap: 1rem;
    overflow: visible; /* Allow dropdowns to be visible */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    /* Default: allow the title/company name to use available header space. */
    flex: 1 1 auto;
    max-width: none;
    overflow: hidden;
    padding-right: 1rem;
    box-sizing: border-box;
}

/* When nav tabs are visible, keep the left header constrained to avoid overlap. */
.app-header.header-tabs-visible .header-left {
    flex: 0 1 auto;
    max-width: 35%;
    padding-right: 1.75rem;
}

/* Progressive responsive adjustments */
@media (max-width: 1400px) {
    .app-header.header-tabs-visible .header-left {
        max-width: calc(33% - 4rem);
        flex-basis: auto;
        padding-right: 5rem;
        margin-right: 1.5rem;
    }
    
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 200px;
    }
}

@media (max-width: 1200px) {
    .app-header.header-tabs-visible .header-left {
        max-width: calc(30% - 4rem);
        flex-basis: auto;
        padding-right: 4rem;
        margin-right: 1.5rem;
    }
    
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 150px;
    }
    
    .nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 1000px) {
    .app-header.header-tabs-visible .header-left {
        max-width: calc(28% - 3.5rem);
        flex-basis: auto;
        padding-right: 3rem;
        margin-right: 1rem;
    }
    
    .app-title {
        font-size: 0.95rem;
    }
    
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 120px;
    }
    
    .nav-tab {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }
    
    .nav-tab-label {
        font-size: 0.8rem;
    }
}

@media (max-width: 900px) {
    .app-header.header-tabs-visible .header-left {
        max-width: calc(25% - 3rem);
        flex-basis: auto;
        padding-right: 2.5rem;
        margin-right: 1rem;
    }
    
    .app-header.header-tabs-visible .app-title .title-text {
        max-width: 180px;
    }
    
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 140px;
    }
    
    .nav-tab {
        padding: 0.5rem 0.6rem;
        gap: 0.4rem;
    }
}

.header-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.back-button svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

.app-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1 1 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-inverse);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
}

.app-title .title-text {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 3;
    min-width: 0;
    /* Don't pre-truncate the title; let flexbox allocate space naturally. */
    max-width: none;
}

/* When nav tabs are visible, keep the title compact to avoid overlap. */
.app-header.header-tabs-visible .app-title .title-text {
    /* Avoid over-aggressive truncation while still preventing overlap with centered tabs. */
    max-width: clamp(220px, 22vw, 360px);
}

.app-title .analysis-name {
    display: inline-block;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
    font-weight: 500;
    flex-shrink: 1;
    min-width: 0;
}

/* ============================================
   Modern Header Navigation Tabs
   ============================================ */
.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
}

@media (min-width: 801px) {
    .header-nav {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        flex: 0 0 auto;
        min-width: 400px;
        padding-left: 1.5rem;
    }
}

.nav-tabs {
    display: flex;
    align-items: center;
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
}

.nav-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.nav-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
    color: white;
    background: rgb(var(--active-tab-accent-rgb, 233, 86, 35));
    box-shadow: 0 2px 10px rgba(var(--active-tab-accent-rgb, 233, 86, 35), 0.42);
}

.nav-tab-icon {
    width: 16px;
    height: 16px;
    opacity: 0.85;
    flex-shrink: 0;
}

.nav-tab.active .nav-tab-icon {
    opacity: 1;
}

.nav-tab-label {
    white-space: nowrap;
}

.nav-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.nav-tab.active .nav-tab-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.nav-tab-badge.has-issues {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.nav-tab.active .nav-tab-badge.has-issues {
    background: white;
    color: var(--error);
}

/* ============================================
   Minimal Header Action Buttons
   ============================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 0.35rem;
}

.export-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.action-label {
    display: none;
}

@media (min-width: 900px) {
    .action-label {
        display: inline;
    }
}

/* Review page Dashboard button is text-only; keep the label visible at all widths. */
a#dashboardBtn.action-btn-accent .action-label {
    display: inline;
}

.action-btn-ghost {
    border-color: rgba(255, 255, 255, 0.15);
}

.action-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.action-btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

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

/* ============================================
   Sticky Bottom-Right CTA Dock
   ============================================ */
.sticky-cta-dock {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 220;
    pointer-events: none; /* let clicks pass through except on the button */
}

.sticky-cta-dock--above-footer {
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.sticky-cta-dock .sticky-cta-btn {
    pointer-events: auto;
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    box-shadow:
        0 16px 42px rgba(13, 24, 70, 0.22),
        0 4px 12px rgba(13, 24, 70, 0.18);
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.sticky-cta-dock .sticky-cta-btn svg {
    width: 16px;
    height: 16px;
}

.sticky-cta-dock .sticky-cta-btn:focus-visible {
    outline: 3px solid rgba(13, 24, 70, 0.55);
    outline-offset: 3px;
}

/* Review page: only show Action View CTA in results mode. */
.app-container.mode-upload #actionViewBtn,
.app-container.mode-processing #actionViewBtn {
    display: none !important;
}

@media (max-width: 820px) {
    .sticky-cta-dock {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    .sticky-cta-dock--above-footer {
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }

    .sticky-cta-dock .sticky-cta-btn {
        padding: 0.7rem 0.75rem;
    }
}

@media print {
    .sticky-cta-dock {
        display: none !important;
    }
}

.action-btn-subtle {
    border-color: rgba(255, 255, 255, 0.12);
}

.action-btn-subtle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

/* When opening a saved analysis (/review?analysis=...), suppress the legacy upload panel. */
html.has-analysis #uploadSection {
    display: none !important;
}

.dropdown-chevron {
    width: 12px;
    height: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.export-dropdown.show .dropdown-chevron {
    transform: rotate(180deg);
}

/* Export Dropdown - Updated */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--brand-navy);
    min-width: 220px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    z-index: 100;
    overflow: hidden;
    animation: dropdownFade 0.15s ease;
}

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

.export-dropdown-content a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.export-dropdown-content a svg {
    opacity: 0.7;
}

.export-dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.export-dropdown-content a:hover svg {
    opacity: 1;
}

.export-dropdown-content a:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.export-dropdown.show .export-dropdown-content {
    display: block;
}

/* Legacy button compatibility - map to new styles */
.rerun-btn,
.save-analysis-btn,
.export-btn {
    display: none !important;
}

/* Save Modal */
.save-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.save-modal-overlay.active {
    display: flex;
}

.save-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    animation: modalSlide 0.3s ease;
}

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

.save-modal h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.save-modal-group {
    margin-bottom: 1.5rem;
}

.save-modal-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.save-modal-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.save-modal-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 86, 35, 0.2);
}

.save-modal-actions {
    display: flex;
    gap: 1rem;
}

.save-modal-actions button {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-modal-cancel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.save-modal-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.save-modal-confirm {
    background: var(--accent);
    border: none;
    color: white;
}

.save-modal-confirm:hover {
    background: var(--accent-hover);
}

/* Re-run Options */
.rerun-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rerun-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    font-family: var(--font-body);
}

.rerun-option:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.rerun-step {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.rerun-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rerun-info strong {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
}

.rerun-info small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Smart Resume - highlighted option */
.rerun-option.smart-resume {
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-lite-blue) 100%);
    border-color: var(--brand-lite-blue);
}

.rerun-option.smart-resume .rerun-step {
    background: white;
    color: var(--brand-lite-blue);
}

.rerun-option.smart-resume .rerun-info strong {
    color: white;
}

.rerun-option.smart-resume .rerun-info small {
    color: rgba(255, 255, 255, 0.85);
}

.rerun-option.smart-resume:hover {
    background: linear-gradient(135deg, var(--brand-lite-blue) 0%, var(--brand-navy) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 111, 183, 0.3);
}

/* Checklist Re-run - distinct styling */
.rerun-option.checklist-rerun {
    background: linear-gradient(135deg, #2d5016 0%, #4a8529 100%);
    border-color: #4a8529;
}

.rerun-option.checklist-rerun .rerun-step {
    background: white;
    color: #4a8529;
}

.rerun-option.checklist-rerun .rerun-info strong {
    color: white;
}

.rerun-option.checklist-rerun .rerun-info small {
    color: rgba(255, 255, 255, 0.85);
}

.rerun-option.checklist-rerun:hover {
    background: linear-gradient(135deg, #4a8529 0%, #2d5016 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 133, 41, 0.3);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    color: var(--text-primary);
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .left-panel {
        min-width: auto;
    }
    
    .panel-resizer {
        display: none;
    }
    
    .right-panel {
        width: 100% !important;
        max-width: none;
        height: 50vh;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 800px) {
    .app-header {
        padding: 0 0.75rem;
        height: auto;
        min-height: 52px;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .header-left {
        order: 1;
        flex: 1;
        max-width: 100%;
    }
    
    .header-divider {
        display: none;
    }
    
    .back-text {
        display: none;
    }
    
    .app-title {
        font-size: 0.9rem;
    }
    
    .app-title .title-text {
        max-width: 100px;
    }
    
    .app-title .analysis-name {
        max-width: 80px;
    }

    .header-actions {
        order: 2;
        flex-shrink: 0;
    }
    
    .action-label {
        display: none !important;
    }
    
    .action-divider {
        display: none;
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        padding-top: 0.35rem;
    }
    
    .nav-tabs {
        width: 100%;
        justify-content: stretch;
    }
    
    .nav-tab {
        flex: 1;
        justify-content: center;
        padding: 0.45rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .nav-tab-icon {
        width: 14px;
        height: 14px;
    }
    
    .nav-tab-badge {
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }
}

@media (max-width: 600px) {
    .app-title .analysis-name {
        display: none;
    }
    
    .app-title .title-text {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .app-title .title-text {
        max-width: 100px;
    }
    
    .nav-tab-label {
        display: none;
    }
    
    .nav-tab {
        padding: 0.5rem;
        gap: 0.35rem;
    }
}

/* ==========================================================================
   Tidied UI for Validation Results
   ========================================================================== */

/* Consistency/Validation Section */
.consistency-section {
    padding: 1rem;
}

/* Summary Card */
.summary-card {
    background: var(--brand-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-card.passed {
    border-left: 4px solid var(--success);
}

.summary-card.issues {
    border-left: 4px solid var(--warning);
}

.summary-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.summary-icon-wrapper {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
}

.summary-card.passed .summary-icon-wrapper {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.summary-card.issues .summary-icon-wrapper {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.summary-icon {
    font-size: 1.25rem;
    font-weight: bold;
}

.summary-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
    color: var(--brand-navy);
}

.summary-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Summary Metrics */
.summary-metrics {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.metric-item {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.metric-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.metric-verified { color: var(--success); }


/* Validation Tables */
.validation-group {
    margin-bottom: 2rem;
    background: var(--brand-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.validation-header {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.validation-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.validation-count {
    background: #e2e8f0;
    color: #475569;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.validation-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

.validation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.validation-table th {
    position: sticky;
    top: 0;
    background: #ffffff;
    padding: 0.6rem 1rem;
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
    color: var(--brand-navy);
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    z-index: 5;
}

.validation-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--bg-hover);
    color: var(--text-secondary);
    vertical-align: middle;
}

.validation-table tr:last-child td {
    border-bottom: none;
}

.validation-table tr:hover {
    background: #f8fafc;
}

.value-cell {
    font-family: var(--font-mono);
    color: var(--text-primary) !important;
    font-size: 0.8rem;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.verified {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.issue {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.status-badge.passed {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.status-badge.failed {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.page-ref {
    color: #94a3b8;
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* Truncation for long values */
.truncate-cell {
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Financial Disclosure Checklist Styles
   ========================================================================== */

/* Checklist Container */
.checklist-container {
    padding: 0 0 1rem;
    display: flex;
    flex-direction: column;
    flex: 1 0 auto; /* Allow growing */
    min-height: 0;
    overflow: visible;
}

/* ==========================================================================
   Severity Summary Stats (for errors/discrepancies tables)
   ========================================================================== */

.severity-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    /* Brand-consistent blue treatment (matches other highlighted UI blocks) */
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-lite-blue) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    flex-shrink: 0;
}

.severity-summary .table-description {
    font-size: 1.1rem;
    color: var(--bg-primary);
    font-weight: 600;
    font-family: var(--font-heading);
    margin: 0;
    padding: 0 0.25rem;
}

.severity-summary .full-review-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.severity-summary .full-review-cta-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.severity-summary .full-review-cta-title {
    color: var(--bg-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.severity-summary .full-review-cta-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.3;
}

.severity-summary .run-full-review-btn {
    flex: 0 0 auto;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.92);
    color: var(--brand-navy);
    font-weight: 800;
    font-family: var(--font-body);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.severity-summary .run-full-review-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    background: #ffffff;
}

.severity-summary .run-full-review-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.severity-filters {
    display: flex;
    gap: 0.75rem;
}

.severity-summary .summary-stat {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    /* Inset "card" look on top of the blue container */
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.severity-summary .summary-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.severity-summary .summary-stat.active {
    background: var(--bg-primary);
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* All - grey by default, white when active with blue border */
.severity-summary .summary-stat.all {
    border-color: var(--border);
}

.severity-summary .summary-stat.all .summary-value,
.severity-summary .summary-stat.all .summary-label {
    color: var(--bg-primary);
}

.severity-summary .summary-stat.all.active {
    background: var(--bg-primary);
    border-color: var(--brand-lite-blue);
}

.severity-summary .summary-stat.all.active .summary-value {
    color: var(--text-primary);
}

/* High - red */
.severity-summary .summary-stat.high {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.severity-summary .summary-stat.high.active {
    background: var(--bg-primary);
}

.severity-summary .summary-stat.high .summary-value {
    color: var(--error);
}

/* Medium - yellow/warning */
.severity-summary .summary-stat.medium {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

.severity-summary .summary-stat.medium.active {
    background: var(--bg-primary);
}

.severity-summary .summary-stat.medium .summary-value {
    color: var(--warning);
}

/* Low - green */
.severity-summary .summary-stat.low {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.severity-summary .summary-stat.low.active {
    background: var(--bg-primary);
}

.severity-summary .summary-stat.low .summary-value {
    color: var(--success);
}

/* Unreviewed - grey */
.severity-summary .summary-stat.unreviewed {
    border-color: #9ca3af;
    background: rgba(156, 163, 175, 0.15);
}

.severity-summary .summary-stat.unreviewed.active {
    background: var(--bg-primary);
}

.severity-summary .summary-stat.unreviewed .summary-value {
    color: #6b7280;
}

.severity-summary .summary-stat.unreviewed.active .summary-value {
    color: var(--text-primary);
}

.severity-summary .summary-stat.unreviewed.active .summary-label {
    color: #6b7280;
}

/* Ignore - muted grey */
.severity-summary .summary-stat.ignore {
    border-color: #6b7280;
    background: rgba(107, 114, 128, 0.15);
}

.severity-summary .summary-stat.ignore.active {
    background: var(--bg-primary);
}

.severity-summary .summary-stat.ignore .summary-value {
    color: #6b7280;
}

.severity-summary .summary-stat.ignore.active .summary-value {
    color: var(--text-primary);
}

.severity-summary .summary-stat.ignore.active .summary-label {
    color: #6b7280;
}

.severity-summary .summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.severity-summary .summary-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* When active (white background), switch label text to the category color */
.severity-summary .summary-stat.all.active .summary-label {
    /* Active ALL tile is white, so label should be dark for readability */
    color: var(--text-primary);
}

.severity-summary .summary-stat.high.active .summary-label {
    color: var(--error);
}

.severity-summary .summary-stat.medium.active .summary-label {
    color: var(--warning);
}

.severity-summary .summary-stat.low.active .summary-label {
    color: var(--success);
}

/* Checklist Summary Stats */
.checklist-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    /* Match errors/discrepancies filter styling */
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-lite-blue) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    flex-shrink: 0;
}

.app-container.mode-results .severity-summary,
.app-container.mode-results .checklist-summary {
    border-top: 2px solid rgba(var(--active-tab-accent-rgb), 0.45);
    box-shadow: 0 10px 24px -20px rgba(var(--active-tab-accent-rgb), 0.9);
}

.checklist-filters {
    display: flex;
    gap: 0.75rem;
}

.checklist-summary .table-description {
    font-size: 1.1rem;
    color: var(--bg-primary);
    font-weight: 600;
    font-family: var(--font-heading);
    margin: 0;
    padding: 0 0.25rem;
}

.checklist-summary .summary-stat {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    /* Match errors/discrepancies filter styling */
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.checklist-summary .summary-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.checklist-summary .summary-stat.active {
    background: var(--bg-primary); /* Go white when selected */
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* "All" (Questions) */
.checklist-summary .summary-stat:first-child.active {
    border-color: var(--brand-lite-blue);
}

.checklist-summary .summary-stat:first-child .summary-value,
.checklist-summary .summary-stat:first-child .summary-label {
    color: var(--bg-primary);
}

.checklist-summary .summary-stat:first-child.active .summary-value {
    color: var(--text-primary);
}

.checklist-summary .summary-stat.yes {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.checklist-summary .summary-stat.yes.active {
    background: var(--bg-primary);
}

.checklist-summary .summary-stat.no {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.checklist-summary .summary-stat.no.active {
    background: var(--bg-primary);
}

.checklist-summary .summary-stat.na {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

.checklist-summary .summary-stat.na.active {
    background: var(--bg-primary);
}

.checklist-summary .summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.checklist-summary .summary-stat.yes .summary-value {
    color: var(--success);
}

.checklist-summary .summary-stat.no .summary-value {
    color: var(--error);
}

.checklist-summary .summary-stat.na .summary-value {
    color: var(--warning);
}

.checklist-summary .summary-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* When active (white background), switch label text to the category color */
.checklist-summary .summary-stat:first-child.active .summary-label {
    color: var(--brand-lite-blue);
}

.checklist-summary .summary-stat.yes.active .summary-label {
    color: var(--success);
}

.checklist-summary .summary-stat.no.active .summary-label {
    color: var(--error);
}

.checklist-summary .summary-stat.na.active .summary-label {
    color: var(--warning);
}

/* Checklist Header Row with Run Button */
.checklist-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Run Checklist Button */
.run-checklist-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f0f4ff 100%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-navy);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.run-checklist-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e0ebff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.run-checklist-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.run-checklist-btn .btn-icon {
    font-size: 0.9rem;
}

/* Additional Information Dropdown (in header) */
.additional-info-dropdown {
    position: relative;
    display: inline-block;
    z-index: 101; /* Ensure dropdown is above other header elements */
}

.additional-info-dropdown.show .export-dropdown-content {
    display: block !important; /* Force display when show class is present */
}

.additional-info-dropdown.show .dropdown-chevron {
    transform: rotate(180deg);
}

/* Ensure dropdown content is visible and positioned correctly */
.additional-info-dropdown .export-dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 102; /* Higher than parent */
}

/* Checklist Views */
.checklist-view {
    margin-top: 0.5rem;
    /* Remove overflow so sticky headers work relative to parent (.left-panel) */
    overflow: visible;
    flex: 1 0 auto; /* Allow growing */
    min-height: 0;
    /* Remove max-height */
    background: var(--brand-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Avoid a visual strip between sticky controls and sticky headers */
.subtabs-sticky ~ .checklist-view {
    margin-top: 0;
}

/* Ensure checklist table headers are sticky below subtabs */
.subtabs-sticky ~ .checklist-view .results-table th,
.subtabs-sticky ~ .checklist-view .checklist-table th {
    position: sticky;
    top: var(--sticky-header-top, 70px); /* Use dynamic height from JS, fallback to dashboard-aligned header height */
    z-index: 10;
    background: #ffffff;
    color: var(--brand-navy);
}

/* Tailoring table - fixed column widths to prevent janky resizing */
#checklistTailoringView .results-table {
    table-layout: fixed;
}

#checklistTailoringView .results-table th:first-child,
#checklistTailoringView .results-table td:first-child {
    width: 30%;
    min-width: 200px;
}

#checklistTailoringView .results-table th:last-child,
#checklistTailoringView .results-table td:last-child {
    width: 70%;
}

/* Ensure text-cell truncation works in tailoring view */
#checklistTailoringView .results-table td.text-cell {
    max-width: 0; /* Force cell to respect table column width for truncation */
}

#checklistTailoringView .results-table td {
    color: var(--brand-navy);
    font-weight: 500;
}

/* Expanded state for tailoring rows */
#checklistTailoringView .results-table tr.expanded td.text-cell {
    max-width: none;
    white-space: normal;
    overflow: visible;
}

#checklistTailoringView .results-table tr.expanded td.text-cell .cell-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

#checklistTailoringView .results-table tr.expanded td {
    max-width: none !important;
}

/* Tailoring Summary Stats (filter buttons) */
.tailoring-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-lite-blue) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    flex-shrink: 0;
}

.tailoring-summary .summary-stat {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tailoring-summary .summary-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tailoring-summary .summary-stat.active {
    background: var(--bg-primary);
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tailoring-summary .summary-stat.included {
    border-color: rgba(52, 211, 153, 0.7);
}

.tailoring-summary .summary-stat.included.active {
    border-color: var(--success);
}

.tailoring-summary .summary-stat.excluded {
    border-color: rgba(226, 232, 240, 0.6);
}

.tailoring-summary .summary-stat.excluded.active {
    border-color: var(--text-muted);
}

.tailoring-summary .summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bg-primary);
    line-height: 1;
    margin-bottom: 0.15rem;
}

.tailoring-summary .summary-stat.included .summary-value {
    color: #34d399;
}

.tailoring-summary .summary-stat.excluded .summary-value {
    color: #e2e8f0;
}

.tailoring-summary .summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tailoring-summary .summary-stat.active .summary-value {
    color: var(--text-primary);
}

.tailoring-summary .summary-stat.active .summary-label {
    color: var(--text-secondary);
}

.tailoring-summary .summary-stat.included.active .summary-value {
    color: var(--success);
}

.tailoring-summary .summary-stat.excluded.active .summary-value {
    color: var(--text-muted);
}

.tailoring-filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: -0.25rem 0 1rem;
}

.tailoring-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(64, 111, 183, 0.28);
    background: #ffffff;
    color: var(--brand-navy);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tailoring-filter-btn:hover {
    border-color: rgba(64, 111, 183, 0.58);
    background: #eef3ff;
}

.tailoring-filter-btn.active {
    border-color: var(--accent);
    background: rgba(233, 86, 35, 0.12);
    color: #992f10;
    box-shadow: 0 2px 8px rgba(233, 86, 35, 0.18);
}

/* Tailoring Actions (re-run/reset buttons) */
.tailoring-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(13, 24, 70, 0.08) 0%, rgba(64, 111, 183, 0.08) 100%);
    border: 1px solid rgba(13, 24, 70, 0.2);
    border-radius: 10px;
    align-items: center;
}

.rerun-tailoring-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-lite-blue) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rerun-tailoring-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 111, 183, 0.35);
}

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

.rerun-tailoring-btn .btn-icon {
    font-size: 0.75rem;
}

.reset-tailoring-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-tailoring-btn:hover:not(:disabled) {
    background: #eef2ff;
    border-color: rgba(13, 24, 70, 0.4);
    color: var(--brand-navy);
}

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

/* Tailoring Confirmation Modal */
.tailoring-modal {
    max-width: 500px;
}

.tailoring-modal-headers {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.5rem;
}

.tailoring-modal-header-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.tailoring-modal-header-item:last-child {
    margin-bottom: 0;
}

.tailoring-modal-header-item .header-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.tailoring-modal-header-item .header-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.modal-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-btn.cancel {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-btn.cancel:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.modal-btn.confirm {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
}

.modal-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.modal-btn .btn-icon {
    font-size: 0.75rem;
}

/* Checklist Processing Banner */
.checklist-processing-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    margin-bottom: 1rem;
    animation: banner-pulse 2s ease-in-out infinite;
}

@keyframes banner-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.checklist-processing-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checklist-processing-banner .banner-spinner {
    font-size: 1.25rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.checklist-processing-banner .banner-text {
    font-weight: 600;
    color: var(--text-primary);
}

.checklist-processing-banner .banner-progress {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tailoring Toggle Switch */
.tailoring-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.tailoring-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.tailoring-toggle .toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 20px;
    transition: all 0.25s ease;
}

.tailoring-toggle .toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tailoring-toggle input:checked + .toggle-slider {
    background: var(--success);
}

.tailoring-toggle input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

.tailoring-toggle .pending-indicator {
    color: var(--warning);
    font-size: 0.75rem;
    animation: pulse-indicator 1.5s infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Tailoring row states */
#checklistTailoringView .results-table tr.tailoring-included {
    background: rgba(16, 185, 129, 0.03);
}

#checklistTailoringView .results-table tr.tailoring-excluded {
    background: rgba(107, 114, 128, 0.03);
}

#checklistTailoringView .results-table tr.has-pending-change {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--warning);
}

#checklistTailoringView .results-table tr.has-pending-change:hover {
    background: rgba(245, 158, 11, 0.12);
}

/* Toggle cell styling */
#checklistTailoringView .results-table .toggle-cell {
    width: 90px;
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem;
}

/* Update tailoring table layout */
#checklistTailoringView .results-table {
    table-layout: fixed;
}

#checklistTailoringView .results-table th:nth-child(1),
#checklistTailoringView .results-table td:nth-child(1) {
    width: 90px;
}

#checklistTailoringView .results-table th:nth-child(2),
#checklistTailoringView .results-table td:nth-child(2) {
    width: 120px;
}

#checklistTailoringView .results-table th:nth-child(3),
#checklistTailoringView .results-table td:nth-child(3) {
    width: 27.5%;
    min-width: 150px;
}

#checklistTailoringView .results-table th:nth-child(4),
#checklistTailoringView .results-table td:nth-child(4) {
    width: auto;
}

/* Checklist Table */
.checklist-table {
    width: 100%;
    min-width: 940px;
    table-layout: fixed; /* Fixed column widths to prevent janky resizing */
    background: #ffffff;
}

.checklist-table th {
    text-align: center;
    vertical-align: middle;
}

.checklist-table td {
    vertical-align: top;
}

.checklist-table .question-cell {
    white-space: normal !important; /* Allow text wrapping */
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Allow tooltip to overflow when row is collapsed */
.results-table td.question-tooltip,
.results-table td.explanation-tooltip,
.results-table td.toc-details-tooltip {
    overflow: visible !important;
}

/* Truncate text content while allowing tooltip to overflow */
.results-table td.question-tooltip .question-text,
.results-table td.explanation-tooltip .explanation-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Allow text wrapping in checklist table question and explanation cells */
.checklist-table td.question-tooltip .question-text,
.checklist-table td.explanation-tooltip .explanation-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Don't truncate when row is expanded */
.results-table tr.expanded td.question-tooltip .question-text,
.results-table tr.expanded td.explanation-tooltip .explanation-text,
.results-table tr.expanded td.toc-details-tooltip .toc-details-text {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    max-width: none;
}

.checklist-table .explanation-cell {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: normal !important; /* Allow text wrapping */
    overflow: visible !important;
    text-overflow: clip !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Make checklist table columns more responsive */
.checklist-table th,
.checklist-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.checklist-table .extracts-cell {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fixed column widths for checklist table to prevent resizing */
/* Column 1: # (row number) */
.checklist-table th:nth-child(1),
.checklist-table td:nth-child(1) {
    width: 3%;
    min-width: 40px;
    max-width: 50px;
    text-align: center;
}

/* Column 2: Checklist Section */
.checklist-table th:nth-child(2),
.checklist-table td:nth-child(2) {
    width: 12%;
    min-width: 120px;
    text-align: left;
}

/* Column 3: Question */
.checklist-table th:nth-child(3),
.checklist-table td:nth-child(3) {
    width: 20%;
    min-width: 180px;
    text-align: left;
}

/* Column 4: Answer */
#checklistResultsView .checklist-table th#checklistAnswerHeader,
#checklistResultsView .checklist-table td.answer-cell {
    width: 7%;
    min-width: 90px;
    max-width: 100px;
    text-align: center;
    white-space: nowrap;
    word-wrap: normal;
    overflow-wrap: normal;
}

#checklistResultsView .checklist-table th#checklistAnswerHeader {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Column 5: Explanation */
.checklist-table th:nth-child(5),
.checklist-table td:nth-child(5) {
    width: 30%;
    min-width: 200px;
    text-align: left;
}

/* Column 6: Relevant Information */
.checklist-table th:nth-child(6),
.checklist-table td:nth-child(6) {
    width: 29%;
    min-width: 200px;
    text-align: left;
}

/* Ensure expanded rows don't break layout */
.checklist-table tr.expanded td {
    max-width: none !important;
    overflow: visible !important;
}

/* Show full text when checklist row is expanded */
.checklist-table tr.expanded .question-text,
.checklist-table tr.expanded .explanation-text {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word;
}

/* Hide tooltips when checklist row is expanded */
.checklist-table tr.expanded .question-tooltip::after,
.checklist-table tr.expanded .explanation-tooltip::after {
    display: none;
}

/* Expanded checklist row background */
.checklist-table tr.expanded {
    background: #fef6f2 !important;
}

.checklist-table tr.expanded td:first-child {
    border-left: 3px solid var(--accent);
}

/* Answer Badges */
.answer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 50px;
}

.answer-badge.yes {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.answer-badge.no {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid var(--error);
}

.answer-badge.na,
.answer-badge.n-a {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.answer-badge.error {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

/* Answer with Confidence Container */
.answer-with-confidence {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Confidence Badge */
.confidence-badge {
    font-size: 0.85rem;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.confidence-badge:hover {
    transform: scale(1.2);
}

.confidence-badge.confidence-high {
    filter: drop-shadow(0 0 3px rgba(16, 185, 129, 0.5));
}

.confidence-badge.confidence-medium {
    filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.5));
}

.confidence-badge.confidence-low {
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.5));
}

/* Pages Cell */
.pages-cell {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-secondary);
    text-align: center;
}

.pages-cell a {
    color: var(--accent-secondary);
    text-decoration: none;
    cursor: pointer;
}

.pages-cell a:hover {
    text-decoration: underline;
}

/* Decision Source Badge (for tailoring table when decision was from TOC) */
.decision-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(107, 114, 128, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Extracts Cell */
.extracts-cell {
    font-size: 0.85rem;
    max-width: 250px !important;
    width: 250px;
    overflow: hidden; /* Keep cell content constrained - tooltips use position:fixed */
}

/* Keep extracts cell constrained even when row is expanded */
.results-table tr.expanded .extracts-cell {
    max-width: 250px !important;
    overflow: hidden;
}

/* Combined Relevant Information Container */
.relevant-info-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 100%;
    overflow: hidden;
}

/* Pages Section (at bottom of relevant info, hidden by default) */
.pages-section {
    display: none; /* Hidden by default when row is collapsed */
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Show pages section when row is expanded */
.results-table tr.expanded .pages-section {
    display: flex;
}

/* Pages toggle button */
.pages-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pages-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-secondary);
    color: var(--text-primary);
}

.pages-btn-icon {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

/* Rotate icon when expanded */
.pages-section.pages-expanded .pages-btn-icon {
    transform: rotate(180deg);
}

/* Pages list (hidden by default, shown when expanded) */
.pages-list {
    display: none;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-top: 0.5rem;
}

/* Show pages list when section is expanded */
.pages-section.pages-expanded .pages-list {
    display: flex;
}

/* Extracts Section (at top, visible when collapsed) */
.extracts-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Hide all extract items except first when row is collapsed */
.extracts-section .extract-item:not(:first-child) {
    display: none;
}

/* Show all extract items when row is expanded */
.results-table tr.expanded .extracts-section .extract-item {
    display: flex;
}

.extract-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0;
    padding: 0.4rem;
    background: var(--bg-hover);
    border-radius: 4px;
    border-left: 2px solid var(--accent-secondary);
}

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

.extract-text {
    flex: 1;
    min-width: 0; /* Required for text-overflow to work in flexbox */
    max-width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Extract text with tooltip - JS checks truncation and adds show-tooltip class */
.extract-text[data-tooltip]::after {
    content: attr(data-tooltip);
    position: fixed;
    background: var(--brand-navy);
    color: var(--text-inverse);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    max-width: 400px;
    white-space: normal;
    word-wrap: break-word;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    top: var(--tooltip-top, 0);
    left: var(--tooltip-left, 0);
}

/* Only show tooltip when JS determines text is truncated */
.extract-text[data-tooltip].show-tooltip::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s 0.5s, visibility 0.2s 0.5s;
}

.extract-text.clickable-extract {
    transition: color 0.2s ease, background-color 0.2s ease;
    padding: 0.2rem 0.4rem;
    margin: -0.2rem -0.4rem;
    border-radius: 3px;
}

.extract-text.clickable-extract:hover {
    color: var(--accent);
    background-color: var(--accent-muted);
    text-decoration: underline;
}

.extract-item .page-number-circle {
    flex-shrink: 0;
}

/* Circular Page Number Style */
.page-number-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-orange);
    color: white !important;
    font-weight: 600;
    font-size: 0.75rem;
    text-decoration: none !important;
    margin: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-number-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(233, 86, 35, 0.4);
    background: var(--accent-hover);
    text-decoration: none !important;
}

/* Page number badge style (matching extraction.html) */
.page-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 50%;
    background: var(--brand-orange);
    color: white !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.page-number-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(233, 86, 35, 0.3);
    background: var(--accent-hover);
}

/* Page column style - minimal width, no truncation */
.results-table td.page-col {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
    text-align: center;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
    overflow: visible;
}

.results-table td.page-col.has-duplicate-toggle {
    white-space: nowrap;
    overflow: hidden;
}

/* Discrepancies table needs a wider pages column for multiple page badges */
.results-table.discrepancy-table td.page-col,
.results-table.discrepancy-table th:first-child {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    padding: 0.45rem 0.5rem;
}

@media (max-width: 1100px) {
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 200px;
    }
}

@media (max-width: 800px) {
    .app-header.header-tabs-visible .app-title .analysis-name {
        max-width: 140px;
    }
}

/* PAGE column header - minimal width to match cells */
/* Target page_number column header specifically */
.results-table th[data-column="page_number"] {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 0.5rem 0.25rem;
}

/* For errors table: first column is always PAGE, make it narrow */
#resultsTable th:first-child[data-column="page_number"] {
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    padding: 0.5rem 0.25rem;
}

/* Ensure page number badge fits without truncation */
.results-table td.page-col .page-number-badge {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Discrepancy pages column - multiple badges */
.results-table td.discrepancy-pages {
    white-space: nowrap;
    position: relative;
    overflow: visible; /* allow page badges to render fully (and scale on hover) */
    text-overflow: clip;
}

.results-table td.discrepancy-pages .discrepancy-pages-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
}

.results-table td.discrepancy-pages .page-separator {
    color: var(--text-secondary);
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1;
    margin: 0; /* spacing is handled by flex gap */
    padding: 0;
    opacity: 0.5;
    position: relative;
}

/* Ensure badges sit above the separator line when hovering/scaling */
.results-table td.discrepancy-pages .page-number-badge {
    position: relative;
    z-index: 1;
}

/* Add a vertical line behind the pipe character */
.results-table td.discrepancy-pages .page-separator::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--text-secondary);
    transform: translateX(-50%);
    opacity: 0.3;
    z-index: -1;
}

/* When row is expanded, stack pages vertically */
.results-table tr.expanded td.discrepancy-pages .discrepancy-pages-wrap {
    flex-direction: column;
    gap: 0.75rem;
}

/* Hide separator when row is expanded (stacking vertically) */
.results-table tr.expanded td.discrepancy-pages .page-separator {
    display: none;
}

/* ========================================
   Reactive Table Cell Styling (matching extraction.html)
   ======================================== */

/* Text cells with truncation and tooltips */
.results-table td.text-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease;
    max-width: 300px; /* Match general table cell max-width for consistency */
}

.results-table td.text-cell:hover {
    background: rgba(233, 86, 35, 0.08);
}

.results-table td.text-cell .cell-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.results-table td.text-cell .reason-cell-inline {
    display: block;
    min-width: 0;
}

.reason-insufficient-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    border: 1px solid #f5cf7a;
    background: #fff4d6;
    color: #7a4d00;
    font-size: 0.72rem;
    line-height: 1;
    cursor: help;
}

.results-table tr.expanded td.text-cell .reason-cell-inline .cell-text {
    display: inline;
}

.results-table tr.expanded td.text-cell .reason-insufficient-indicator {
    display: inline-flex;
    margin-left: 0.35rem;
    vertical-align: text-bottom;
}

/* Blue tooltip for text cells - shown only when JS detects overflow */
.results-table td.text-cell::after {
    content: attr(data-full-text);
    position: fixed;
    background: var(--brand-navy);
    color: var(--text-inverse);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    max-width: 400px;
    white-space: normal;
    word-wrap: break-word;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    pointer-events: none;
    /* Position will be set dynamically via CSS custom properties */
    top: var(--tooltip-top, auto);
    left: var(--tooltip-left, auto);
    right: var(--tooltip-right, auto);
    bottom: var(--tooltip-bottom, auto);
}

/* Show tooltip only when JS adds .show-tooltip class (text is truncated) */
.results-table td.text-cell.show-tooltip::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s 0.5s, visibility 0.2s 0.5s;
}

/* Hide tooltip when row is expanded */
.results-table tr.expanded td.text-cell::after {
    display: none;
}

/* Don't truncate when row is expanded */
.results-table tr.expanded td.text-cell {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
}

.results-table tr.expanded td.text-cell .cell-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

/* Expanded Row Styles */
.results-table tr.expanded {
    background: #fef6f2;
}

.results-table tr.expanded td {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
    padding: 1rem;
    line-height: 1.6;
    vertical-align: top;
    color: var(--brand-navy);
    border-top: 1px solid var(--border);
}

.results-table tr.expanded td:first-child {
    border-left: 3px solid var(--accent);
    padding-left: calc(1rem - 3px);
}

.results-table tr.expanded td:last-child {
    border-right: 1px solid var(--border);
}

/* Selected row style */
.results-table tr.selected {
    background: #e8f1ff;
    border-left: 4px solid #2f62ad;
    box-shadow: inset 0 0 0 1px rgba(47, 98, 173, 0.22);
}

.results-table tr.selected td {
    background: #e8f1ff;
}

.results-table tr.selected td:first-child {
    padding-left: calc(0.85rem - 4px);
}

.results-table tbody.review-focus-active tr.clickable.selected {
    opacity: 1;
    background: #deebff;
    border-left: 4px solid #2f62ad;
    box-shadow: inset 0 0 0 1px rgba(47, 98, 173, 0.3);
}

.results-table tbody.review-focus-active tr.clickable.selected td {
    background: #deebff;
}

.results-table tbody.review-focus-active tr.clickable.selected td:first-child {
    padding-left: calc(0.85rem - 4px);
}

.results-table tr.selected td.text-cell:not(.fact-cell):not(.clickable-text):not(.field-cell):hover,
.results-table tbody.review-focus-active tr.clickable.selected td.text-cell:not(.fact-cell):not(.clickable-text):not(.field-cell):hover {
    background: transparent;
}

.results-table tbody.review-focus-active tr.clickable:not(.selected) {
    background: #f5f7fb;
    opacity: 0.92;
}

.results-table tbody.review-focus-active tr.clickable:not(.selected):hover {
    background: #edf1f8;
    opacity: 1;
}

.results-table tbody.review-focus-active tr.clickable:not(.selected).tooltip-active,
.results-table tbody.review-focus-active tr.clickable:not(.selected):has(td.text-cell.show-tooltip) {
    opacity: 1;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0.5rem;
}

.table-action-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.review-progress-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 190px;
    padding: 0.4rem 0.7rem;
    border: 1px solid rgba(64, 111, 183, 0.2);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.review-progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-navy);
    line-height: 1.2;
    white-space: nowrap;
}

.review-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(64, 111, 183, 0.16);
    overflow: hidden;
}

.review-progress-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #406fb7 0%, #2a9d8f 100%);
    transition: width 0.2s ease;
}

.table-search-input {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    background: #ffffff;
    color: var(--text-primary);
    width: min(200px, 100%);
    transition: all 0.2s ease;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #ffffff;
}

.table-search-input::placeholder {
    color: var(--text-secondary);
}


.expand-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
    border: 1px solid rgba(64, 111, 183, 0.25);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-navy);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-all-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
    border-color: rgba(64, 111, 183, 0.6);
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(64, 111, 183, 0.2);
}

.expand-all-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.expand-all-btn:disabled:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
    border-color: rgba(64, 111, 183, 0.25);
    color: var(--brand-navy);
}

.expand-all-btn.expanded {
    background: linear-gradient(180deg, rgba(64, 111, 183, 0.18) 0%, rgba(64, 111, 183, 0.08) 100%);
    border-color: rgba(64, 111, 183, 0.7);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(64, 111, 183, 0.25);
}

.expand-all-btn .expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.expand-all-btn .expand-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.expand-all-btn .expand-label {
    white-space: nowrap;
}

/* Re-run Button */
.rerun-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
    border: 1px solid rgba(64, 111, 183, 0.25);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-navy);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.rerun-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
    border-color: rgba(64, 111, 183, 0.6);
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(64, 111, 183, 0.2);
}

.rerun-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rerun-btn .rerun-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* Show Completed Toggle Button */
.show-reviewed-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
    border: 1px solid rgba(64, 111, 183, 0.25);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brand-navy);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
}

.show-reviewed-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
    border-color: rgba(64, 111, 183, 0.6);
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(64, 111, 183, 0.2);
}

.show-reviewed-btn.active {
    background: linear-gradient(180deg, rgba(64, 111, 183, 0.18) 0%, rgba(64, 111, 183, 0.08) 100%);
    border-color: rgba(64, 111, 183, 0.7);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(64, 111, 183, 0.25);
}

.show-reviewed-btn .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.show-reviewed-btn .toggle-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.show-reviewed-btn .toggle-label {
    white-space: nowrap;
}

/* Color coding for reviewed rows (light background) */
.results-table tbody tr.reviewed-row {
    background-color: rgba(233, 86, 35, 0.03);
    opacity: 0.85;
}

.results-table tbody tr.reviewed-row:hover {
    background-color: rgba(233, 86, 35, 0.06);
    opacity: 0.95;
}

.results-table tbody tr.reviewed-row td {
    color: rgba(13, 24, 70, 0.7);
}

.results-table tbody tr.group-child-row td {
    background: rgba(64, 111, 183, 0.03);
    border-left: 3px solid rgba(64, 111, 183, 0.25);
}

.results-table tbody tr.group-parent-row .duplicate-toggle-btn {
    display: none;
}

.results-table tbody tr.group-root-cause-parent.expanded td {
    background: rgba(233, 86, 35, 0.05);
}

.results-table tbody tr.group-parent-row.expanded .duplicate-toggle-btn {
    display: inline-flex;
}

.root-cause-group-badge {
    display: none;
    align-items: center;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(233, 86, 35, 0.4);
    background: rgba(233, 86, 35, 0.12);
    color: #b84f22;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.results-table tbody tr.group-root-cause-parent.expanded .root-cause-group-badge {
    display: inline-flex;
}

.duplicate-toggle-btn {
    margin-left: 0.5rem;
    padding: 0.15rem 0.45rem;
    border: 1px solid rgba(64, 111, 183, 0.35);
    border-radius: 999px;
    background: rgba(64, 111, 183, 0.08);
    color: #264a82;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.duplicate-toggle-btn:hover {
    background: rgba(64, 111, 183, 0.14);
}

.results-table tbody tr.group-parent-row.expanded td.page-col.has-duplicate-toggle .duplicate-toggle-btn {
    display: flex;
    margin: 0.3rem auto 0;
    width: fit-content;
    min-width: 32px;
    max-width: 100%;
    padding: 0.2rem 0.3rem;
    line-height: 1.1;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
}

/* Tailoring View */
.tailoring-intro {
    padding: 1rem 1.5rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.tailoring-intro p {
    color: #92400e;
    margin: 0;
    font-size: 0.95rem;
}

/* Header Cell in Checklist */
.header-cell {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Subheading Rows - White background to differentiate from main headers */
.results-table tr.subheading-row,
.checklist-table tr.subheading-row {
    background: var(--brand-white) !important;
    border-top: 2px solid var(--border);
}

.results-table tr.subheading-row:hover,
.checklist-table tr.subheading-row:hover {
    background: #f8f9fa !important;
}

/* Question, Explanation, and TOC Details Tooltips */
.question-tooltip,
.explanation-tooltip,
.toc-details-tooltip {
    position: relative;
    cursor: help;
    overflow: visible !important;
}

.question-tooltip::after,
.explanation-tooltip::after,
.toc-details-tooltip::after {
    content: attr(data-tooltip);
    position: fixed;
    background: var(--brand-navy);
    color: var(--text-inverse);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    max-width: 400px;
    white-space: normal;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    /* Position will be set dynamically via CSS custom properties */
    top: var(--tooltip-top, auto);
    left: var(--tooltip-left, auto);
    right: var(--tooltip-right, auto);
    bottom: var(--tooltip-bottom, auto);
}

.question-tooltip:hover::after,
.explanation-tooltip:hover::after,
.toc-details-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s 0.5s, visibility 0.2s 0.5s;
}

/* Hide tooltips when scrolling */
body.is-scrolling .question-tooltip:hover::after,
body.is-scrolling .explanation-tooltip:hover::after,
body.is-scrolling .toc-details-tooltip:hover::after,
body.is-scrolling .show-tooltip::after {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important;
}

/* Only show tooltip when JS determines text is truncated (checklist table uses text-cell pattern) */
.checklist-table td.text-cell.show-tooltip::after {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s 0.5s, visibility 0.2s 0.5s;
}

/* Checklist table uses .show-tooltip instead of :hover */
.checklist-table td.text-cell::after {
    content: attr(data-full-text);
    position: fixed;
    background: var(--brand-navy);
    color: var(--text-inverse);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    max-width: 400px;
    white-space: normal;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    top: var(--tooltip-top, auto);
    left: var(--tooltip-left, auto);
    right: var(--tooltip-right, auto);
    bottom: var(--tooltip-bottom, auto);
}

.checklist-table td.text-cell .cell-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide tooltips when row is expanded (except extract tooltips which should always show) */
.results-table tr.expanded .question-tooltip::after,
.results-table tr.expanded .explanation-tooltip::after,
.results-table tr.expanded .toc-details-tooltip::after {
    display: none;
}

/* Hide text-cell tooltips when row is expanded in checklist table */
.checklist-table tr.expanded td.text-cell::after {
    display: none;
}

/* TOC Details cell truncation */
.toc-details-tooltip .toc-details-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Checklist Processing Progress */
.checklist-progress {
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin: 1rem 0;
}

.checklist-progress h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.checklist-progress .progress-bar-container {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.checklist-progress .progress-bar {
    height: 100%;
    background: var(--accent-secondary);
    transition: width 0.3s ease;
}

.checklist-progress .progress-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* TOC Row Hover */
.toc-row:hover {
    background: var(--bg-hover);
}

/* Checklist Start Button */
.checklist-start-container {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin: 1rem 0;
}

.checklist-start-container h3 {
    margin-bottom: 0.75rem;
}

.checklist-start-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.checklist-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: var(--accent-secondary);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checklist-start-btn:hover {
    background: #3560a0;
    transform: translateY(-2px);
}

.checklist-start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 24, 70, 0.7);
    z-index: 1000;
    overflow-y: auto;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow);
    margin: 0 auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.header-confirmation-dialog {
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

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

/* Header Confirmation Controls */
.header-confirmation-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.checklist-confirm-view {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 260px);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.checklist-confirm-header h3 {
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.checklist-confirm-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.checklist-confirm-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.checklist-confirm-search-wrap {
    flex: 1 1 340px;
}

.checklist-confirm-search-wrap .table-search-input {
    width: 100%;
}

.checklist-confirm-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.checklist-confirm-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    padding: 0.6rem;
    padding-bottom: 1.1rem;
}

.checklist-confirm-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 0.6rem;
}

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

.checklist-confirm-item.selected {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 1px rgba(64, 111, 183, 0.15);
}

.checklist-confirm-check {
    margin-top: 0.15rem;
}

.checklist-confirm-body {
    flex: 1;
    min-width: 0;
}

.checklist-confirm-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.45rem;
}

.checklist-confirm-title {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.checklist-confirm-count {
    font-size: 0.78rem;
    color: #1f2f4d;
    font-weight: 600;
}

.checklist-confirm-explanation {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #24324b;
    line-height: 1.4;
}

.checklist-confirm-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.checklist-confirm-badge {
    display: inline-block;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
}

.checklist-confirm-badge.ai-include,
.checklist-confirm-badge.prior-include {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.checklist-confirm-badge.ai-exclude,
.checklist-confirm-badge.prior-exclude {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.checklist-confirm-badge.diff {
    background: rgba(245, 158, 11, 0.18);
    color: #92400e;
}

.checklist-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
    position: sticky;
    bottom: calc(-1rem + env(safe-area-inset-bottom, 0px));
    z-index: 12;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--border);
    padding: 0.75rem 0 0.2rem;
    backdrop-filter: blur(4px);
}

#confirmHeaderSelectionPage {
    background: linear-gradient(180deg, var(--accent) 0%, #cf4619 100%);
    border: 1px solid #b53d16;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(233, 86, 35, 0.28);
}

#confirmHeaderSelectionPage:hover:not(:disabled) {
    background: linear-gradient(180deg, #f46e3f 0%, var(--accent) 100%);
    border-color: #cf4619;
    transform: translateY(-1px);
}

@media (max-width: 800px) {
    .checklist-confirm-view {
        min-height: 60vh;
        padding: 0.75rem;
    }

    .checklist-confirm-footer {
        flex-direction: column;
        bottom: calc(-0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .checklist-confirm-footer .btn-secondary,
    .checklist-confirm-footer .btn-primary {
        width: 100%;
    }
}

/* Shared Confirmation Dialog */
.confirm-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
    z-index: 5500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.confirm-dialog-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-dialog {
    width: min(860px, 96vw);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: #ffffff;
    color: var(--text-primary);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.2);
    padding: 1.5rem 1.7rem;
    transform: translateY(8px) scale(0.985);
    transition: transform 0.15s ease;
}

.confirm-dialog-overlay.active .confirm-dialog {
    transform: translateY(0) scale(1);
}

.confirm-dialog-title {
    margin: 0;
    font-size: 2.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.confirm-dialog-message {
    margin: 1rem 0 1.6rem;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-line;
}

.confirm-dialog-input {
    width: 100%;
    margin: 0 0 1.2rem;
    padding: 0.72rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-body);
}

.confirm-dialog-input:focus {
    outline: none;
    border-color: rgba(233, 86, 35, 0.7);
    box-shadow: 0 0 0 3px rgba(233, 86, 35, 0.14);
}

.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
}

.confirm-dialog-btn {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.6rem 1.2rem;
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.confirm-dialog-btn:focus-visible {
    outline: 2px solid rgba(233, 86, 35, 0.5);
    outline-offset: 2px;
}

.confirm-dialog-btn.cancel {
    background: #ffffff;
    color: var(--text-primary);
}

.confirm-dialog-btn.cancel:hover {
    border-color: #b8c4d6;
    background: #f8fafc;
}

.confirm-dialog-btn.confirm {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.confirm-dialog-btn.confirm:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.confirm-dialog-btn.confirm.warning {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.confirm-dialog-btn.confirm.warning:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.confirm-dialog-btn.confirm.danger {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.confirm-dialog-btn.confirm.danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

@media (max-width: 640px) {
    .confirm-dialog {
        width: 100%;
        border-radius: 14px;
        padding: 1.05rem;
    }

    .confirm-dialog-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .confirm-dialog-btn {
        font-size: 0.98rem;
    }

    .confirm-dialog-title {
        font-size: 1.35rem;
    }
}

/* Header List */
.header-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.5rem;
}

.header-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.header-item:hover {
    border-color: var(--accent-secondary);
    background: var(--bg-hover);
}

.header-item.selected {
    border-color: var(--accent-secondary);
    background: rgba(64, 111, 183, 0.05);
}

.header-checkbox {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-secondary);
}

.header-details {
    flex: 1;
}

.header-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.header-explanation {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.header-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.header-badge.include {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.header-badge.exclude {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* Button Styles */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--accent-secondary);
    color: var(--text-inverse);
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #3560a0;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--accent-secondary);
    background: var(--bg-hover);
}

.btn-danger {
    padding: 0.6rem 1.2rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ==========================================================================
   PDF Panel Close/Show Toggle
   ========================================================================== */

/* Close Button in PDF Header */
.pdf-close-btn {
    position: absolute;
    top: 0.35rem;
    right: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.pdf-close-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Show PDF Toggle Button */
.show-pdf-toggle {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: var(--brand-navy);
    border: 2px solid var(--accent);
    border-radius: 12px;
    color: white;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(233, 86, 35, 0.3);
    z-index: 100;
    writing-mode: horizontal-tb;
}

.show-pdf-toggle:hover {
    background: var(--accent);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 28px rgba(233, 86, 35, 0.45);
}

.show-pdf-toggle .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.show-pdf-toggle .toggle-icon svg {
    width: 22px;
    height: 22px;
}

.show-pdf-toggle .toggle-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.05em;
}

/* Hide close button when panel is minimized */
.right-panel.minimized .pdf-close-btn {
    display: none;
}

/* Animation for toggle button appearance */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.show-pdf-toggle.visible {
    animation: slideInRight 0.3s ease forwards;
}


/* ==========================================================================
   Prior Year Review Section
   ========================================================================== */

.prior-year-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
}

/* Upload Section */
.prior-year-upload {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.prior-year-upload .upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 4rem;
    border: 2px dashed var(--border);
    border-radius: 16px;
    background: var(--bg-hover);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 500px;
    width: 100%;
}

.prior-year-upload .upload-zone:hover,
.prior-year-upload .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-muted);
}

.prior-year-upload .upload-icon {
    font-size: 4rem;
    opacity: 0.7;
}

.prior-year-upload h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.prior-year-upload p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.prior-year-upload .upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.prior-year-upload .upload-btn {
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prior-year-upload .upload-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.prior-year-upload .prior-year-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.prior-year-upload .upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.prior-year-upload .upload-btn svg {
    flex-shrink: 0;
}

.prior-year-upload .upload-divider {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.prior-year-upload .companies-house-btn {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.prior-year-upload .companies-house-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.prior-year-upload .companies-house-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.prior-year-upload .spinner-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Processing Section */
.prior-year-processing {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

.prior-year-processing .processing-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-hover);
    border-radius: 12px;
}

.prior-year-processing .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.prior-year-processing h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.prior-year-processing p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.prior-year-processing .progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.prior-year-processing .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.prior-year-processing .processing-logs {
    max-height: 200px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--brand-navy);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #a0d0a0;
}

.prior-year-processing .processing-logs .log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.prior-year-processing .processing-logs .log-entry:last-child {
    border-bottom: none;
}

.prior-year-processing .processing-logs .log-timestamp {
    color: #888;
    margin-right: 0.5rem;
}

.prior-year-processing .processing-logs .log-error {
    color: #ff6b6b;
}

/* Results Section */
.prior-year-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prior-year-summary {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-hover);
    border-radius: 12px;
}

.app-container.mode-results #priorYearContainer .prior-year-summary {
    border-top: 2px solid rgba(var(--active-tab-accent-rgb), 0.35);
    box-shadow: 0 8px 20px -18px rgba(var(--active-tab-accent-rgb), 0.9);
}

.prior-year-summary .summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
}

.prior-year-summary .summary-stat .summary-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.prior-year-summary .summary-stat .summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prior-year-summary .summary-stat.discrepancy .summary-value {
    color: var(--error);
}

.prior-year-summary .clear-btn {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.prior-year-summary .clear-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Prior Year Sub-tabs */
.prior-year-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.prior-year-subtabs .sub-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.prior-year-subtabs .sub-tab:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.prior-year-subtabs .sub-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}

/* Prior Year Facts Table */
.prior-year-facts-table td {
    vertical-align: top;
    padding: 0.75rem 1rem;
}

.prior-year-facts-table .id-cell {
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    width: 60px;
}

.prior-year-facts-table .page-cell {
    font-weight: 500;
    text-align: center;
    width: 80px;
    cursor: pointer;
}

.prior-year-facts-table .page-cell:hover {
    color: var(--accent);
}

.prior-year-facts-table .fact-cell {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.prior-year-facts-table tr.clickable-row:hover {
    background: var(--accent-muted);
}

.prior-year-facts-table tr.clickable-row:hover .page-cell {
    color: var(--accent);
}

/* Prior Year Results Table */
.prior-year-table td {
    vertical-align: top;
    padding: 1rem;
}

.prior-year-table .pages-cell {
    white-space: nowrap;
    font-weight: 500;
    text-align: center;
    min-width: 80px;
}

.prior-year-table .fact-cell {
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.prior-year-table .fact-cell:hover {
    background: var(--accent-muted);
}

.prior-year-table .fact-cell .fact-source {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prior-year-table .fact-cell .fact-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.prior-year-table .explanation-cell {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    min-width: 250px;
}

.prior-year-table .severity-cell {
    text-align: center;
    min-width: 100px;
}

.prior-year-table .severity-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prior-year-table .severity-badge.high {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.prior-year-table .severity-badge.medium {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-secondary);
}

.prior-year-table .severity-badge.low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

/* Error Section */
.prior-year-error {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.prior-year-error .error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 3rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 12px;
    text-align: center;
}

.prior-year-error .error-icon {
    font-size: 2.5rem;
}

.prior-year-error p {
    font-size: 0.95rem;
    color: var(--error);
    max-width: 400px;
}

.prior-year-error .retry-btn {
    padding: 0.5rem 1.5rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prior-year-error .retry-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* =============================================================================
   Bucket Matcher - Merged Data Table Styles
   ============================================================================= */

/* Relationship badge */
.relationship-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--accent-muted);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.pair-view-switcher {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(14, 165, 233, 0.18);
    background: var(--bg-primary);
}

.pair-view-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 999px;
    border: 1px solid rgba(14, 165, 233, 0.22);
    background: var(--bg-primary);
}

.pair-view-tab {
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.36rem 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pair-view-tab:hover {
    color: var(--accent);
    background: var(--accent-muted);
}

.pair-view-tab.active {
    color: var(--accent);
    border-color: rgba(14, 165, 233, 0.35);
    background: rgba(14, 165, 233, 0.16);
}

.pair-view-tab:focus-visible {
    outline: 2px solid rgba(14, 165, 233, 0.4);
    outline-offset: 1px;
}

.audit-table-container {
    padding: 0;
    background: var(--bg-primary);
}

.audit-view-wrapper {
    padding: 1rem;
    --audit-separator-color: rgba(14, 165, 233, 0.16);
    --audit-section-bg: rgba(14, 165, 233, 0.06);
}

.audit-controls {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: nowrap;
    margin-bottom: 0.75rem;
}

.audit-column-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1 1 560px;
    min-width: 0;
    max-width: none;
}

.audit-column-select-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.audit-column-select {
    flex: 1 1 340px;
    min-width: 240px;
    min-height: 2.35rem;
    border: 1px solid var(--audit-separator-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.25rem;
}

.audit-column-select option {
    padding: 0.25rem 0.4rem;
}

.audit-column-select-summary {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.audit-view-wrapper .select2-container {
    width: auto !important;
    min-width: 240px;
    flex: 1 1 340px;
}

.audit-view-wrapper .select2-container--default .select2-selection--multiple {
    min-height: 2.35rem;
    border: 1px solid var(--audit-separator-color);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 0.2rem;
}

.audit-view-wrapper .select2-container--default .select2-selection--multiple .select2-search__field {
    font-size: 0.78rem;
    color: var(--text-primary);
}

.audit-view-wrapper .select2-container--default .select2-selection--multiple .select2-selection__choice {
    border: 1px solid rgba(14, 165, 233, 0.45);
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
}

.audit-view-wrapper .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--accent);
    margin-right: 0.25rem;
}

.audit-view-wrapper .select2-container--default:not(.select2-container--open) .select2-selection--multiple .select2-selection__choice {
    display: none;
}

.audit-view-wrapper .select2-container--default:not(.select2-container--open) .select2-selection--multiple .select2-search {
    display: none;
}

.audit-view-wrapper .select2-container--default:not(.select2-container--open) .select2-selection--multiple .select2-selection__rendered {
    min-height: 1.1rem;
}

.audit-section-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.6rem;
    flex: 0 0 auto;
}

.audit-summary-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.audit-sections-toggle-all-btn {
    border: 1px solid var(--audit-separator-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.1;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.audit-sections-toggle-all-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.audit-data-table-scroll {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--audit-separator-color);
}

.audit-data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.84rem;
}

.audit-data-table th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--audit-separator-color);
    white-space: nowrap;
}

.audit-data-table .audit-group-header-row th {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    border-bottom: 1px solid var(--audit-separator-color);
    background: var(--audit-section-bg);
}

.audit-data-table .audit-group-header-row th.audit-group-key {
    background: var(--bg-primary);
}

.audit-data-table .audit-group-header-row th.audit-group-a {
    background: rgba(14, 165, 233, 0.08);
}

.audit-data-table .audit-group-header-row th.audit-group-b {
    background: rgba(139, 92, 246, 0.08);
}

.audit-data-table .audit-group-header-row th.audit-group-diff {
    background: rgba(245, 158, 11, 0.12);
}

.audit-data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--audit-separator-color);
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.audit-data-table td.audit-value-cell {
    text-align: right;
    font-family: var(--font-mono);
}

.audit-data-table td.audit-data-cell {
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.audit-data-table td.audit-data-cell:hover {
    box-shadow: inset 0 0 0 1px rgba(var(--match-highlight-rgb), 0.45);
}

.audit-data-table td.audit-diff-cell {
    font-family: var(--font-mono);
}

.audit-data-table td.audit-diff-positive {
    color: var(--success);
}

.audit-data-table td.audit-diff-negative {
    color: var(--error);
}

.audit-section-row td {
    padding: 0;
    border-bottom: 1px solid var(--audit-separator-color);
    background: var(--audit-section-bg);
}

.audit-data-table tbody tr.audit-section-row.audit-section-boundary td {
    border-top: 2px solid rgba(14, 165, 233, 0.34);
}

.audit-section-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.48rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.audit-section-toggle-btn:hover {
    color: var(--accent);
    background: rgba(14, 165, 233, 0.08);
}

.audit-section-count {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    color: var(--text-secondary);
    background: rgba(14, 165, 233, 0.12);
}

.audit-row-only-a td {
    background: var(--bg-primary);
}

.audit-row-only-b td {
    background: var(--bg-primary);
}

.audit-data-table th.line-detail-control-col {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    text-align: center;
    vertical-align: middle;
}

.audit-data-table td.line-detail-control-cell {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    text-align: center;
    padding: 0.4rem 0.45rem;
}

.audit-data-table tbody tr.line-detail-parent-expanded td {
    border-bottom-color: transparent;
}

.audit-data-table tbody tr.line-detail-parent-expanded td.line-detail-control-cell {
    border-bottom-color: transparent;
}

.audit-data-table tbody tr.line-detail-spill-row td {
    background: var(--bg-primary);
    border-bottom: 1px dashed var(--audit-separator-color);
}

.audit-data-table tbody tr.line-detail-spill-row.group-start td {
    border-top: 1px dashed var(--audit-separator-color);
}

.audit-data-table tbody tr.line-detail-spill-row.group-end td,
.audit-data-table tbody tr.line-detail-spill-row.group-single td {
    border-bottom: 2px solid var(--audit-separator-color);
}

.audit-data-table tbody tr.line-detail-spill-row td.line-detail-control-cell.spill {
    border-left: 3px solid var(--audit-separator-color);
}

.audit-data-table tbody tr.line-detail-spill-row.matched td.line-detail-control-cell.spill {
    border-left-color: rgba(16, 185, 129, 0.75);
}

.audit-data-table tbody tr.line-detail-spill-row.unmatched-a td.line-detail-control-cell.spill {
    border-left-color: rgba(14, 165, 233, 0.75);
}

.audit-data-table tbody tr.line-detail-spill-row.unmatched-b td.line-detail-control-cell.spill {
    border-left-color: rgba(139, 92, 246, 0.75);
}

.audit-data-table td.line-detail-spill-cell.line-detail-na-cell {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

@media (max-width: 1200px) {
    .audit-controls {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .audit-column-select-wrap {
        flex: 1 1 100%;
    }

    .audit-section-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .audit-summary-text {
        white-space: normal;
    }
}

@media (max-width: 900px) {
    .audit-section-controls {
        align-items: flex-start;
    }
}

/* Container for merged table */
.merged-table-container {
    padding: 0;
    background: var(--bg-secondary);
}

.merged-data-wrapper {
    padding: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.legend-dot.key {
    background: #6366f1;
}

.legend-dot.dataset-a {
    background: #0ea5e9;
}

.legend-dot.dataset-b {
    background: #8b5cf6;
}

.legend-dot.diff {
    background: #f59e0b;
}

.legend-dot.matching {
    background: #e95623;
}

.merged-column-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
}

.merged-column-filters-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.merged-role-filter-btn,
.merged-row-filter-btn {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.1;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.merged-role-filter-btn:hover,
.merged-row-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-muted);
}

.merged-role-filter-btn.active,
.merged-row-filter-btn.active {
    background: rgba(14, 165, 233, 0.16);
    border-color: rgba(14, 165, 233, 0.45);
    color: var(--accent);
}

.merged-role-filter-btn:focus-visible,
.merged-row-filter-btn:focus-visible {
    outline: 2px solid rgba(14, 165, 233, 0.35);
    outline-offset: 1px;
}

.merged-column-filter-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.merged-inline-legend {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.merged-column-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.merged-row-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.export-merged-table-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.export-merged-table-btn .export-icon {
    width: 0.95rem;
    height: 0.95rem;
    fill: currentColor;
}

.merged-data-table-empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    font-size: 0.85rem;
    font-style: italic;
}

@media (max-width: 900px) {
    .merged-inline-legend {
        width: 100%;
        gap: 0.75rem;
    }

    .merged-column-actions {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .merged-column-filter-count {
        text-align: right;
        width: 100%;
    }
}

/* Scrollable table container */
.merged-data-table-scroll {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Main table */
.merged-data-table {
    --line-detail-col-width: 96px;
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    min-width: 600px;
}

/* Group header row (overarching headers) */
.merged-data-table .group-header-row th {
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    border-bottom: 2px solid var(--border);
}

.merged-data-table .group-header.key-group {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
}

.merged-data-table .group-header.line-detail-group {
    position: sticky;
    left: 0;
    z-index: 7;
    width: var(--line-detail-col-width);
    min-width: var(--line-detail-col-width);
    max-width: var(--line-detail-col-width);
    box-sizing: border-box;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
}

.merged-data-table .group-header.dataset-a-group {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
}

.merged-data-table .group-header.dataset-b-group {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
}

.merged-data-table .group-header.diff-group {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* Column header row */
.merged-data-table .column-header-row th {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    max-width: 200px;
    overflow: hidden;
}

.merged-data-table .column-header-row th .column-header-content {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    max-width: 100%;
    vertical-align: middle;
}

.merged-data-table .column-header-row th .column-header-label {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.merged-data-table .column-header-row th.key-col {
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
}

.merged-data-table .column-header-row th.dataset-a-col {
    background: var(--bg-primary);
}

.merged-data-table .column-header-row th.dataset-b-col {
    background: var(--bg-primary);
}

.merged-data-table .column-header-row th.diff-col {
    background: var(--bg-primary);
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.25;
}

.merged-data-table .column-header-row th.matching-column {
    box-shadow: inset 0 -2px 0 rgba(var(--match-highlight-rgb), 0.6);
}

.matching-column-badge {
    display: inline-block;
    flex-shrink: 0;
    margin-left: 0.35rem;
    padding: 0.08rem 0.34rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--match-highlight-rgb), 0.45);
    background: rgba(var(--match-highlight-rgb), 0.14);
    color: #0f766e;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}

.merged-data-table .column-header-row th.line-detail-control-col {
    position: sticky;
    left: 0;
    z-index: 6;
    width: var(--line-detail-col-width);
    min-width: var(--line-detail-col-width);
    max-width: var(--line-detail-col-width);
    box-sizing: border-box;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
    overflow: hidden;
    text-align: center;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
}

/* Data cells */
.merged-data-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.merged-data-table tbody td.line-detail-control-cell {
    position: sticky;
    left: 0;
    z-index: 5;
    width: var(--line-detail-col-width);
    min-width: var(--line-detail-col-width);
    max-width: var(--line-detail-col-width);
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    padding: 0.35rem 0.4rem;
}

.merged-data-table tbody td.key-col {
    background: var(--bg-primary);
    font-weight: 500;
    border-right: 1px solid var(--border);
}

.merged-data-table tbody td.dataset-a-col {
    background: var(--bg-primary);
}

.merged-data-table tbody td.dataset-b-col {
    background: var(--bg-primary);
}

.merged-data-table tbody td.diff-col {
    background: var(--bg-primary);
    font-weight: 500;
    font-family: var(--font-mono);
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    text-align: right;
}

.merged-data-table tbody td.diff-col.diff-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: normal;
    text-align: left;
    line-height: 1.35;
}

.merged-data-table tbody td.matching-column-cell {
    background-image: linear-gradient(
        180deg,
        rgba(var(--match-highlight-rgb), 0.06),
        rgba(var(--match-highlight-rgb), 0.06)
    );
}

.merged-data-table tbody td.merged-data-cell {
    cursor: pointer;
    transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.merged-data-table tbody td.merged-data-cell:hover {
    box-shadow: inset 0 0 0 1px rgba(var(--match-highlight-rgb), 0.45);
}

.merged-data-table tbody td.matching-column-cell.merged-data-cell:hover {
    box-shadow: inset 0 0 0 1px rgba(var(--match-highlight-rgb), 0.6);
}

.merged-data-table tbody td.merged-data-cell.selected {
    box-shadow: inset 0 0 0 2px rgba(var(--match-highlight-rgb), 0.7);
}

.merged-data-table tbody td.matching-column-cell.merged-data-cell.selected {
    box-shadow: inset 0 0 0 2px rgba(var(--match-highlight-rgb), 0.8);
}

.merged-data-table tbody tr.selected td {
    background-color: transparent !important;
}

/* Difference highlighting */
.merged-data-table tbody td.diff-positive {
    background: transparent !important;
    color: #ef4444;
}

.merged-data-table tbody td.diff-negative {
    background: transparent !important;
    color: #10b981;
}

/* Row styling based on match status */
.merged-data-table tbody tr.row-only-a {
    background: transparent;
}

.merged-data-table tbody tr.row-only-a td {
    opacity: 1;
}

.merged-data-table tbody tr.row-only-b {
    background: transparent;
}

.merged-data-table tbody tr.row-only-b td {
    opacity: 1;
}

.merged-data-table tbody tr.merged-bucket-boundary td {
    border-top: 2px solid rgba(14, 165, 233, 0.3);
}

.line-detail-toggle-btn {
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(29, 78, 216, 0.24));
    color: #1e3a8a;
    border-radius: 999px;
    width: 1.7rem;
    min-width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(15, 23, 42, 0.18);
    line-height: 1;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.line-detail-toggle-btn:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.26), rgba(29, 78, 216, 0.3));
    transform: translateY(-1px);
}

.line-detail-toggle-btn:active {
    transform: translateY(0);
}

.line-detail-toggle-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.65);
    outline-offset: 2px;
}

.line-detail-toggle-icon {
    width: 0.82rem;
    height: 0.82rem;
    transition: transform 0.16s ease;
}

.line-detail-toggle-icon path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-detail-toggle-btn.is-expanded .line-detail-toggle-icon {
    transform: rotate(90deg);
}

.line-detail-header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
}

.line-detail-header-title {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
}

.line-detail-expand-all-btn {
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.16rem 0.56rem;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    max-width: 100%;
}

.line-detail-expand-all-btn:hover:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.45);
    color: #1e3a8a;
    background: rgba(59, 130, 246, 0.08);
}

.line-detail-expand-all-btn.active {
    border-color: rgba(59, 130, 246, 0.45);
    color: #1e3a8a;
    background: rgba(59, 130, 246, 0.12);
}

.line-detail-expand-all-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.line-detail-control-cell.spill {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.line-detail-control-cell.spill.matched {
    color: var(--text-muted);
}

.line-detail-control-cell.spill.unmatched-a {
    color: var(--text-muted);
}

.line-detail-control-cell.spill.unmatched-b {
    color: var(--text-muted);
}

.merged-data-table tbody tr.line-detail-spill-row td {
    background: var(--bg-primary);
    border-bottom: 1px dashed var(--border);
}

.merged-data-table tbody tr.line-detail-spill-row.matched td {
    background: var(--bg-primary);
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-a td {
    background: var(--bg-primary);
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-b td {
    background: var(--bg-primary);
}

.merged-data-table tbody tr.line-detail-spill-row.group-start td {
    border-top: 2px solid var(--border);
}

.merged-data-table tbody tr.line-detail-spill-row.group-end td,
.merged-data-table tbody tr.line-detail-spill-row.group-single td {
    border-bottom: 2px solid var(--border);
}

.merged-data-table tbody tr.line-detail-spill-row td.line-detail-control-cell.spill {
    border-left: 3px solid var(--border);
}

.merged-data-table tbody tr.line-detail-spill-row.matched td.line-detail-control-cell.spill {
    border-left-color: rgba(16, 185, 129, 0.75);
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-a td.line-detail-control-cell.spill {
    border-left-color: rgba(14, 165, 233, 0.75);
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-b td.line-detail-control-cell.spill {
    border-left-color: rgba(139, 92, 246, 0.75);
}

.merged-data-table tbody tr.line-detail-spill-row td.line-detail-spill-cell {
    opacity: 1;
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-a td.dataset-b-col {
    opacity: 1;
}

.merged-data-table tbody tr.line-detail-spill-row.unmatched-b td.dataset-a-col {
    opacity: 1;
}

.merged-data-table tbody tr.line-detail-spill-row td.line-detail-na-cell {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

.merged-data-table tbody tr.line-detail-parent-expanded td {
    border-bottom-color: transparent;
}

.merged-data-table tbody tr.line-detail-parent-expanded td.line-detail-control-cell {
    border-bottom-color: transparent;
}

.line-detail-expanded-row td {
    padding: 0.5rem 0.75rem 0.9rem 0.75rem !important;
    background: rgba(64, 111, 183, 0.05);
    border-bottom: 1px solid var(--border);
}

.line-detail-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    padding: 0.75rem;
}

.line-detail-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}

.line-detail-chip {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.line-detail-block {
    margin-top: 0.6rem;
}

.line-detail-block h5 {
    font-size: 0.76rem;
    font-weight: 700;
    margin: 0 0 0.35rem 0;
    color: var(--text-primary);
}

.line-detail-unmatched-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.line-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.line-detail-table th,
.line-detail-table td {
    border: 1px solid var(--border);
    padding: 0.28rem 0.4rem;
    text-align: left;
    vertical-align: top;
}

.line-detail-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 700;
}

.line-detail-table td {
    color: var(--text-primary);
}

.line-detail-empty {
    color: var(--text-muted);
    font-style: italic;
}

.line-detail-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.5rem;
    padding: 0.12rem 0.3rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.line-detail-status.exact {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.line-detail-status.close {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.line-detail-status.mismatch {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

@media (max-width: 1000px) {
    .line-detail-unmatched-grid {
        grid-template-columns: 1fr;
    }
}

/* Hover state */
.merged-data-table tbody tr:hover {
    background: transparent;
}

.merged-data-table tbody tr:hover td {
    background: inherit;
}

.merged-data-table tbody tr:hover td.line-detail-control-cell,
.merged-data-table tbody tr.selected td.line-detail-control-cell {
    background: var(--bg-primary) !important;
}

/* More rows indicator */
.merged-data-table .more-rows-indicator td {
    text-align: center;
    padding: 1rem;
    font-style: italic;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

/* View merged data button */
.view-merged-data-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-merged-data-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.view-merged-data-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Vertical separator between Bucket A and Bucket B columns */
.merged-data-table th.bucket-split-col,
.merged-data-table td.bucket-split-col,
.merged-data-table .group-header.bucket-split-group,
.audit-data-table th.bucket-split-col,
.audit-data-table td.bucket-split-col,
.audit-data-table .audit-group-header-row th.bucket-split-group {
    border-right: 2px solid rgba(14, 165, 233, 0.45);
}

/* Review Status and Commentary Styles */
.review-status-cell {
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem;
    width: 140px;
    min-width: 120px;
}

.review-status-select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.review-status-select:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.review-status-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Review status option colors */

.commentary-cell {
    padding: 0.5rem;
    vertical-align: top;
    min-width: 200px;
    max-width: 300px;
}

.commentary-input {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
}

.commentary-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.commentary-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.commentary-readonly {
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-height: 40px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.commentary-readonly.commentary-empty {
    color: var(--text-muted);
    font-style: italic;
}

.reviewer-commentary {
    background: #f8f9fa;
    border-color: var(--accent);
}

.reviewer-commentary:focus {
    background: #fff;
    border-color: var(--accent);
}

/* Reviewer dropdown styles */
.reviewer-dropdown {
    position: relative;
    display: inline-block;
}

.reviewer-dropdown .export-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    padding: 0.25rem;
}

.reviewer-dropdown.show .export-dropdown-content {
    display: block;
}

.reviewer-dropdown .reviewer-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.reviewer-dropdown .reviewer-option:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.reviewer-dropdown .reviewer-option.active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 500;
}

.reviewer-dropdown .reviewer-option svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Review Status Badge (shown in severity column) */
.review-status-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.review-status-badge.review-status-agree,
.review-status-badge.review-status-actioned {
    background: #d4edda;
    color: #155724;
}

.review-status-badge.review-status-disagree {
    background: #fee2e2;
    color: #dc2626;
}

.review-status-badge.review-status-flag {
    background: #fef3c7;
    color: #b45309;
}

.review-status-badge.review-status-ignore {
    background: #e5e7eb;
    color: #4b5563;
}

.review-status-badge.review-status-unreviewed {
    background: #ffffff;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

.error-decision-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.error-decision-badge.error-decision-insufficient {
    background: #fff4d6;
    color: #7a4d00;
    border: 1px solid #f5cf7a;
}

/* Expandable Review Details Section */
.review-details-row {
    background: #ffffff;
}

.review-details-row td {
    border-left: 3px solid #406fb7;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.review-details-cell {
    padding: 0.4rem 1rem 0.4rem calc(1rem - 3px) !important;
    background: #ffffff;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.review-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.review-section {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.review-section:first-child {
    flex: 0 0 auto;
}

.review-section:last-child {
    flex: 1 1 0%;
    min-width: 0;
}

.review-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
}

.review-status-select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 130px;
    transition: all 0.2s ease;
}

.review-status-select option {
    background: white;
    color: var(--text-primary);
}

.review-status-select:hover {
    border-color: var(--accent);
    background: #fafbfc;
}

.review-status-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
    background: white;
}

/* Quick Status Buttons (matches Action View) */
.quick-status-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
}

.status-shortcuts-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.35rem;
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-shortcuts-hint .kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.2rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.64rem;
    line-height: 1;
}

.quick-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.3rem 0.55rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    width: 100%;
}

.quick-status-btn:hover {
    transform: translateY(-1px);
}

.quick-status-buttons:not(.has-selection) .quick-status-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.quick-status-btn.active {
    border-width: 2px;
}

.quick-status-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Accept - Green */
.quick-status-btn[data-status="Accept"],
.quick-status-btn[data-status="Actioned"] {
    border-color: #22c55e;
    color: #16a34a;
    background: #f0fdf4;
}
.quick-status-buttons:not(.has-selection) .quick-status-btn[data-status="Accept"]:hover,
.quick-status-btn[data-status="Accept"].active,
.quick-status-buttons:not(.has-selection) .quick-status-btn[data-status="Actioned"]:hover,
.quick-status-btn[data-status="Actioned"].active {
    background: #dcfce7;
    border-color: #16a34a;
}

/* Reject - Red */
.quick-status-btn[data-status="Reject"] {
    border-color: #ef4444;
    color: #dc2626;
    background: #fef2f2;
}
.quick-status-buttons:not(.has-selection) .quick-status-btn[data-status="Reject"]:hover,
.quick-status-btn[data-status="Reject"].active {
    background: #fee2e2;
    border-color: #dc2626;
}

/* Flag for Manager - Amber */
.quick-status-btn[data-status="Flag"] {
    border-color: #f59e0b;
    color: #b45309;
    background: #fffbeb;
}
.quick-status-buttons:not(.has-selection) .quick-status-btn[data-status="Flag"]:hover,
.quick-status-btn[data-status="Flag"].active {
    background: #fef3c7;
    border-color: #b45309;
}

/* Ignore - Gray */
.quick-status-btn[data-status="Ignore"] {
    border-color: #9ca3af;
    color: #6b7280;
    background: #f3f4f6;
}
.quick-status-buttons:not(.has-selection) .quick-status-btn[data-status="Ignore"]:hover,
.quick-status-btn[data-status="Ignore"].active {
    background: #e5e7eb;
    border-color: #6b7280;
}

.quick-status-buttons.has-selection .quick-status-btn:not(.active) {
    opacity: 0.42;
    filter: saturate(0.72);
}

.commentary-input.flag-comment-required {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.16);
}

.flag-comment-error {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #b91c1c;
}

.commentary-input {
    flex: 1 1 0%;
    min-width: 0;
    height: 28px;
    max-height: 80px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease;
    line-height: 1.4;
    overflow-y: auto;
    box-sizing: border-box;
}

.commentary-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
    background: white;
}

.commentary-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.commentary-display {
    padding: 0.35rem 0.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 180px;
    max-width: 350px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

.commentary-display strong {
    display: inline;
    margin-right: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.commentary-display span {
    display: inline;
    color: var(--text-muted);
    font-style: italic;
}

.reviewer-commentary {
    background: white;
    border-color: var(--accent);
}

.reviewer-commentary:focus {
    background: white;
    border-color: var(--accent);
}

/* Reviewer view visual indicator */

body.reviewer-mode .results-table thead {
    background: linear-gradient(to bottom, #fef3c7 0%, #fde68a 100%);
}

body.reviewer-mode .results-table thead th {
    color: #92400e;
    font-weight: 600;
}

body.reviewer-mode .review-details-cell {
    background: #fef3c7;
}

body.reviewer-mode #reviewerToggleBtn {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

body.reviewer-mode #reviewerToggleBtn:hover {
    background: #fde68a;
    border-color: #d97706;
}

/* ============================================================================
   Background Processing Indicator (Checklist-First Mode)
   ============================================================================ */

.background-processing-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--brand-navy);
    color: var(--text-inverse);
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInUp 0.3s ease-out;
}

.background-processing-indicator.fade-out {
    animation: fadeOutDown 0.3s ease-out forwards;
}

.background-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--brand-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.background-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.background-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.background-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Disabled tabs while full review is running */
.tab-disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.tab-disabled::after {
    content: '...';
    margin-left: 4px;
}

/* Background complete notification */
.background-complete-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInUp 0.3s ease-out;
}

.background-complete-notification.fade-out {
    animation: fadeOutDown 0.3s ease-out forwards;
}

.notification-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.notification-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.notification-subtitle {
    font-size: 0.75rem;
    opacity: 0.9;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(20px);
        opacity: 0;
    }
}
