/* Custom CSS for Cas-ProClassifier */

/* Top Progress Bar (replaces old full-screen page loader) */
#top-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--warning-color));
    box-shadow: 0 0 8px rgba(105, 8, 21, 0.6);
    z-index: 9999;
    transition: width 0.25s ease;
}
#top-progress.done {
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}

:root {
    --primary-color: #690815;      /* deep burgundy */
    --secondary-color: #4a0510;    /* darker burgundy — hover/active */
    --success-color: #690815;      /* burgundy — Cas / completed / pass */
    --info-color: #fde68a;          /* amber-200 */
    --warning-color: #f59e0b;       /* amber-500 */
    --danger-color: #dc2626;
    --dark-color: #1f2937;          /* slate-800 */
    --light-color: #fffbeb;         /* amber-50 */
    --bs-primary: #690815;
    --bs-primary-rgb: 105, 8, 21;
    --bs-secondary: #4a0510;
    --bs-secondary-rgb: 74, 5, 16;
    --bs-success: #690815;
    --bs-success-rgb: 105, 8, 21;
    --bs-info: #fde68a;
    --bs-info-rgb: 253, 230, 138;
    --bs-warning: #f59e0b;
    --bs-warning-rgb: 245, 158, 11;
    --bs-danger: #dc2626;
    --bs-danger-rgb: 220, 38, 38;
    --bs-light: #fffbeb;
    --bs-light-rgb: 255, 251, 235;
    --bs-dark: #1f2937;
    --bs-dark-rgb: 31, 41, 55;
}

/* Bootstrap Color Overrides */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: white !important;
}

.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--info-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--dark-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.navbar-dark .navbar-brand,
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.92) !important;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: #fff !important;
}

/* PRO badge in navbar brand */
.navbar .brand-badge {
    background: var(--info-color);
    color: var(--dark-color);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 0.25em 0.55em;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.bg-success {
    background-color: var(--success-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-info {
    background-color: var(--info-color) !important;
    color: var(--dark-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--dark-color) !important;
}

.badge.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.spinner-border.text-primary {
    color: var(--primary-color) !important;
}

.card-header.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Global Styles */
body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    padding-top: 76px;
    background-color: #fffaf1;
}

.section-padding {
    padding: 80px 0;
}

.section-header h2 {
    position: relative;
    margin-bottom: 1rem;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--warning-color));
    border-radius: 2px;
}

/* Navigation Styles */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem !important;
}

.navbar-nav .nav-link:hover {
    color: var(--info-color) !important;
}

.navbar-nav .nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background-color: var(--info-color);
    border-radius: 1px;
    animation: slideIn 0.3s ease;
}

.navbar-nav .nav-link.active {
    color: var(--info-color) !important;
    border-radius: 0.375rem;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    border-radius: 1px;
}

@keyframes slideIn {
    from {
        width: 0%;
    }
    to {
        width: 80%;
    }
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #1f2937;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><pattern id="grain" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="50" cy="50" r="1" fill="%23690815" opacity="0.15"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
}

.hero-content {
    position: relative;
    z-index: 2;
}

.feature-highlights .feature-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.hero-visual {
    position: relative;
    z-index: 2;
}

.analysis-preview .card {
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
}

.analysis-preview .card:hover {
    transform: rotate(0deg) scale(1.02);
}

.sequence-display {
    background: var(--info-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    border: 1px solid var(--warning-color);
}

.stat-item .stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-item .stat-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* Form Styles */
.card {
    border: 1px solid #f3e8d6;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(105, 8, 21, 0.15) !important;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(105, 8, 21, 0.25);
}

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Analysis Options */
.analysis-options {
    background: var(--info-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--warning-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Results Section */
.table-hover tbody tr:hover {
    background-color: rgba(105, 8, 21, 0.1);
}

.badge {
    font-size: 0.9rem;
    padding: 0.5em 0.8em;
}

#processingIndicator .spinner-border {
    animation: spin 1s linear infinite;
}

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

/* Progress Animation */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* Documentation */
.list-group-item {
    border: none;
    border-radius: 0.5rem !important;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background-color: var(--info-color);
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.tab-content .card {
    border-radius: 1rem;
}

.citation-box {
    border-left: 4px solid var(--primary-color);
}

/* Contact Section */
.contact-item {
    transition: transform 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-10px);
}

.contact-icon {
    transition: transform 0.3s ease;
}

.contact-item:hover .contact-icon {
    transform: scale(1.2);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .section-padding {
        padding: 60px 0;
    }

    .hero-buttons .btn {
        margin-bottom: 1rem;
        width: 100%;
    }

    .analysis-preview .card {
        transform: none;
        margin-top: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-content h1 {
        font-size: 2rem;
    }

    .display-5 {
        font-size: 2rem;
    }

    .section-padding {
        padding: 40px 0;
    }

    .card-body {
        padding: 1.5rem;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Scroll Animation */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease;
}

.scroll-animate.active {
    opacity: 1;
    transform: translateY(0);
}

/* Chart Container */
#summaryChart {
    max-height: 200px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Print Styles */
@media print {
    .navbar,
    .hero-section,
    #contact,
    footer {
        display: none;
    }

    body {
        padding-top: 0;
    }

    .section-padding {
        padding: 20px 0;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .hero-section {
        background: #000;
        color: #fff;
    }

    .card {
        border: 2px solid #000;
    }

    .btn-primary {
        background-color: #1f2937;
        border-color: #1f2937;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Analysis & Batch page components (redesign)
   ========================================================================== */

/* Page hero banner (compact) */
.page-hero {
    background: linear-gradient(135deg, var(--dark-color) 0%, #374151 100%);
    color: #fff;
    padding: 3rem 0 2.5rem;
    position: relative;
    overflow: hidden;
}
.page-hero::after {
    content: '';
    position: absolute;
    right: -80px; top: -80px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(105,8,21,.45), transparent 70%);
    border-radius: 50%;
}
.page-hero h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}
.page-hero .hero-sub {
    color: rgba(255,255,255,0.75);
    margin-bottom: 0;
    max-width: 640px;
}
.page-hero .hero-eyebrow {
    display: inline-block;
    background: rgba(253,230,138,0.18);
    color: var(--info-color);
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* Stat chip strip under hero */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: -2.25rem;
    position: relative;
    z-index: 3;
}
.stat-chip {
    background: #fff;
    border: 1px solid #f3e8d6;
    border-radius: 14px;
    padding: 1rem 1.25rem;
    box-shadow: 0 6px 18px rgba(31,41,55,0.08);
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.stat-chip .chip-ico {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--info-color), #fde68a);
    color: var(--secondary-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.stat-chip .chip-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0;
}
.stat-chip .chip-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

/* Segmented input-method control (replaces btn-group look) */
.seg-control {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    width: 100%;
    gap: 4px;
}
.seg-control .btn-check + .btn {
    flex: 1;
    border: none !important;
    background: transparent !important;
    color: #6b7280 !important;
    border-radius: 9px !important;
    padding: 0.55rem 0.75rem !important;
    font-weight: 500;
    transition: all 0.2s ease;
}
.seg-control .btn-check:checked + .btn {
    background: #fff !important;
    color: var(--primary-color) !important;
    box-shadow: 0 2px 6px rgba(31,41,55,0.08);
}

/* Feature toggle cards */
.feature-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}
.feature-card {
    position: relative;
    background: #fff;
    border: 1.5px solid #f3e8d6;
    border-radius: 12px;
    padding: 1rem 1rem 1rem 3rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.feature-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(105,8,21,0.1);
}
.feature-card .form-check-input {
    position: absolute;
    left: 1rem;
    top: 1.05rem;
    margin: 0;
}
.feature-card .feat-title {
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    font-size: 0.95rem;
}
.feature-card .feat-desc {
    font-size: 0.78rem;
    color: #6b7280;
    margin: 0.2rem 0 0;
    line-height: 1.35;
}
.feature-card:has(.form-check-input:checked) {
    border-color: var(--primary-color);
    background: linear-gradient(180deg, #fffbeb 0%, #fff 50%);
}

/* Side tips panel */
.side-tips {
    background: #fff;
    border: 1px solid #f3e8d6;
    border-radius: 14px;
    padding: 1.25rem;
    position: sticky;
    top: 92px;
}
.side-tips h6 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.side-tips h6 i {
    color: var(--primary-color);
}
.tip-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tip-list li {
    font-size: 0.85rem;
    color: #4b5563;
    padding: 0.45rem 0 0.45rem 1.5rem;
    position: relative;
    border-bottom: 1px dashed #f3e8d6;
}
.tip-list li:last-child { border-bottom: none; }
.tip-list li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0.55rem;
    font-size: 0.75rem;
}

/* Prominent Analyze card */
.analyze-card {
    border: 1px solid #f3e8d6 !important;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(31,41,55,0.06);
}
.analyze-card .card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--warning-color)) !important;
    border-bottom: none;
    padding: 1.1rem 1.5rem;
}
.analyze-card .card-header h4,
.analyze-card .card-header h5 { color: #fff; margin: 0; font-weight: 600; }

/* Upload dropzone refresh (batch) */
.upload-zone {
    background: #fffbeb;
    border: 2px dashed var(--warning-color) !important;
    border-radius: 14px !important;
    transition: all 0.2s ease;
    padding: 2.5rem 1.5rem !important;
}
.upload-zone:hover,
.upload-zone.dragover {
    background: #fef3c7;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px);
}
.upload-zone i.fa-cloud-upload-alt {
    background: linear-gradient(135deg, var(--primary-color), var(--warning-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

/* Stepper navigation (replaces batch sidebar) */
.step-nav {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 14px;
    padding: 0.5rem;
    border: 1px solid #f3e8d6;
    overflow-x: auto;
    box-shadow: 0 4px 14px rgba(31,41,55,0.04);
}
.step-nav .step {
    flex: 1;
    min-width: 160px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 10px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.step-nav .step:hover {
    background: #fffbeb;
    color: var(--secondary-color);
}
.step-nav .step.active {
    background: linear-gradient(135deg, var(--primary-color), var(--warning-color));
    color: #fff;
    box-shadow: 0 4px 10px rgba(105,8,21,0.35);
}
.step-nav .step .step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #f3f4f6;
    color: var(--dark-color);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.step-nav .step.active .step-num {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* Job status pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-pill::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status-pill.status-completed { background: #fdfaf3; color: #4a0510; }
.status-pill.status-processing { background: #fef3c7; color: #4a0510; }
.status-pill.status-failed { background: #fee2e2; color: #b91c1c; }
.status-pill.status-queued { background: #e0e7ff; color: #4338ca; }

/* Result summary stat card */
.result-stat {
    background: #fff;
    border: 1px solid #f3e8d6;
    border-radius: 14px;
    padding: 1.25rem;
    text-align: center;
}
.result-stat .big-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}
.result-stat .small-label {
    font-size: 0.78rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 0.35rem;
}

/* Sample-file quick buttons */
.sample-btn {
    background: #fff;
    border: 1px solid var(--info-color);
    color: var(--secondary-color);
    text-align: left;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.sample-btn:hover {
    background: var(--info-color);
    border-color: var(--primary-color);
    color: var(--dark-color);
}

/* Results table header */
.results-table thead {
    background: linear-gradient(135deg, var(--dark-color), #374151);
    color: #fff;
}
.results-table thead th { border: none; padding: 0.9rem 1rem; font-weight: 500; }

/* ==========================================================================
   Workbench layout (analysis / batch pages)
   ========================================================================== */

.wb-wrap {
    background: #f7f2ea;
    min-height: calc(100vh - 76px);
    padding: 2rem 0 8rem;
}

/* Workbench title bar */
.wb-titlebar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0 0 1.5rem;
    border-bottom: 1px solid #eadfd0;
    margin-bottom: 2rem;
}
.wb-titlebar .crumb {
    font-size: 0.8rem;
    color: #6b7280;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.wb-titlebar .crumb i { color: var(--primary-color); }
.wb-titlebar h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0.2rem 0 0;
    letter-spacing: -0.3px;
}
.wb-titlebar .wb-meta {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.wb-meta .pill {
    background: #fff;
    border: 1px solid #eadfd0;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.78rem;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.wb-meta .pill i { color: var(--primary-color); font-size: 0.75rem; }

/* Numbered workflow panel */
.panel {
    background: #fff;
    border: 1px solid #eadfd0;
    border-radius: 18px;
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    position: relative;
    transition: box-shadow 0.25s ease;
}
.panel:hover { box-shadow: 0 12px 30px rgba(31,41,55,0.06); }
.panel-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #eadfd0;
}
.panel-num {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    width: 46px; height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(105,8,21,0.25);
}
.panel-title h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--dark-color);
}
.panel-title p {
    margin: 0.1rem 0 0;
    color: #6b7280;
    font-size: 0.85rem;
}
.panel-action { margin-left: auto; }

/* Live-preview side pane (analysis page) */
.live-preview {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: #fff;
    border-radius: 18px;
    padding: 1.5rem;
    position: sticky;
    top: 92px;
    overflow: hidden;
}
.live-preview::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(105,8,21,0.55), transparent 70%);
    border-radius: 50%;
}
.live-preview h6 {
    position: relative;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.live-preview h6::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #a31621;
    box-shadow: 0 0 0 4px rgba(163,22,33,0.30);
    animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 4px rgba(163,22,33,0.30); }
    50%      { box-shadow: 0 0 0 7px rgba(163,22,33,0.12);  }
}
.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    position: relative;
    z-index: 1;
}
.preview-stat {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.85rem;
}
.preview-stat .label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}
.preview-stat .val {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin: 0.2rem 0 0;
    font-variant-numeric: tabular-nums;
}
.preview-stat .val small {
    font-size: 0.7rem;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    margin-left: 0.2rem;
}
.fasta-snippet {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    background: #0b1220;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #cbd5e1;
    min-height: 120px;
    max-height: 180px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
.fasta-snippet .hdr { color: var(--info-color); font-weight: 600; }
.fasta-snippet .empty { color: rgba(255,255,255,0.3); font-style: italic; }
.validity {
    position: relative;
    z-index: 1;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    background: rgba(255,255,255,0.04);
}
.validity .dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #6b7280;
}
.validity.ok   .dot { background: #a31621; box-shadow: 0 0 0 3px rgba(163,22,33,.30); }
.validity.warn .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.25); }

/* Sticky bottom action bar */
.action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.96);
    backdrop-filter: saturate(180%) blur(8px);
    border-top: 1px solid #eadfd0;
    padding: 0.85rem 0;
    z-index: 500;
    box-shadow: 0 -6px 18px rgba(31,41,55,0.06);
}
.action-bar .bar-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.action-bar .bar-left {
    flex: 1;
    color: #6b7280;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.action-bar .bar-left i { color: var(--primary-color); }
.action-bar .btn { min-width: 130px; }

/* Inline segmented switch (smaller variant for panels) */
.seg-inline {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}
.seg-inline .btn-check + .btn {
    border: none !important;
    background: transparent !important;
    color: #6b7280 !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.9rem !important;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}
.seg-inline .btn-check:checked + .btn {
    background: var(--dark-color) !important;
    color: #fff !important;
}

/* Sequence textarea styling inside panel */
.seq-editor {
    border: 1px solid #eadfd0 !important;
    border-radius: 12px !important;
    font-size: 0.85rem !important;
    line-height: 1.55 !important;
    background: #fffdf9 !important;
    padding: 1rem !important;
    resize: vertical;
}
.seq-editor:focus {
    border-color: var(--primary-color) !important;
    background: #fff !important;
    box-shadow: 0 0 0 0.2rem rgba(105,8,21,0.12) !important;
}

/* Parameter chips */
.param-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: #fff;
    border: 1.5px solid #eadfd0;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s ease;
}
.param-chip input { display: none; }
.param-chip i.fa-circle-check { color: #cbd5e1; font-size: 1rem; }
.param-chip:has(input:checked) {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    color: #fff;
}
.param-chip:has(input:checked) i.fa-circle-check { color: var(--info-color); }
.param-chip:hover { border-color: var(--primary-color); }

/* Mini-sidebar nav for workbench steps */
.wb-side-nav {
    background: #fff;
    border: 1px solid #eadfd0;
    border-radius: 14px;
    padding: 0.5rem;
    position: sticky;
    top: 92px;
}
.wb-side-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.wb-side-nav a .num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wb-side-nav a:hover { background: #fffaf1; color: var(--primary-color); }
.wb-side-nav a.active {
    background: var(--dark-color);
    color: #fff;
}
.wb-side-nav a.active .num { background: var(--primary-color); color: #fff; }

/* Kanban job card feed (batch results) */
.job-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.job-card-item {
    background: #fff;
    border: 1px solid #eadfd0;
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.job-card-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--primary-color);
}
.job-card-item.completed::before  { background: #690815; }
.job-card-item.processing::before { background: var(--warning-color); }
.job-card-item.failed::before     { background: #dc2626; }
.job-card-item.queued::before     { background: #6366f1; }
.job-card-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(31,41,55,0.08);
}
.jc-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.jc-id {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.jc-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.05rem;
    margin: 0.3rem 0 0.75rem;
}
.jc-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    margin: 0.6rem 0 1rem;
}
.jc-meta-item {
    font-size: 0.78rem;
    color: #6b7280;
}
.jc-meta-item strong {
    display: block;
    color: var(--dark-color);
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.1rem;
}
.jc-actions {
    display: flex;
    gap: 0.4rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #eadfd0;
}
.jc-actions .btn { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

/* Drop-zone — bigger, more prominent for workbench batch */
.dropzone-xl {
    position: relative;
    border: 2px dashed #cbb890;
    border-radius: 18px;
    background: repeating-linear-gradient(45deg, #fffbf2, #fffbf2 12px, #fff8ea 12px, #fff8ea 24px);
    padding: 3rem 1.5rem;
    text-align: center;
    transition: all 0.25s ease;
}
.dropzone-xl:hover,
.dropzone-xl.dragover {
    border-color: var(--primary-color);
    background: #fffdf9;
    transform: scale(1.01);
}
.dropzone-xl .dz-icon {
    width: 72px; height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 20px rgba(105,8,21,0.25);
}

/* Selected-files list as row items */
.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: #fffdf9;
    border: 1px solid #eadfd0;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
}
.file-item i.fa-file { color: var(--primary-color); }
.file-item .file-size {
    margin-left: auto;
    color: #6b7280;
    font-size: 0.8rem;
}

/* Summary ring (results empty-state alternative) */
.empty-results {
    text-align: center;
    padding: 4rem 1rem;
    background: #fff;
    border: 1px dashed #eadfd0;
    border-radius: 18px;
}
.empty-results .empty-icon {
    width: 88px; height: 88px;
    border-radius: 28px;
    background: linear-gradient(135deg, #fffaf1, #fef3c7);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 1.25rem;
}
.empty-results h3 {
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}
.empty-results p {
    color: #6b7280;
    max-width: 420px;
    margin: 0 auto;
}

/* Stat tile with accent bar (results) */
.stat-tile {
    background: #fff;
    border: 1px solid #eadfd0;
    border-radius: 16px;
    padding: 1.25rem 1.4rem;
    position: relative;
    overflow: hidden;
}
.stat-tile::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 4px; width: 60%;
    background: linear-gradient(90deg, var(--primary-color), var(--warning-color));
    border-radius: 0 4px 0 0;
}
.stat-tile .st-label {
    font-size: 0.72rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0;
}
.stat-tile .st-value {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1;
    margin: 0.4rem 0 0;
    font-variant-numeric: tabular-nums;
}
.stat-tile .st-sub {
    font-size: 0.78rem;
    color: #9ca3af;
    margin: 0.3rem 0 0;
}

/* Remove body padding for workbench pages — use .wb-wrap's own padding */
body.wb-body { background: #f7f2ea; }

@media (max-width: 991px) {
    .live-preview, .wb-side-nav { position: static; }
    .action-bar .bar-left { display: none; }
}

/* Success/Error States */
.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.valid-feedback {
    color: var(--success-color);
}

.invalid-feedback {
    color: var(--danger-color);
}

/* ==========================================================================
   LAB-NOTEBOOK layer — activated by body.lab on analysis + batch pages
   Brutalist, editorial, sharp-cornered. Grid-paper canvas, serif headlines,
   monospace UI chrome, thick rules instead of shadows.
   ========================================================================== */

body.lab {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: #f4ede1;
    background-image:
        linear-gradient(to right, rgba(105,8,21,0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(105,8,21,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    color: #1a0306;
}

/* Canvas — full-bleed, no rounded card look */
body.lab .wb-wrap {
    background: transparent;
    padding: 0;
    min-height: calc(100vh - 76px);
}

/* Brutalist shell — thick outer frame */
.lab-shell {
    max-width: 1440px;
    margin: 0 auto;
    background: #fdfaf3;
    border-left: 2px solid #1a0306;
    border-right: 2px solid #1a0306;
    min-height: calc(100vh - 76px);
    position: relative;
}
.lab-shell::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    background-image:
        linear-gradient(to right, rgba(105,8,21,0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(105,8,21,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}
.lab-shell > * { position: relative; z-index: 1; }

/* Top masthead — editorial newspaper vibe */
.lab-masthead {
    border-bottom: 2px solid #1a0306;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    background: #1a0306;
    color: #fdfaf3;
}
.lab-masthead .stamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--info-color);
    display: inline-block;
    border: 1.5px solid var(--info-color);
    padding: 0.25rem 0.7rem;
    margin-bottom: 0.75rem;
}
.lab-masthead h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: clamp(2.4rem, 4vw, 3.4rem);
    line-height: 0.95;
    letter-spacing: -1px;
    margin: 0;
    color: #fdfaf3;
}
.lab-masthead h1 em {
    font-style: italic;
    font-weight: 400;
    color: var(--info-color);
}
.lab-masthead .byline {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(253,250,243,0.6);
    margin: 0.5rem 0 0;
}
.lab-masthead .meta-rail {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(253,250,243,0.75);
    text-align: right;
    line-height: 1.9;
}
.lab-masthead .meta-rail b { color: var(--info-color); font-weight: 600; }
.lab-masthead .meta-rail .dot { color: var(--primary-color); margin: 0 0.35rem; }

/* Grid body */
.lab-body {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    min-height: 70vh;
}
@media (max-width: 1199px) {
    .lab-body { grid-template-columns: 200px 1fr; }
    .lab-body .lab-side-right { display: none; }
}
@media (max-width: 767px) {
    .lab-body { grid-template-columns: 1fr; }
    .lab-body .lab-side-left { display: none; }
}

.lab-side-left,
.lab-side-right {
    border-right: 2px solid #1a0306;
    padding: 2rem 1.25rem;
    font-family: 'IBM Plex Mono', monospace;
}
.lab-side-right {
    border-right: none;
    border-left: 2px solid #1a0306;
    background: #1a0306;
    color: #fdfaf3;
    position: sticky;
    top: 76px;
    align-self: start;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
}
.lab-side-left {
    position: sticky;
    top: 76px;
    align-self: start;
    background: #fdfaf3;
}

/* Step list — ASCII outline */
.lab-toc {
    list-style: none;
    padding: 0;
    margin: 0;
}
.lab-toc li {
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.55rem 0;
    border-bottom: 1px dashed rgba(105,8,21,0.25);
    color: #4a0510;
    display: flex;
    gap: 0.6rem;
    cursor: pointer;
    transition: padding-left 0.15s ease;
}
.lab-toc li:hover { padding-left: 0.4rem; color: var(--primary-color); }
.lab-toc li .tic {
    color: var(--primary-color);
    font-weight: 700;
    width: 1.5rem;
    flex-shrink: 0;
}
.lab-toc li.on {
    background: var(--primary-color);
    color: #fdfaf3;
    padding: 0.55rem 0.4rem;
    margin: 0 -0.4rem;
    border-bottom-color: var(--primary-color);
}
.lab-toc li.on .tic { color: var(--info-color); }

.side-caption {
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #7b1e30;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1.5px solid #1a0306;
}
.lab-side-right .side-caption {
    color: var(--info-color);
    border-bottom-color: var(--info-color);
}

/* Main column — editorial spread */
.lab-main {
    padding: 2.5rem 2.5rem 10rem;
    background: transparent;
}
@media (max-width: 767px) {
    .lab-main { padding: 1.75rem 1.25rem 10rem; }
}

/* Section marker: [ 01 ] ──── INPUT ──────────── */
.lab-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2.5rem 0 1.25rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #1a0306;
    font-weight: 600;
}
.lab-marker:first-child { margin-top: 0; }
.lab-marker .num {
    background: #1a0306;
    color: var(--info-color);
    padding: 0.35rem 0.7rem;
    letter-spacing: 2px;
    font-weight: 700;
}
.lab-marker .rule {
    flex: 1;
    height: 2px;
    background: #1a0306;
}
.lab-marker .tail {
    color: #7b1e30;
    font-size: 0.72rem;
    letter-spacing: 2px;
}

/* Editorial section headline — serif */
.lab-head {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 2.1rem;
    line-height: 1.05;
    letter-spacing: -0.5px;
    color: #1a0306;
    margin: 0 0 0.35rem;
}
.lab-head em { font-style: italic; font-weight: 400; color: var(--primary-color); }
.lab-sub {
    font-size: 0.92rem;
    color: #4a0510;
    margin: 0 0 1.5rem;
    max-width: 60ch;
}

/* Brutalist surface — replaces panel */
.lab-surface {
    background: #fdfaf3;
    border: 2px solid #1a0306;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}
.lab-surface.inset { padding: 0; }
.lab-surface .surface-tab {
    position: absolute;
    top: -2px; left: -2px;
    background: #1a0306;
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.3rem 0.75rem;
    font-weight: 600;
}

/* Segmented input switch — brutalist */
body.lab .seg-inline {
    background: #fdfaf3;
    border: 2px solid #1a0306;
    border-radius: 0;
    padding: 0;
    gap: 0;
}
body.lab .seg-inline .btn-check + .btn {
    border-radius: 0 !important;
    border-right: 2px solid #1a0306 !important;
    background: transparent !important;
    color: #1a0306 !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.72rem !important;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    padding: 0.55rem 1rem !important;
}
body.lab .seg-inline .btn-check + .btn:last-of-type { border-right: none !important; }
body.lab .seg-inline .btn-check:checked + .btn {
    background: #1a0306 !important;
    color: var(--info-color) !important;
}

/* Sequence editor — scientific, mono */
body.lab .seq-editor {
    font-family: 'IBM Plex Mono', monospace !important;
    font-size: 0.82rem !important;
    border: 2px solid #1a0306 !important;
    border-radius: 0 !important;
    background: #fdfaf3 !important;
    color: #1a0306 !important;
    box-shadow: none !important;
    padding: 1rem 1.1rem !important;
    line-height: 1.6 !important;
}
body.lab .seq-editor::placeholder {
    color: rgba(74, 5, 16, 0.35);
}
body.lab .seq-editor:focus {
    border-color: var(--primary-color) !important;
    box-shadow: inset 0 0 0 2px var(--primary-color) !important;
    background: #fff !important;
}

/* Inputs — brutalist */
body.lab .form-control,
body.lab .form-select,
body.lab .input-group-text {
    border: 2px solid #1a0306;
    border-radius: 0;
    background: #fdfaf3;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #1a0306;
    box-shadow: none;
}
body.lab .form-control:focus,
body.lab .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: inset 0 0 0 1px var(--primary-color);
    background: #fff;
}
body.lab .input-group-text {
    background: #1a0306;
    color: var(--info-color);
    border-color: #1a0306;
}
body.lab .input-group > .form-control { border-left: none; }

/* Labels */
body.lab .lab-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #4a0510;
    font-weight: 600;
    margin-bottom: 0.45rem;
    display: block;
}
body.lab .lab-label .tag {
    display: inline-block;
    background: var(--primary-color);
    color: var(--info-color);
    padding: 0 0.4rem;
    margin-left: 0.4rem;
    font-size: 0.62rem;
}

/* Parameter chips — brutalist square */
body.lab .param-chip {
    border-radius: 0;
    border: 2px solid #1a0306;
    background: #fdfaf3;
    color: #1a0306;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
}
body.lab .param-chip i.fa-circle-check {
    display: none;
}
body.lab .param-chip::before {
    content: '[ ]';
    font-family: 'IBM Plex Mono', monospace;
    color: #1a0306;
    margin-right: 0.25rem;
    letter-spacing: 0;
}
body.lab .param-chip:has(input:checked) {
    background: #1a0306;
    color: var(--info-color);
    border-color: #1a0306;
}
body.lab .param-chip:has(input:checked)::before {
    content: '[×]';
    color: var(--primary-color);
}

/* Buttons */
body.lab .btn {
    border-radius: 0 !important;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.7rem 1.3rem;
    border-width: 2px !important;
    box-shadow: none !important;
}
body.lab .btn:hover { transform: none !important; box-shadow: none !important; }
body.lab .btn-primary {
    background: #1a0306 !important;
    border-color: #1a0306 !important;
    color: var(--info-color) !important;
}
body.lab .btn-primary:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fdfaf3 !important;
}
body.lab .btn-outline-primary {
    background: transparent !important;
    border-color: #1a0306 !important;
    color: #1a0306 !important;
}
body.lab .btn-outline-primary:hover {
    background: #1a0306 !important;
    color: var(--info-color) !important;
}
body.lab .btn-outline-secondary {
    border-color: #1a0306 !important;
    color: #1a0306 !important;
    background: transparent !important;
}
body.lab .btn-outline-secondary:hover {
    background: #4a0510 !important;
    color: var(--info-color) !important;
    border-color: #4a0510 !important;
}

/* Live-preview pane — dark terminal */
body.lab .lab-terminal {
    background: #1a0306;
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    padding: 1.25rem;
    border: 2px solid var(--info-color);
    outline: 2px solid #1a0306;
    outline-offset: 2px;
}
.lab-terminal .terminal-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(253,230,138,0.6);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(253,230,138,0.25);
}
.lab-terminal .terminal-head .blip {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #a31621;
    animation: blink-dot 1.4s ease-in-out infinite;
}
@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}
.lab-terminal .readout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.lab-terminal .readout .cell {
    border-top: 1px dashed rgba(253,230,138,0.3);
    padding-top: 0.45rem;
}
.lab-terminal .readout .cell .k {
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(253,230,138,0.55);
}
.lab-terminal .readout .cell .v {
    font-size: 1.65rem;
    font-weight: 700;
    color: #fdfaf3;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-top: 0.2rem;
}
.lab-terminal .readout .cell .v small {
    font-size: 0.7rem;
    color: rgba(253,230,138,0.5);
    font-weight: 400;
    margin-left: 0.2rem;
}
.lab-terminal .scroll {
    background: #0a0102;
    border: 1px dashed rgba(253,230,138,0.35);
    padding: 0.75rem 0.9rem;
    font-size: 0.72rem;
    line-height: 1.55;
    min-height: 100px;
    max-height: 160px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: #cbd5e1;
    margin-bottom: 1rem;
}
.lab-terminal .scroll .hdr { color: var(--info-color); font-weight: 700; }
.lab-terminal .scroll .empty { color: rgba(253,230,138,0.3); font-style: italic; }
.lab-terminal .status-line {
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 0.5rem 0;
    border-top: 1px dashed rgba(253,230,138,0.3);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.lab-terminal .status-line .dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; }
.lab-terminal .status-line.ok   .dot { background: #a31621; }
.lab-terminal .status-line.warn .dot { background: #f59e0b; }

/* Sticky action bar — brutalist */
body.lab .action-bar {
    background: #1a0306;
    border-top: 2px solid #1a0306;
    backdrop-filter: none;
    color: #fdfaf3;
}
body.lab .action-bar .bar-left {
    color: rgba(253,250,243,0.65);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
body.lab .action-bar .bar-left i { color: var(--info-color); }
body.lab .action-bar .btn-primary {
    background: var(--info-color) !important;
    color: #1a0306 !important;
    border-color: var(--info-color) !important;
}
body.lab .action-bar .btn-primary:hover {
    background: var(--primary-color) !important;
    color: #fdfaf3 !important;
    border-color: var(--primary-color) !important;
}
body.lab .action-bar .btn-outline-secondary {
    color: var(--info-color) !important;
    border-color: var(--info-color) !important;
}
body.lab .action-bar .btn-outline-secondary:hover {
    background: var(--info-color) !important;
    color: #1a0306 !important;
}

/* Form-switch tweak */
body.lab .form-check-input {
    border-radius: 0 !important;
    border: 2px solid #1a0306 !important;
    background-color: #fdfaf3 !important;
}
body.lab .form-check-input:checked {
    background-color: #1a0306 !important;
    border-color: #1a0306 !important;
}
body.lab .form-check-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: #1a0306;
}

/* Range slider */
body.lab .form-range { accent-color: var(--primary-color); }

/* Dropzone — architectural */
body.lab .dropzone-xl {
    border: 2px dashed #1a0306;
    background:
        repeating-linear-gradient(45deg, transparent, transparent 16px, rgba(105,8,21,0.04) 16px, rgba(105,8,21,0.04) 32px),
        #fdfaf3;
    border-radius: 0;
    padding: 3.5rem 1.5rem;
}
body.lab .dropzone-xl:hover,
body.lab .dropzone-xl.dragover {
    border-style: solid;
    border-color: var(--primary-color);
    background: #fff;
}
body.lab .dropzone-xl .dz-icon {
    border-radius: 0;
    background: #1a0306;
    color: var(--info-color);
    box-shadow: 4px 4px 0 0 var(--primary-color);
}
body.lab .dropzone-xl h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.6rem;
    color: #1a0306;
}

/* Kanban job cards — brutalist */
body.lab .job-feed {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0;
    border-top: 2px solid #1a0306;
    border-left: 2px solid #1a0306;
}
body.lab .job-card-item {
    border-radius: 0;
    border: none;
    border-right: 2px solid #1a0306;
    border-bottom: 2px solid #1a0306;
    background: #fdfaf3;
    padding: 1.5rem;
    box-shadow: none !important;
}
body.lab .job-card-item::before { display: none; }
body.lab .job-card-item:hover {
    transform: none;
    background: #fff;
    box-shadow: inset 6px 0 0 var(--primary-color) !important;
}
body.lab .jc-id {
    font-family: 'IBM Plex Mono', monospace;
    background: #1a0306;
    color: var(--info-color);
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
}
body.lab .jc-name {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #1a0306;
    margin: 0.6rem 0 0.8rem;
}
body.lab .jc-meta-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #7b1e30;
}
body.lab .jc-meta-item strong {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a0306;
    letter-spacing: 0;
    text-transform: none;
}
body.lab .status-pill {
    border-radius: 0;
    border: 1.5px solid currentColor;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 0.68rem;
}

/* Results stat tiles — brutalist */
body.lab .stat-tile {
    border-radius: 0;
    border: 2px solid #1a0306;
    padding: 1.25rem 1.4rem;
    background: #fdfaf3;
}
body.lab .stat-tile::after { display: none; }
body.lab .stat-tile .st-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #7b1e30;
}
body.lab .stat-tile .st-value {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 2.6rem;
    color: #1a0306;
    line-height: 0.95;
    margin-top: 0.5rem;
}
body.lab .stat-tile .st-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #7b1e30;
}

/* Results table — brutalist */
body.lab .results-table {
    border: 2px solid #1a0306;
}
body.lab .results-table thead {
    background: #1a0306;
}
body.lab .results-table thead th {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--info-color);
}
body.lab .results-table tbody td {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    border-color: rgba(26,3,6,0.1);
}

/* Empty state — lab-notebook blank-page */
body.lab .empty-results {
    background: repeating-linear-gradient(
        to bottom,
        #fdfaf3 0, #fdfaf3 27px, rgba(105,8,21,0.15) 27px, rgba(105,8,21,0.15) 28px
    );
    border: 2px solid #1a0306;
    border-radius: 0;
    padding: 5rem 1.5rem;
}
body.lab .empty-results .empty-icon {
    border-radius: 0;
    background: #1a0306;
    color: var(--info-color);
    box-shadow: 5px 5px 0 var(--primary-color);
}
body.lab .empty-results h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.9rem;
    color: #1a0306;
}
body.lab .empty-results p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    color: #4a0510;
    letter-spacing: 0.5px;
}

/* Sample buttons in terminal */
body.lab .lab-terminal .sample-btn {
    background: transparent;
    border: 1.5px solid var(--info-color);
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-align: left;
    border-radius: 0;
    padding: 0.55rem 0.8rem;
    font-weight: 600;
}
body.lab .lab-terminal .sample-btn:hover {
    background: var(--info-color);
    color: #1a0306;
}

/* Progress */
body.lab .progress {
    border-radius: 0;
    border: 2px solid #1a0306;
    background: #fdfaf3;
    padding: 0;
}
body.lab .progress-bar { background: #1a0306 !important; }

/* Hide navbar shadow — flat architectural feel */
body.lab .navbar { box-shadow: none !important; border-bottom: 2px solid #1a0306; }

/* ==========================================================================
   BRUTALIST NAVBAR — applied globally (not scoped to .lab)
   Same sharp, editorial treatment across every page for consistency.
   ========================================================================== */

.navbar.navbar-lab {
    background: #1a0306 !important;
    padding: 0 !important;
    border-bottom: 2px solid var(--info-color);
    box-shadow: none;
    min-height: 76px;
}
.navbar.navbar-lab .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* Logo frame */
.navbar.navbar-lab .logo-frame {
    border-right: 2px solid var(--info-color);
    padding: 0 1rem;
    margin: 0;
    height: 76px;
    display: flex;
    align-items: center;
    background: #1a0306;
}
.navbar.navbar-lab .logo-frame .logo-plate {
    background: #fdfaf3;
    border: 2px solid var(--info-color);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 58px;
}
.navbar.navbar-lab .logo-frame img {
    height: 46px !important;
    width: auto !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
}

/* Brand */
.navbar.navbar-lab .brand-wrap {
    padding: 0 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    border-right: 2px solid var(--info-color);
    height: 76px;
}
/* Tool logo — sits before .brand-title in the navbar. The source PNG
   (images/casproclassifier.png) is RGBA so the transparent background
   shows through against the burgundy navbar without compositing
   artefacts. Height pinned to ~52 px so it visually anchors the
   brand-text without crowding the ICAR plate to its left. */
.navbar.navbar-lab .brand-wrap .brand-logo {
    height: 52px;
    width: auto;
    max-width: 60px;
    object-fit: contain;
    align-self: center;
    background: transparent;
    -webkit-user-drag: none;
    user-select: none;
    flex-shrink: 0;
}

.navbar.navbar-lab .brand-wrap .brand-title {
    font-family: 'Fraunces', Georgia, serif !important;
    font-weight: 800 !important;
    font-size: 1.6rem !important;
    letter-spacing: -0.5px !important;
    color: #fdfaf3 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    align-self: center;
}
.navbar.navbar-lab .brand-wrap .brand-title em {
    font-style: italic;
    font-weight: 400;
    color: var(--info-color);
}
.navbar.navbar-lab .brand-wrap .brand-badge {
    background: var(--info-color);
    color: #1a0306;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    padding: 0.2rem 0.45rem;
    border-radius: 0 !important;
    align-self: center;
    box-shadow: none;
    margin-left: 0;
}

/* Nav links — mono uppercase */
.navbar.navbar-lab .navbar-nav {
    height: 76px;
    gap: 0 !important;
    margin-left: auto !important;
}
.navbar.navbar-lab .navbar-nav .nav-item {
    border-right: 1px solid rgba(253,230,138,0.2);
    height: 76px;
    display: flex;
    align-items: stretch;
}
.navbar.navbar-lab .navbar-nav .nav-item:first-child {
    border-left: 1px solid rgba(253,230,138,0.2);
}
.navbar.navbar-lab .navbar-nav .nav-link {
    font-family: 'IBM Plex Mono', monospace !important;
    font-size: 0.72rem !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    color: rgba(253,250,243,0.75) !important;
    margin: 0 !important;
    padding: 0 1.1rem !important;
    display: flex !important;
    align-items: center;
    border-radius: 0 !important;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}
.navbar.navbar-lab .navbar-nav .nav-link::after { display: none !important; }
.navbar.navbar-lab .navbar-nav .nav-link:hover {
    background: var(--primary-color);
    color: #fdfaf3 !important;
}
.navbar.navbar-lab .navbar-nav .nav-link.active {
    background: var(--info-color);
    color: #1a0306 !important;
}
.navbar.navbar-lab .navbar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* Collapse toggler */
.navbar.navbar-lab .navbar-toggler {
    border: 2px solid var(--info-color) !important;
    border-radius: 0 !important;
    padding: 0.35rem 0.6rem;
    color: var(--info-color);
    margin: 0 0.5rem;
}
.navbar.navbar-lab .navbar-toggler:focus { box-shadow: none; }
.navbar.navbar-lab .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%23fde68a' stroke-linecap='square' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

@media (max-width: 991px) {
    .navbar.navbar-lab .brand-wrap,
    .navbar.navbar-lab .logo-frame { border-right: none; padding: 0 0.75rem; }
    .navbar.navbar-lab .navbar-nav { height: auto; background: #120204; padding: 0.5rem 0; border-top: 1px solid rgba(253,230,138,0.2); }
    .navbar.navbar-lab .navbar-nav .nav-item { height: auto; border: none; border-bottom: 1px dashed rgba(253,230,138,0.15); }
    .navbar.navbar-lab .navbar-nav .nav-link { padding: 0.85rem 1.25rem !important; }

    /* Page-title masthead — large tablets / hamburger-collapsed view.
       Soften the desktop clamp (which floors at 2.4 rem ~ 38 px) to a
       2.2 rem (~ 35 px) headline so the masthead doesn't crowd the
       collapsed-nav strip immediately above. The deeper tablet
       (≤ 767px) and phone (≤ 575px) blocks below override further. */
    .lab-masthead   { padding: 1.1rem 1.5rem; }
    .lab-masthead h1 {
        font-size: 2.2rem !important;
        line-height: 1 !important;
    }
}

/* Tablet (576-767px): navbar shrinks moderately so ICAR plate + tool
   logo + brand title + hamburger fit on one line WITHOUT the more
   aggressive ≤ 575 px shrink that hits phones. */
@media (max-width: 767.98px) and (min-width: 576px) {
    .navbar.navbar-lab .logo-frame             { height: 64px; padding: 0 0.6rem; }
    .navbar.navbar-lab .logo-frame .logo-plate { height: 48px; padding: 3px 6px; }
    .navbar.navbar-lab .logo-frame img         { height: 38px !important; }
    .navbar.navbar-lab .brand-wrap             { padding: 0 0.6rem; gap: 0.5rem; height: 64px; }
    .navbar.navbar-lab .brand-wrap .brand-logo { height: 42px; max-width: 50px; }
    .navbar.navbar-lab .brand-wrap .brand-title { font-size: 1.25rem !important; white-space: nowrap; }
}

/* ==========================================================================
   HOME (index) — editorial lab spread
   ========================================================================== */

body.lab.home-page {
    background-color: #f4ede1;
}

.home-hero {
    border-bottom: 2px solid #1a0306;
    background: #fdfaf3;
    position: relative;
    overflow: hidden;
}
.home-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(105,8,21,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(105,8,21,0.05) 1px, transparent 1px);
    background-size: 28px 28px;
}
.home-hero .hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    min-height: 560px;
}
@media (max-width: 991px) {
    .home-hero .hero-inner { grid-template-columns: 1fr; }
}

.hero-column-left {
    padding: 4rem 3rem;
    border-right: 2px solid #1a0306;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
@media (max-width: 991px) { .hero-column-left { border-right: none; border-bottom: 2px solid #1a0306; padding: 3rem 1.5rem; } }

.hero-column-left .hero-stamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 0.85rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}
.hero-column-left h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: clamp(3rem, 6vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: -2px;
    color: #1a0306;
    margin: 0 0 1.5rem;
}
.hero-column-left h1 em {
    font-style: italic;
    font-weight: 400;
    color: var(--primary-color);
}
.hero-column-left h1 .small-rule {
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    margin: 1rem 0;
}
.hero-column-left .hero-kicker {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    line-height: 1.55;
    color: #4a0510;
    max-width: 52ch;
    margin-bottom: 2rem;
}
.hero-column-left .hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero-column-right {
    background: #1a0306;
    padding: 3rem;
    color: #fdfaf3;
    position: relative;
    overflow: hidden;
}
.hero-column-right::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 260px; height: 260px;
    background: radial-gradient(circle, rgba(105,8,21,0.6), transparent 70%);
    border-radius: 50%;
}
.hero-column-right > * { position: relative; z-index: 1; }
.hero-column-right .side-caption {
    color: var(--info-color);
    border-bottom-color: var(--info-color);
}
.hero-column-right .spec-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: 'IBM Plex Mono', monospace;
}
.hero-column-right .spec-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(253,230,138,0.2);
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.hero-column-right .spec-list li .k { color: rgba(253,230,138,0.55); }
.hero-column-right .spec-list li .v { color: #fdfaf3; font-weight: 700; }
.hero-column-right .spec-list li .v.accent { color: var(--info-color); }

/* Big visual marker in hero right column */
.hero-insignia {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 900;
    font-size: 8rem;
    line-height: 0.85;
    color: var(--info-color);
    letter-spacing: -4px;
    margin-bottom: 1rem;
}
.hero-insignia em {
    display: block;
    font-style: italic;
    color: var(--primary-color);
    font-size: 3.5rem;
    font-weight: 400;
    margin-top: 0.3rem;
    letter-spacing: -1px;
}

/* Home — feature spread */
.home-spread {
    border-bottom: 2px solid #1a0306;
    background: #fdfaf3;
}
.home-spread .spread-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 300px;
}
@media (max-width: 991px) { .home-spread .spread-inner { grid-template-columns: 1fr; } }

.feature-cell {
    padding: 2.5rem 2rem;
    border-right: 2px solid #1a0306;
    position: relative;
    transition: background 0.2s ease;
    cursor: default;
}
.feature-cell:last-child { border-right: none; }
@media (max-width: 991px) { .feature-cell { border-right: none; border-bottom: 2px solid #1a0306; } .feature-cell:last-child { border-bottom: none; } }
.feature-cell:hover { background: #f4ede1; }
.feature-cell .cell-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2.5px;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}
.feature-cell h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.85rem;
    letter-spacing: -0.5px;
    color: #1a0306;
    margin: 0 0 0.85rem;
}
.feature-cell h3 em { font-style: italic; font-weight: 400; color: var(--primary-color); }
.feature-cell p {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #4a0510;
    line-height: 1.55;
    margin: 0 0 1.25rem;
}
.feature-cell .cell-cta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #1a0306;
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid #1a0306;
    padding-bottom: 2px;
    transition: color 0.15s ease, border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.feature-cell .cell-cta:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.feature-cell .cell-icon {
    width: 54px; height: 54px;
    border: 2px solid #1a0306;
    color: #1a0306;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
    background: #fdfaf3;
    box-shadow: 4px 4px 0 var(--primary-color);
}

/* Home — statistics ticker bar */
.home-ticker {
    background: #1a0306;
    color: #fdfaf3;
    padding: 2rem 0;
    border-bottom: 2px solid #1a0306;
}
.home-ticker .ticker-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}
@media (max-width: 767px) { .home-ticker .ticker-inner { grid-template-columns: repeat(2, 1fr); } }
.ticker-cell {
    text-align: center;
    padding: 0.5rem 1rem;
    border-right: 1px dashed rgba(253,230,138,0.2);
}
.ticker-cell:last-child { border-right: none; }
.ticker-cell .big {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 3rem;
    line-height: 1;
    color: var(--info-color);
    letter-spacing: -1px;
}
.ticker-cell .lbl {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(253,250,243,0.6);
    margin-top: 0.4rem;
}

/* Home — workflow steps */
.home-workflow {
    background: #f4ede1;
    border-bottom: 2px solid #1a0306;
    padding: 4rem 2rem;
    background-image:
        linear-gradient(to right, rgba(105,8,21,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(105,8,21,0.05) 1px, transparent 1px);
    background-size: 28px 28px;
}
.home-workflow .wf-head {
    max-width: 1200px;
    margin: 0 auto 3rem;
}
.home-workflow .wf-head .eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.home-workflow .wf-head h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -1px;
    color: #1a0306;
    margin: 0;
    max-width: 24ch;
}
.home-workflow .wf-head h2 em { font-style: italic; font-weight: 400; color: var(--primary-color); }

.wf-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}
@media (max-width: 991px) { .wf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .wf-grid { grid-template-columns: 1fr; } }

.wf-step {
    background: #fdfaf3;
    border: 2px solid #1a0306;
    padding: 1.5rem;
    position: relative;
}
.wf-step .step-no {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.wf-step h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: #1a0306;
    margin: 0 0 0.5rem;
}
.wf-step p {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #4a0510;
    line-height: 1.55;
    margin: 0;
}
.wf-step .arrow {
    position: absolute;
    right: -18px; top: 50%;
    transform: translateY(-50%);
    width: 30px; height: 30px;
    background: #1a0306;
    color: var(--info-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    z-index: 2;
}
@media (max-width: 991px) { .wf-step .arrow { display: none; } }
.wf-step:last-child .arrow { display: none; }

/* Home — call-out band */
.home-callout {
    padding: 3.5rem 2rem;
    background: #fdfaf3;
    border-bottom: 2px solid #1a0306;
    text-align: center;
}
.home-callout .callout-inner {
    max-width: 820px;
    margin: 0 auto;
}
.home-callout .eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}
.home-callout h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -1px;
    color: #1a0306;
    margin: 0 0 1.5rem;
}
.home-callout h2 em { font-style: italic; font-weight: 400; color: var(--primary-color); }
.home-callout p {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    color: #4a0510;
    margin: 0 0 2rem;
    line-height: 1.6;
}
.home-callout .hero-actions {
    display: inline-flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ==========================================================================
   DOCS / ABOUT overrides under .lab
   ========================================================================== */

/* Docs side-nav (uses Bootstrap tab plumbing) */
body.lab .lab-doc-nav {
    border: 2px solid #1a0306;
    background: #fdfaf3;
    padding: 0;
    margin-bottom: 1.5rem;
}
body.lab .lab-doc-nav .list-group-item {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px dashed rgba(26,3,6,0.25) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0.85rem 1rem !important;
    font-family: 'IBM Plex Mono', monospace !important;
    font-size: 0.75rem !important;
    letter-spacing: 2px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    color: #1a0306 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem;
}
body.lab .lab-doc-nav .list-group-item:last-child { border-bottom: none !important; }
body.lab .lab-doc-nav .list-group-item i { color: var(--primary-color); }
body.lab .lab-doc-nav .list-group-item:hover {
    background: #f4ede1 !important;
    color: var(--primary-color) !important;
}
body.lab .lab-doc-nav .list-group-item.active {
    background: #1a0306 !important;
    color: var(--info-color) !important;
    border-color: #1a0306 !important;
}
body.lab .lab-doc-nav .list-group-item.active i { color: var(--info-color); }
body.lab .lab-doc-nav .list-group-item .num {
    font-size: 0.65rem;
    color: var(--primary-color);
    width: 1.5rem;
    flex-shrink: 0;
    font-weight: 700;
}
body.lab .lab-doc-nav .list-group-item.active .num { color: var(--primary-color); }

/* Tab panes — each one gets a lab-surface treatment */
body.lab .tab-content .tab-pane { padding: 0; }
body.lab .tab-content .lab-surface { margin-bottom: 0; }

/* Doc headings — editorial */
body.lab .doc-head {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: -0.5px;
    color: #1a0306;
    margin: 0 0 0.5rem;
}
body.lab .doc-head em { font-style: italic; font-weight: 400; color: var(--primary-color); }
body.lab .doc-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #4a0510;
    line-height: 1.6;
    max-width: 65ch;
    margin-bottom: 1.5rem;
}
body.lab .doc-h5 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #1a0306;
    letter-spacing: -0.2px;
    margin: 1.5rem 0 0.5rem;
}
body.lab .doc-h6 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin: 1.25rem 0 0.5rem;
}
body.lab .tab-content p,
body.lab .tab-content ul,
body.lab .tab-content li {
    font-family: 'Inter', sans-serif;
    color: #1a0306;
}

/* Check list (overview feature list) */
body.lab .lab-check {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}
body.lab .lab-check li {
    padding: 0.55rem 0 0.55rem 1.8rem;
    border-bottom: 1px dashed rgba(26,3,6,0.12);
    position: relative;
    font-size: 0.92rem;
    color: #1a0306;
}
body.lab .lab-check li:last-child { border-bottom: none; }
body.lab .lab-check li::before {
    content: '✓';
    position: absolute;
    left: 0; top: 0.55rem;
    color: var(--primary-color);
    font-weight: 700;
    font-family: 'IBM Plex Mono', monospace;
}

/* Callout box — replaces alert-info */
body.lab .lab-callout {
    border-left: 4px solid var(--primary-color);
    background: #fef3c7;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    color: #4a0510;
    font-family: 'Inter', sans-serif;
}
body.lab .lab-callout.warn {
    background: rgba(245,158,11,0.15);
    border-color: var(--warning-color);
}
body.lab .lab-callout strong {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #1a0306;
    display: block;
    margin-bottom: 0.35rem;
}

/* Code/preformatted blocks */
body.lab .lab-code,
body.lab pre.lab-code {
    background: #1a0306;
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    padding: 1.25rem 1.5rem;
    border: 2px solid #1a0306;
    margin: 1rem 0 1.5rem;
    position: relative;
    overflow: auto;
    white-space: pre;
}
body.lab .lab-code .tab-label {
    position: absolute;
    top: -2px; left: -2px;
    background: var(--info-color);
    color: #1a0306;
    padding: 0.2rem 0.6rem;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
}
body.lab .lab-code .hdr { color: var(--primary-color); font-weight: 700; }
body.lab .tab-content code {
    font-family: 'IBM Plex Mono', monospace;
    background: #1a0306;
    color: var(--info-color);
    padding: 0.1rem 0.35rem;
    font-size: 0.85em;
}

/* Endpoint line */
body.lab .lab-endpoint {
    display: inline-flex;
    gap: 0.6rem;
    align-items: center;
    background: #1a0306;
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
    border: 2px solid #1a0306;
    margin: 0.5rem 0 1rem;
    letter-spacing: 1px;
}
body.lab .lab-endpoint .method {
    background: var(--primary-color);
    color: #fdfaf3;
    padding: 0.15rem 0.5rem;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 2px;
}

/* Confidence chips */
body.lab .conf-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}
@media (max-width: 575px) { body.lab .conf-row { grid-template-columns: 1fr; } }
body.lab .conf-chip {
    border: 2px solid #1a0306;
    background: #fdfaf3;
    padding: 1rem 1.1rem;
    position: relative;
}
body.lab .conf-chip .lvl {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.3rem;
    color: #1a0306;
    line-height: 1;
    margin-bottom: 0.25rem;
}
body.lab .conf-chip .lvl em { font-style: italic; font-weight: 400; color: var(--primary-color); }
body.lab .conf-chip .pct {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
}
body.lab .conf-chip .desc {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: #7b1e30;
    margin-top: 0.5rem;
}
body.lab .conf-chip.ok::after    { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: #690815; }
body.lab .conf-chip.mid::after   { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: var(--warning-color); }
body.lab .conf-chip.low::after   { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: var(--danger-color); }

/* Cas class table */
body.lab .cas-table {
    border: 2px solid #1a0306;
    width: 100%;
    margin: 1rem 0 1.5rem;
}
body.lab .cas-table th {
    background: #1a0306;
    color: var(--info-color);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 0.85rem 1rem;
    border: none;
    font-weight: 600;
    text-align: left;
}
body.lab .cas-table td {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px dashed rgba(26,3,6,0.15);
    color: #1a0306;
    vertical-align: middle;
}
body.lab .cas-table tbody tr:last-child td { border-bottom: none; }
body.lab .cas-table .cas-badge {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    padding: 0.25rem 0.6rem;
    border: 1.5px solid currentColor;
    color: var(--primary-color);
    font-weight: 700;
}

/* ABOUT page — editorial sections */
body.lab .about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 2px solid #1a0306;
    margin: 1.5rem 0 2.5rem;
}
@media (max-width: 767px) { body.lab .about-grid { grid-template-columns: 1fr; } }
body.lab .about-cell {
    padding: 2rem;
    border-right: 2px solid #1a0306;
    background: #fdfaf3;
}
body.lab .about-cell:last-child { border-right: none; }
@media (max-width: 767px) {
    body.lab .about-cell { border-right: none; border-bottom: 2px solid #1a0306; }
    body.lab .about-cell:last-child { border-bottom: none; }
}
body.lab .about-cell .big-mark {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 3.5rem;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 1rem;
}
body.lab .about-cell h4 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.3px;
    color: #1a0306;
    margin: 0 0 0.75rem;
}
body.lab .about-cell h4 em { font-style: italic; font-weight: 400; color: var(--primary-color); }
body.lab .about-cell p {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: #1a0306;
    line-height: 1.65;
    margin: 0;
}

/* Citation block — editorial */
body.lab .citation-block {
    border: 2px solid #1a0306;
    background: #fdfaf3;
    padding: 2.5rem;
    position: relative;
    margin: 1.5rem 0;
}
body.lab .citation-block::before {
    content: '"';
    position: absolute;
    top: -0.3rem; left: 1.5rem;
    font-family: 'Fraunces', Georgia, serif;
    font-size: 7rem;
    color: var(--primary-color);
    line-height: 1;
    opacity: 0.25;
}
body.lab .citation-block .cite-eyebrow {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}
body.lab .citation-block .cite-title {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.45rem;
    line-height: 1.3;
    letter-spacing: -0.3px;
    color: #1a0306;
    margin: 0 0 0.75rem;
}
body.lab .citation-block .cite-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: #4a0510;
    margin: 0 0 0.25rem;
}
body.lab .citation-block .cite-meta em { color: var(--primary-color); font-style: italic; }
body.lab .citation-block .cite-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(26,3,6,0.2);
}

/* Team / credits strip */
body.lab .credit-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 2px solid #1a0306;
    margin: 1.5rem 0;
}
@media (max-width: 767px) { body.lab .credit-strip { grid-template-columns: 1fr; } }
body.lab .credit-cell {
    padding: 1.5rem;
    border-right: 2px solid #1a0306;
    background: #1a0306;
    color: #fdfaf3;
}
body.lab .credit-cell:last-child { border-right: none; }
@media (max-width: 767px) {
    body.lab .credit-cell { border-right: none; border-bottom: 2px solid var(--info-color); }
    body.lab .credit-cell:last-child { border-bottom: none; }
}
body.lab .credit-cell .k {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(253,230,138,0.55);
    margin-bottom: 0.5rem;
}
body.lab .credit-cell .v {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--info-color);
    line-height: 1.2;
}
body.lab .credit-cell .v em { font-style: italic; font-weight: 400; color: #fdfaf3; }

/* Docs quick-ref terminal items */
body.lab .lab-terminal .qref {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: var(--info-color);
    padding: 0.55rem 0;
    border-bottom: 1px dashed rgba(253,230,138,0.2);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}
body.lab .lab-terminal .qref:last-child { border-bottom: none; }
body.lab .lab-terminal .qref .k { color: rgba(253,230,138,0.55); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 1.5px; }

/* ==========================================================================
   BRUTALIST FOOTER — applied globally (not scoped to .lab)
   Editorial colophon · four-column grid · dark burgundy-black
   ========================================================================== */

.site-footer {
    background: #1a0306;
    color: #fdfaf3;
    border-top: 2px solid var(--info-color);
    margin-top: 3rem;
    position: relative;
    font-family: 'Inter', sans-serif;
}
.site-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        var(--primary-color) 0 20px,
        transparent 20px 40px
    );
    opacity: 0.5;
    pointer-events: none;
}

/* Top band — grid */
.site-footer .footer-top {
    padding: 3rem 2rem 2.5rem;
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
}
.site-footer .fgrid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 2.5rem;
}
@media (max-width: 991px) {
    .site-footer .fgrid { grid-template-columns: 1fr 1fr; gap: 2rem; }
    .site-footer .fcol-brand { grid-column: span 2; }
}
@media (max-width: 575px) {
    .site-footer .fgrid { grid-template-columns: 1fr; }
    .site-footer .fcol-brand { grid-column: auto; }
}

/* Footer caption — amber uppercase mono */
.site-footer .fcaption {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--info-color);
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1.5px solid var(--info-color);
    display: inline-block;
    min-width: 120px;
}

/* Brand column */
.site-footer .fcol-brand .fbrand {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 2.4rem;
    line-height: 0.95;
    letter-spacing: -1px;
    color: #fdfaf3;
    margin: 0 0 0.4rem;
}
.site-footer .fcol-brand .fbrand em {
    font-style: italic;
    font-weight: 400;
    color: var(--info-color);
}
.site-footer .fcol-brand .fbrand .rule {
    display: block;
    width: 48px;
    height: 3px;
    background: var(--primary-color);
    margin: 0.75rem 0;
}
.site-footer .fcol-brand .fstamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}
.site-footer .fcol-brand .ftagline {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    line-height: 1.6;
    color: rgba(253,250,243,0.72);
    max-width: 38ch;
    margin: 0 0 1.25rem;
}
.site-footer .fcol-brand .fchips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.site-footer .fcol-brand .fchip {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--info-color);
    border: 1px solid rgba(253,230,138,0.35);
    padding: 0.25rem 0.55rem;
    font-weight: 600;
}
.site-footer .fcol-brand .fchip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.72rem;
    letter-spacing: 2px;
    padding: 0.5rem 0.85rem;
    border: 2px solid var(--info-color);
    background: transparent;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.site-footer .fcol-brand .fchip-link i {
    font-size: 0.95rem;
    color: var(--info-color);
    transition: color 0.15s ease;
}
.site-footer .fcol-brand .fchip-link:hover,
.site-footer .fcol-brand .fchip-link:focus {
    background: var(--info-color);
    color: #1a0306;
    transform: translateY(-1px);
}
.site-footer .fcol-brand .fchip-link:hover i,
.site-footer .fcol-brand .fchip-link:focus i {
    color: #1a0306;
}

/* Footer link lists */
.site-footer .flinks {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-footer .flinks li {
    border-bottom: 1px dashed rgba(253,230,138,0.18);
}
.site-footer .flinks li:last-child { border-bottom: none; }
.site-footer .flinks a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(253,250,243,0.75);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease, padding-left 0.15s ease;
    position: relative;
}
.site-footer .flinks a::before {
    content: '›';
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform 0.15s ease;
}
.site-footer .flinks a:hover {
    color: var(--info-color);
    padding-left: 0.25rem;
}
.site-footer .flinks a:hover::before { transform: translateX(2px); }

/* Partner plate — institutional logos */
.site-footer .plate {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
    justify-content: center;
    margin-bottom: 1.5rem;
}
.site-footer .plate a {
    flex: 0 0 auto;
    width: 110px;
    height: 110px;
    aspect-ratio: 1 / 1;
    background: #fdfaf3;
    border: 2px solid var(--info-color);
    padding: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.site-footer .plate a:hover { background: var(--info-color); }
.site-footer .plate img {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

/* Clustrmap frame + visitors count */
.site-footer .clustr-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    width: 100%;
}
.site-footer .clustr-link .clustr-frame,
.site-footer .clustr-link .clustr-frame * {
    pointer-events: none;
}
.site-footer .clustr-link:hover .clustr-frame {
    border-color: var(--info-color);
    background: rgba(0,0,0,0.45);
}
.site-footer .clustr-frame {
    border: 2px solid rgba(253,230,138,0.35);
    padding: 0.5rem;
    background: rgba(0,0,0,0.3);
    display: inline-block;
    min-height: 208px;
    min-width: 208px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.site-footer .clustr-frame canvas,
.site-footer .clustr-frame > * {
    max-width: 100%;
}
.site-footer .visitors-caption {
    margin: 0;
    min-width: 0;
}
.site-footer .visitors-block {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}
.site-footer .visitor-count {
    border: 1.5px solid var(--info-color);
    background: rgba(0,0,0,0.35);
    padding: 0.5rem 0.75rem;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
    min-width: 100px;
}
.site-footer .visitor-count-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--info-color);
    letter-spacing: 1px;
}
.site-footer .visitor-count-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(253,250,243,0.6);
    margin-top: 0.35rem;
}

/* Responsive image fallback (kept for partner logos) */
@media (max-width: 1200px) {
    .site-footer .plate a { width: 96px; height: 96px; }
}
@media (max-width: 575px) {
    .site-footer .plate a { width: 84px; height: 84px; }
}

/* Bottom band — colophon */
.site-footer .footer-bottom {
    background: #0a0102;
    border-top: 1px solid rgba(253,230,138,0.25);
    padding: 1rem 2rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.site-footer .fb-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(253,250,243,0.55);
}
.site-footer .fb-inner .left  { margin-right: auto; }
.site-footer .fb-inner .right { margin-left: auto; }
.site-footer .fb-inner .center {
    color: var(--info-color);
    letter-spacing: 2.5px;
    font-weight: 600;
    text-align: center;
}
.site-footer .fb-inner .left  { text-align: left; }
.site-footer .fb-inner .right { text-align: right; }
.site-footer .fb-inner strong { color: var(--info-color); font-weight: 700; }

@media (max-width: 767px) {
    .site-footer .fb-inner {
        flex-direction: column;
        text-align: center;
    }
    .site-footer .fb-inner .left,
    .site-footer .fb-inner .right,
    .site-footer .fb-inner .center {
        text-align: center;
        margin: 0;
    }
}

/* Start Batch Analysis button — lab-themed hover (inline base styles
   need an explicit selector to override on :hover / :focus / :active). */
#batchStartBtn {
    transition: background 0.18s ease, color 0.18s ease,
                border-color 0.18s ease, box-shadow 0.18s ease,
                transform 0.12s ease;
}
#batchStartBtn:hover,
#batchStartBtn:focus {
    background: #4a0510 !important;          /* darker burgundy */
    color: #fffbeb !important;               /* lighter cream */
    border-color: #4a0510 !important;
    box-shadow: 0 6px 18px rgba(105, 8, 21, 0.35);
    transform: translateY(-1px);
    outline: none;
}
#batchStartBtn:active {
    background: #1a0306 !important;          /* near-black burgundy on press */
    color: #fde68a !important;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(26, 3, 6, 0.4);
}
#batchStartBtn:disabled {
    background: #7b1e30 !important;
    color: #f8efe1 !important;
    border-color: #1a0306 !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ────────────────────────────────────────────────────────────────────
   MOBILE-POLISH MEDIA QUERIES — final pass
   Override inline-style hacks added on batch-analysis.php /
   results-section.php / index.php so phones get a usable layout.
   Desktop (≥ 992 px) layout is identical — these rules only kick in
   on small viewports.
   ──────────────────────────────────────────────────────────────────── */

/* 1. Batch-analysis sidebar stacks above main on tablet & phone */
@media (max-width: 991.98px) {
    .batch-sidebar {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        border-right: 0 !important;
        border-bottom: 2px solid #1a0306;
    }
    /* The main column carries an inline flex-basis 81.25% — match it */
    .batch-sidebar + div[style*="81.25%"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    /* Sidebar list-group goes horizontal-pill on phones to save vertical room */
    .batch-sidebar .list-group {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .batch-sidebar .list-group-item {
        flex: 1 1 auto;
        text-align: center;
    }
}

/* 2. Results-section breathing room on phones */
@media (max-width: 768px) {
    section#results { padding-top: 2rem; padding-bottom: 3rem; }
    section#results > .container,
    .lab-shell > .lab-main {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    /* Results panel + summary/export stack with a small gap */
    #resultsContainer .col-lg-8,
    #resultsContainer .col-lg-4 {
        margin-bottom: 1rem;
    }
    /* The 6-column results table needs a horizontal-scroll container.
       table-responsive already gives that; force a min-width so the
       columns don't collapse into illegible widths. */
    #resultsTable { font-size: 0.85rem; min-width: 560px; }
}

/* 3. Hero insignia + spec-list scale on small phones */
@media (max-width: 575.98px) {
    /* Inline 6.4rem on index.php → 3.2rem on small phones */
    .hero-insignia { font-size: 3.2rem !important; letter-spacing: -2px !important; }
    .hero-insignia em { font-size: 0.5em !important; }
    .home-hero h1 { font-size: 2.2rem; line-height: 1.05; }
    .hero-kicker { font-size: 0.95rem; }
    /* Spec-list compact spacing */
    .spec-list li { padding: 0.45rem 0; font-size: 0.78rem; }
    /* Start Batch Analysis button spans the dropzone on phones */
    #batchStartBtn {
        width: 100%;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        font-size: 0.82rem !important;
    }
    /* Lab-markers drop the tail label cleanly */
    .lab-marker .tail { display: none; }
    .lab-marker { gap: 0.6rem; }
}

/* 4. Forms, dropzone, and analysis-section card padding on small phones */
@media (max-width: 575.98px) {
    .card-body.p-4 { padding: 1.25rem !important; }
    .upload-zone { padding: 1.5rem 0.75rem !important; }
    .upload-zone h5 { font-size: 1.05rem; }
    .input-group-text { padding-left: 0.6rem; padding-right: 0.6rem; }
    .btn-lg.px-5 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
    /* Section-header on analysis page collapses to readable size */
    #analysis .section-header h2 { font-size: 1.55rem; }
    #analysis .section-header .lead { font-size: 0.95rem; }
    /* Make the lab-head editorial heading scale down too */
    .lab-head { font-size: 1.55rem !important; }
    /* Top progress bar doesn't fight against viewport edges */
    .home-hero { padding: 2rem 0; }
}

/* ──────────────────────────────────────────────────────────────────────
   Activity 2 — Structure & Docking page
   3Dmol.js viewer cards, HDOCK score table, and responsive grid.
   Lab-burgundy palette: primary #690815, dark accent #1a0306,
   amber-50 background #fffbeb, amber-200 surface accent #fde68a.
   ────────────────────────────────────────────────────────────────────── */

.struct-viewer-card {
    padding: 0;
    overflow: hidden;
}

.struct-viewer-panel {
    position: relative;
    width: 100%;
    height: 480px;
    background: #ffffff;
    border-top: 1px solid #e7d8a6;
    border-bottom: 1px solid #e7d8a6;
}

/* 3Dmol's canvas inherits 100% via JS; this keeps the loading state tidy. */
.struct-viewer-panel.loading::before {
    content: "Rendering structure…";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #690815;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* Score table — re-uses the burgundy header pattern from .results-table. */
.dock-score-table th {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.dock-score-table tbody tr.active-pose {
    background: #fff8d8 !important;
    border-left: 3px solid #690815;
}
.dock-score-table tbody td.score-cell {
    font-family: 'IBM Plex Mono', monospace;
    color: #1a0306;
}

/* Inline "Fold & Dock" button on classifier results table rows. */
.results-table .btn-fold-dock {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.55rem;
    border-color: #690815;
    color: #690815;
    margin-left: 0.4rem;
}
.results-table .btn-fold-dock:hover {
    background: #690815;
    color: #fde68a;
}

/* Three-up viewer grid collapses to one column at ≤ 991 px (Bootstrap lg). */
@media (max-width: 991.98px) {
    .struct-viewer-panel { height: 380px; }
}
@media (max-width: 575.98px) {
    .struct-viewer-panel { height: 320px; }
    #structureDocking .section-header h2 { font-size: 1.55rem; }
    #structureDocking .section-header .lead { font-size: 0.95rem; }
    /* Inputs stack with a bit less vertical padding on small phones. */
    #structureDockForm textarea { font-size: 0.85rem; }
    #sdSubmitBtn { width: 100%; }
    #sdExampleBtn { width: 100%; }
}


/* ─── Objective III — Metagenomic Discovery ───────────────────────────────
   Same lab-burgundy palette as Activity 2 (#690815 / #1a0306 / #fde68a /
   #fffbeb). Three-tab input UI (.metag-input-tabs), four result tables
   (.metag-table), and a top-of-page count summary strip (.count-card). */

.metag-input-tabs {
    border-bottom: 2px solid #f1d27d;
    margin-bottom: 1.25rem;
}
.metag-input-tabs .nav-link {
    color: #690815;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.6px;
    border: 1px solid transparent;
    border-bottom-color: transparent;
    padding: 0.55rem 1rem;
    margin-right: 0.25rem;
    background: transparent;
}
.metag-input-tabs .nav-link:hover {
    color: #1a0306;
    background: #fff7d6;
    border-color: #f1d27d;
    border-bottom-color: transparent;
}
.metag-input-tabs .nav-link.active {
    color: #fde68a;
    background: #690815;
    border-color: #690815;
    border-bottom-color: #690815;
}

/* Inherit the dock-score-table styling for table chrome where it makes
   sense, plus a few overrides for the longer rows we render here. */
.metag-table th {
    text-transform: uppercase;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
    border-bottom: 1px solid #1a0306;
    padding: 0.65rem 0.75rem;
    white-space: nowrap;
}
.metag-table tbody td {
    border-color: #f1d27d;
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
}
.metag-table tbody tr:hover {
    background: #fff7d6;
}

/* Count summary cards — five tiles across at lg, two-up on tablet,
   single-column on phones. */
.metag-count-strip .count-card {
    text-align: center;
    padding: 1rem 0.5rem;
    height: 100%;
    border: 1px solid #f1d27d;
}
.metag-count-strip .count-label {
    font-family: 'IBM Plex Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    color: #7b1e30;
    margin-bottom: 0.4rem;
}
.metag-count-strip .count-value {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 800;
    font-size: 1.65rem;
    color: #1a0306;
    line-height: 1;
}
/* Optional sub-label below the count value — used when the prefilter
   drops ORFs before ESM-2. Shows "N classified · M pre-filtered" so
   the headline "Predicted ORFs" remains the canonical Prodigal count
   while the workload reduction is still visible. */
.metag-count-strip .count-sublabel {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.5px;
    color: #7b1e30;
    margin-top: 0.35rem;
    line-height: 1.25;
}

/* Confidence pill — used in the Cas-genes table's first column AND
   inline in the legend below the table. Three tiers (High / Medium / Low)
   share the same shape; only background + text colour shift to match the
   lab-burgundy palette. Compact, monospace-feel so it reads like a tag,
   not a button. */
.metag-confidence-pill {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height: 1.2;
    border: 1px solid transparent;
    white-space: nowrap;
}
.metag-conf-high {
    background: #690815;
    color: #fde68a;
    border-color: #690815;
}
.metag-conf-medium {
    background: #fde68a;
    color: #1a0306;
    border-color: #c9a64b;
}
.metag-conf-low {
    background: #fffbeb;
    color: #7b1e30;
    border-color: #c9a64b;
}

/* Mobile collapse — match what the docking section does. */
@media (max-width: 991.98px) {
    .metag-count-strip .count-value { font-size: 1.4rem; }
}
@media (max-width: 575.98px) {
    #metagenomicDiscovery .section-header h2 { font-size: 1.55rem; }
    #metagenomicDiscovery .section-header .lead { font-size: 0.95rem; }
    #metagDiscoverForm textarea { font-size: 0.85rem; }
    #mdSubmitBtn  { width: 100%; }
    #mdExampleBtn { width: 100%; }
    .metag-table { font-size: 0.78rem; }
    .metag-confidence-pill { font-size: 0.66rem; padding: 0.15rem 0.4rem; }
}


/* ────────────────────────────────────────────────────────────────────────
   About page — hero logo block
   ────────────────────────────────────────────────────────────────────────
   Centered logo above the "About Cas-ProClassifier" masthead. The image
   is the same RGBA source as the navbar brand-logo + favicon, so the
   transparent edges blend with the cream `.lab-shell` background. A
   thin amber accent rule below the logo ties it into the lab-burgundy
   palette (mirrors `.team-tagline .tag-rule`). The block scales down
   on tablets / phones so the logo never dominates a small viewport. */
.about-hero-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 1rem;
}
.about-hero-logo__img {
    width: 200px;
    height: 200px;
    max-width: 100%;
    object-fit: contain;
    background: transparent;
    filter: drop-shadow(0 6px 18px rgba(26, 3, 6, 0.12));
    transition: transform 0.45s ease;
    -webkit-user-drag: none;
    user-select: none;
}
.about-hero-logo__img:hover {
    transform: scale(1.03);
}
.about-hero-logo::after {
    content: '';
    display: block;
    width: 64px;
    height: 3px;
    background: var(--info-color);
    margin-top: 1.4rem;
    border-radius: 999px;
}

@media (max-width: 991.98px) {
    .about-hero-logo        { padding: 2rem 1rem 0.75rem; }
    .about-hero-logo__img   { width: 160px; height: 160px; }
}
@media (max-width: 575.98px) {
    .about-hero-logo        { padding: 1.5rem 0.75rem 0.5rem; }
    .about-hero-logo__img   { width: 120px; height: 120px; }
    .about-hero-logo::after { width: 48px; margin-top: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .about-hero-logo__img         { transition: none; }
    .about-hero-logo__img:hover   { transform: none; }
}


/* ────────────────────────────────────────────────────────────────────────
   GLOBAL MOBILE TUNING
   ────────────────────────────────────────────────────────────────────────
   Cross-page rules that make every Cas-ProClassifier page usable on
   phones (≤ 575.98 px) and small tablets (≤ 767.98 px). All section-
   specific tweaks above (`#structureDocking`, `.metag-…`, etc.) win
   for their own scopes; this block fills the gaps for shared chrome
   (`.lab-shell`, `.lab-main`, hero, generic tables, .btn-sm touch
   targets, the 2-col docs/about layouts). Desktop ≥ 992 px is
   byte-identical — every rule sits inside a max-width media query. */

@media (max-width: 575.98px) {
    /* Containers — the desktop padding values (2-3 rem on every side)
       eat 40-60 % of a 320 px viewport. Shrink to 1 rem / 0.75 rem so
       the actual content has room to breathe. */
    .lab-main      { padding: 1rem 0.75rem 4rem !important; }
    .lab-masthead  { padding: 0.85rem 0.75rem !important; gap: 0.5rem; }
    .lab-shell     { border-radius: 0; }
    .wb-wrap       { padding: 0.75rem 0 3rem; }

    /* Page-title masthead — every page uses `<header class="lab-masthead">`
       containing an h1 that defaults to clamp(2.4rem, 4vw, 3.4rem). At
       ≤ 575 px the clamp() floors at 2.4 rem (~38 px) which dominates a
       phone viewport. Override to 1.35 rem and tighten the supporting
       elements (.stamp, .byline, .meta-rail). */
    .lab-masthead h1 {
        font-size: 1.45rem !important;
        line-height: 1.05 !important;
        letter-spacing: -0.4px !important;
    }
    .lab-masthead .stamp {
        font-size: 0.6rem;
        letter-spacing: 2px;
        padding: 0.18rem 0.5rem;
        margin-bottom: 0.5rem;
    }
    .lab-masthead .byline {
        font-size: 0.65rem;
        letter-spacing: 1px;
        margin-top: 0.3rem;
    }
    /* meta-rail (right-aligned date/version line) wraps awkwardly on
       phones; hide it — the same info is in the footer / docs page. */
    .lab-masthead .meta-rail { display: none; }

    /* Navbar — shrink ICAR plate, tool logo, brand title, and toggler
       so all four sit on a SINGLE line on phones (≤ 575 px). Without
       these aggressive shrinks the brand-title alone (1.6 rem, ~13
       chars for "Cas-ProClassifier") consumes ~210 px and forces the
       hamburger to wrap underneath. The numbers below target a 320 px
       viewport: ICAR plate ~38 px + tool logo ~28 px + brand title at
       0.95 rem ~135 px + toggler ~40 px + gaps/borders ~30 px = ~270
       px, comfortably fitting 320 px wide. */

    /* ICAR plate (left-most) — drop the chunky 76 px height + 58 px
       plate to the same scale as the tool logo. */
    .navbar.navbar-lab                           { padding: 0 !important; }
    .navbar.navbar-lab .logo-frame               { height: 56px; padding: 0 0.4rem; }
    .navbar.navbar-lab .logo-frame .logo-plate   { height: 40px; padding: 2px 4px; }
    .navbar.navbar-lab .logo-frame img           { height: 32px !important; }

    /* Tool logo — was 38 px in the prior pass; reduce further so
       three image-icons (ICAR + tool) don't dominate the navbar. */
    .navbar.navbar-lab .brand-wrap               { padding: 0 0.4rem; gap: 0.35rem; height: 56px; }
    .navbar.navbar-lab .brand-wrap .brand-logo   { height: 32px; max-width: 36px; }

    /* Brand title — shrink the 1.6 rem (≈ 25 px) heading so
       "Cas-ProClassifier" fits in ~135 px instead of ~210 px. */
    .navbar.navbar-lab .brand-wrap .brand-title  {
        font-size: 0.95rem !important;
        letter-spacing: -0.3px !important;
        white-space: nowrap;
    }

    /* Toggler — keep ≥ 40 px tappable but trim padding. */
    .navbar.navbar-lab .navbar-toggler           { padding: 0.3rem 0.45rem; margin: 0 0.4rem; }

    /* Suppress the vertical amber borders on the inner frames (they
       only make sense at full desktop height) so the row reads as
       one continuous strip. */
    .navbar.navbar-lab .logo-frame,
    .navbar.navbar-lab .brand-wrap               { border-right: none !important; }

    /* Hero — the 8 rem insignia and 3 rem column padding overflow
       narrow phones. Drop both proportionally so the dark right-
       column never crowds the cream-stage left-column. */
    .hero-column-left  { padding: 2rem 1rem !important; }
    .hero-column-right { padding: 1.5rem 1rem !important; }
    .hero-insignia     { font-size: 2.6rem !important; }

    /* Result tables — uniform shrink. The `min-width` floors keep
       multi-column tables horizontally scrollable inside the
       `.table-responsive` wrapper (instead of crushing 8-9 cols
       into 1ch each at 320 px viewport). */
    #resultsTable,
    .metag-table,
    .dock-score-table {
        font-size: 0.72rem;
    }
    #resultsTable     { min-width: 680px; }
    #mdGenesTable     { min-width: 720px; }
    .dock-score-table { min-width: 480px; }

    /* Touch targets — Bootstrap's `.btn-sm` defaults to ~32 px tall,
       below the iOS HIG 44 px minimum. Promote to ≥ 44 × 44 px on
       phones so icon-only download / view buttons are tappable. */
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem;
    }
    .btn-sm i { font-size: 0.95rem; }

    /* Textareas — the form `rows="6/8"` attribute makes inputs taller
       than a full phone screen. Cap visual height with min/max so the
       textarea still scrolls internally past the cap. */
    #structureDockForm textarea,
    #metagDiscoverForm textarea,
    #analysisForm     textarea {
        min-height: 6rem;
        max-height: 14rem;
    }
}

@media (max-width: 767.98px) {
    /* Mid-width tablets — wide tables benefit from a font shrink even
       above the phone breakpoint (a 9-column metag genes table at
       760 px wide has ~75 px per column, too narrow without shrink). */
    .metag-table  { font-size: 0.78rem; }
    #mdGenesTable { min-width: 720px; }

    /* Page-title masthead — between phone and desktop, shrink h1 to a
       readable mid-size (1.85 rem ≈ 30 px) and trim padding so the
       block doesn't dwarf the content area on tablets. */
    .lab-masthead   { padding: 1rem 1.25rem; gap: 0.6rem; }
    .lab-masthead h1 {
        font-size: 1.85rem !important;
        line-height: 1.05 !important;
        letter-spacing: -0.5px !important;
    }
    .lab-masthead .stamp    { font-size: 0.65rem; letter-spacing: 2.2px; }
    .lab-masthead .meta-rail { font-size: 0.65rem; line-height: 1.7; }

    /* Documentation — the desktop 2-column layout (TOC sidebar +
       tab-content main) is unusable on phones because each side
       gets ~150 px of width. Flip `.lab-body` to a single-column
       block stack: TOC becomes a horizontal pill row above the
       prose, content flows full-width below. */
    .lab-body {
        display: block;
    }
    .lab-side-left,
    .lab-body > .lab-main {
        width: 100%;
        max-width: 100%;
    }
    .lab-side-left {
        padding: 0 0 1.25rem;
        border-bottom: 1px solid #e7d8a6;
        margin-bottom: 1.25rem;
    }
    .lab-doc-nav .list-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .lab-doc-nav .list-group-item {
        flex: 0 0 auto;
        border-radius: 0.4rem !important;
    }

    /* About page — `.about-grid` is a 2-col CSS grid by default;
       collapse to single-column so each `.about-cell` gets the full
       viewport width. */
    .about-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }
}
