/* ==========================================================================
   Microplastics Webserver — Stylesheet (Academic Style)
   ========================================================================== */

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

/* Body */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    color: #212529;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.75rem;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #0d6efd;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 6px;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #212529;
}

.nav-link.active {
    background-color: #e9ecef;
    color: #212529;
}

/* Main Content */
.main-content {
    flex: 1;
    background-color: #f8f9fa;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.main-column {
    min-width: 0;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1rem;
    color: #6c757d;
    margin: 0;
}

/* Form Sections */
.form-section {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.section-desc {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.section-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.75rem;
    font-style: italic;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #ffffff;
    font-size: 0.9rem;
}

.field-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary {
    background-color: #1a365d;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #14294a;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* Demo Section */
.demo-section {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.sample-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.sample-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.sample-card-info {
    display: flex;
    flex-direction: column;
}

.sample-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
}

.sample-count {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

.sample-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Button size variants */
.btn-sm {
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

.sample-form {
    width: 100%;
}

.sample-form .btn-sm {
    width: 100%;
    display: block;
}

.btn-outline {
    background-color: transparent;
    color: #1a365d;
    border: 1px solid #1a365d;
}

.btn-outline:hover {
    background-color: #1a365d;
    color: #ffffff;
}

/* Disclaimer */
.disclaimer {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #856404;
    margin-top: 1.5rem;
}

/* Sidebar */
.sidebar {
    min-width: 0;
}

.sidebar-section {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-list dt {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.sidebar-list dd {
    margin-left: 0;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
}

/* Messages (legacy) */
.message {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    border-radius: 4px;
}

.message.error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.message.info {
    background-color: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

/* Results table (used by results.html) */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th {
    background-color: #343a40;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    text-align: left;
    position: sticky;
    top: 0;
}

.results-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.results-table tr.error-row {
    background-color: #f8d7da;
}

.results-table tr:hover {
    background-color: #f1f3f5;
}

/* Download links */
.download-links {
    margin-top: 1.5rem;
}

.download-links a {
    margin-right: 1rem;
    color: #0d6efd;
    text-decoration: none;
}

.download-links a:hover {
    text-decoration: underline;
}

/* Table scroll container */
.table-scroll-container {
    max-height: 70vh;
    overflow-y: auto;
}

/* Result image thumbnails */
.image-cell {
    width: 80px;
    padding: 2px !important;
}

.result-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: transform 0.15s;
}

.result-thumb:hover {
    transform: scale(1.1);
}

/* Filename links */
.filename-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.filename-link:hover {
    text-decoration: underline;
}

/* Image Detail Page
   ========================================================================== */
.image-detail-page {
    max-width: 960px;
    margin: 0 auto;
}

.detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.back-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
}

.back-link:hover {
    text-decoration: underline;
}

.nav-run-id {
    font-size: 0.85rem;
    color: #6c757d;
}

.image-detail-page h1 {
    font-size: 1.6rem;
    text-align: left;
    margin-bottom: 1.25rem;
    word-break: break-all;
}

.detail-content {
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

@media (max-width: 768px) {
    .detail-content {
        flex-direction: column;
    }
}

/* Image section */
.detail-image-section {
    flex: 1;
    min-width: 0;
}

.detail-image-section h2,
.detail-predictions-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #343a40;
}

.image-container {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.full-size-image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 4px;
}

/* Predictions section */
.detail-predictions-section {
    flex: 1;
    min-width: 0;
}

/* Individual prediction card */
.prediction-section {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.prediction-section.prediction-unavailable {
    opacity: 0.6;
}

.prediction-title {
    font-size: 0.95rem;
    color: #495057;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.prediction-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.predicted-label {
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
    padding: 0.2rem 0.6rem;
    background-color: #e8f4fd;
    border-radius: 4px;
}

.predicted-confidence {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Probability bars */
.probability-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.prob-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prob-label {
    width: 100px;
    font-size: 0.82rem;
    color: #495057;
    text-align: right;
    flex-shrink: 0;
}

.prob-bar-track {
    flex: 1;
    height: 16px;
    background-color: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.prob-bar {
    height: 100%;
    background-color: #0d6efd;
    border-radius: 8px;
    transition: width 0.3s ease;
}

.prob-value {
    width: 48px;
    font-size: 0.82rem;
    color: #6c757d;
    text-align: right;
    flex-shrink: 0;
}

/* Unavailable note */
.unavailable-note {
    font-size: 0.85rem;
    color: #adb5bd;
    font-style: italic;
}

/* Model notes */
.model-notes {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.model-notes h3 {
    font-size: 0.85rem;
    color: #664d03;
    margin-bottom: 0.25rem;
}

.model-notes p {
    font-size: 0.82rem;
    color: #856404;
}

/* Documentation Page Styles */
.doc-section {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.doc-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.subsection-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #343a40;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.doc-text {
    font-size: 0.95rem;
    color: #495057;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.doc-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 1rem;
}

.doc-list li {
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.95rem;
    color: #495057;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.doc-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6c757d;
    font-weight: bold;
}

.doc-details {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
}

.doc-details p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #495057;
}

.doc-details ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.doc-details ul li {
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.25rem;
}

.doc-details ul li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: #6c757d;
}

.note-box {
    background-color: #e8f4fd;
    border: 1px solid #b6d4fe;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #084298;
}

.warning-box {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #856404;
}

.code-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    color: #495057;
    overflow-x: auto;
}

.sidebar-links {
    list-style: none;
    padding-left: 0;
}

.sidebar-links li {
    margin-bottom: 0.5rem;
}

.sidebar-links a {
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.sidebar-links a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.sidebar-text {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem;
    }

    .sidebar {
        order: -1;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .sample-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo-area {
        flex-direction: column;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Workflow: step indicator
   ========================================================================== */
.workflow-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
}
.step {
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    white-space: nowrap;
}
.step.active {
    background-color: #1a365d;
    color: #fff;
    font-weight: 600;
}
.step.done {
    color: #1a365d;
    font-weight: 500;
}
.step-sep {
    color: #adb5bd;
}

/* ==========================================================================
   Workflow: card (centered single-column pages)
   ========================================================================== */
.content-centered {
    justify-content: center;
}
.workflow-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 2rem 2.5rem;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}
.workflow-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 0.4rem;
}
.workflow-subtitle {
    color: #6c757d;
    margin-bottom: 1.25rem;
}
.workflow-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.75rem;
}
.workflow-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   Progress bar
   ========================================================================== */
.progress-track {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.progress-bar {
    height: 100%;
    background-color: #1a365d;
    border-radius: 5px;
    transition: width 0.3s ease;
}
.progress-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: right;
    margin-bottom: 0.75rem;
}
.progress-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.progress-current {
    font-size: 0.85rem;
    color: #495057;
    min-height: 1.2em;
}

/* ==========================================================================
   File list (uploading page)
   ========================================================================== */
.file-list {
    list-style: none;
    margin-top: 0.75rem;
}
.file-item {
    font-size: 0.85rem;
    color: #495057;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f1f3f5;
}

/* ==========================================================================
   Validation grid
   ========================================================================== */
.validation-summary {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.vsummary-item {
    padding: 0.25rem 0.7rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
    background: #f1f3f5;
    color: #495057;
}
.vsummary-pass  { background: #d4edda; color: #155724; }
.vsummary-warn  { background: #fff3cd; color: #856404; }
.vsummary-fail  { background: #f8d7da; color: #721c24; }
.vsummary-total { background: #e9ecef; color: #212529; }

.validation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
}
.vcard {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.vcard-pass { border-left: 3px solid #28a745; }
.vcard-warn { border-left: 3px solid #ffc107; }
.vcard-fail { border-left: 3px solid #dc3545; }

.vcard-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #f8f9fa;
}
.vcard-nothumb {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    color: #adb5bd;
    font-size: 0.8rem;
}
.vcard-body {
    padding: 0.6rem 0.75rem;
}
.vcard-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}
.vbadge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    margin-bottom: 0.4rem;
}
.vbadge-pass { background: #d4edda; color: #155724; }
.vbadge-warn { background: #fff3cd; color: #856404; }
.vbadge-fail { background: #f8d7da; color: #721c24; }

.vcard-meta {
    font-size: 0.72rem;
    color: #6c757d;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.4rem;
    row-gap: 0.1rem;
    margin-bottom: 0.3rem;
}
.vcard-meta dt { font-weight: 500; color: #495057; }
.vcard-issue   { font-size: 0.72rem; color: #721c24; margin-top: 0.2rem; }
.vcard-warning { font-size: 0.72rem; color: #856404; margin-top: 0.2rem; }

/* ==========================================================================
   Alert variants
   ========================================================================== */
.alert-warn {
    background-color: #fff3cd;
    border: 1px solid #ffecb5;
    color: #856404;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

/* ==========================================================================
   Results grid (thumbnail cards)
   ========================================================================== */
.results-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.rsummary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f1f3f5;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    min-width: 70px;
}
.rsummary-num   { font-size: 1.5rem; font-weight: 700; color: #212529; }
.rsummary-label { font-size: 0.75rem; color: #6c757d; }
.rsummary-success .rsummary-num { color: #28a745; }
.rsummary-fail    .rsummary-num { color: #dc3545; }

.batch-downloads {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.batch-downloads strong { margin-right: 0.25rem; }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.rcard {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.rcard-error { border-left: 3px solid #dc3545; }

.rcard-thumb-link { display: block; }
.rcard-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #f8f9fa;
    transition: opacity 0.15s;
}
.rcard-thumb:hover { opacity: 0.85; }
.rcard-nothumb {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    color: #adb5bd;
    font-size: 0.8rem;
}
.rcard-body {
    padding: 0.65rem 0.8rem;
}
.rcard-name {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.35rem;
}
.rcard-name a { color: #1a365d; text-decoration: none; }
.rcard-name a:hover { text-decoration: underline; }

.rcard-predictions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.3rem;
}
.rcard-conf { font-size: 0.72rem; color: #6c757d; }
.rcard-dino { font-size: 0.72rem; color: #6c757d; margin-bottom: 0.3rem; }
.rcard-error-msg { font-size: 0.75rem; color: #721c24; margin-bottom: 0.3rem; }

.rbadge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.rbadge-shape  { background: #d1ecf1; color: #0c5460; }
.rbadge-fiber  { background: #d4edda; color: #155724; }
.rbadge-micro  { background: #e2d9f3; color: #4a235a; }
.rbadge-error  { background: #f8d7da; color: #721c24; }

.rcard-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.4rem;
}
.btn-xs {
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

/* ==========================================================================
   Range input
   ========================================================================== */
.range-input {
    width: 100%;
    margin: 0.5rem 0;
    accent-color: #1a365d;
}

/* ==========================================================================
   Metadata CSV upload UI
   ========================================================================== */
.optional-label { display: flex; align-items: center; gap: 0.4rem; }
.optional-tag {
    font-size: 0.7rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #4a5568;
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.csv-format-link {
    font-size: 0.8rem;
    color: #1a365d;
    cursor: pointer;
    text-decoration: underline;
}
.csv-format-box {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}
.csv-example {
    background: #edf2f7;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    overflow-x: auto;
    margin: 0.4rem 0 0.75rem;
}

/* ==========================================================================
   Ground truth tags (validate + results pages)
   ========================================================================== */
.gt-box, .rcard-gt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed #e2e8f0;
}
.gt-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
}
.gt-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #2d3748;
    font-weight: 500;
}
.gt-size { background: #bee3f8; color: #2b6cb0; }
.gt-type { background: #fefcbf; color: #744210; }

/* ground truth match / mismatch on shape badge */
.badge-match  { background: #276749 !important; color: #fff !important; }
.badge-mismatch { background: #9b2c2c !important; color: #fff !important; }
.gt-match  { background: #c6f6d5; color: #22543d; font-weight: 700; }
.gt-mismatch { background: #fed7d7; color: #742a2a; font-weight: 700; }

/* ==========================================================================
   Results accuracy summary
   ========================================================================== */
.rsummary-accuracy .rsummary-num { color: #1a365d; }
.gt-banner {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #2c5282;
    margin-bottom: 1rem;
}

/* Image detail ground truth panel */
.detail-gt-section { border-left: 3px solid #1a365d; }
.gt-detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.875rem;
    margin: 0.5rem 0 0;
}
.gt-detail-list dt { color: #718096; font-weight: 600; white-space: nowrap; }
.gt-detail-list dd { margin: 0; }
.detail-gt-value {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
}
.detail-gt-value.gt-match  { background: #c6f6d5; color: #22543d; }
.detail-gt-value.gt-mismatch { background: #fed7d7; color: #742a2a; }
.predicted-label.label-match    { background: #276749; color: #fff; }
.predicted-label.label-mismatch { background: #9b2c2c; color: #fff; }
