:root {
    --primary: #1a3a2a;
    --primary-light: #2c5a43;
    --accent: #d4a843;
    --accent-hover: #e8bd58;
    --bg: #f8f9f6;
    --surface: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e5df;
    --error: #d32f2f;
    --success: #388e3c;
    --info: #1976d2;
    --warning: #f57c00;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.panel-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Upload Area */
.upload-zone {
    border: 2px dashed var(--primary-light);
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f0f4f1;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover, .upload-zone.dragover {
    background-color: #e3ebe6;
    border-color: var(--primary);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 500;
    color: var(--primary);
}

.upload-subtext {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

#file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #f0f4f1;
    display: none;
    z-index: 10;
}

.remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    color: var(--error);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    align-items: center;
    justify-content: center;
}

.remove-image:hover {
    background: white;
    transform: scale(1.1);
}

/* Controls */
.controls-section {
    margin-top: 2rem;
}

.pipeline-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pipeline-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pipeline-card:hover {
    border-color: var(--primary-light);
    background-color: #f9fbf9;
}

.pipeline-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.pipeline-card input[type="radio"]:checked + .card-content {
    color: var(--primary);
}

.pipeline-card:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background-color: #f0f4f1;
    box-shadow: 0 0 0 1px var(--primary);
}

.pipeline-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pipeline-desc {
    font-size: 0.85rem;
    color: var(--text-light);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-light);
}

.btn-accent {
    background-color: var(--accent);
    color: var(--primary);
}

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

/* Results Area */
.results-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    background: #f9fbf9;
    border-radius: 8px;
    border: 1px dashed var(--border);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.loading-state {
    display: none;
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(26, 58, 42, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.error-message {
    display: none;
    background-color: #ffebee;
    color: var(--error);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--error);
    margin-bottom: 1rem;
}

.result-container {
    display: none;
}

.main-prediction {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.prediction-name {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin: 0;
}

.prediction-confidence {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

.pipeline-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.latency-badge {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 4px;
}

.details-section {
    background: #f9fbf9;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.details-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* Pipeline Specific Styles */
/* Pipeline A: Nearest Neighbor */
.neighbor-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.neighbor-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.neighbor-name {
    font-weight: 500;
}
.neighbor-score {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Pipeline B & D: Reasoning */
.reasoning-text {
    white-space: pre-wrap;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}
.context-used {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-light);
    background: #f0f4f1;
    padding: 0.8rem;
    border-radius: 6px;
}

/* Pipeline C: Classifier */
.prob-bar-container {
    margin-bottom: 0.8rem;
}
.prob-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.prob-bar-bg {
    height: 8px;
    background: #e0e5df;
    border-radius: 4px;
    overflow: hidden;
}
.prob-bar-fill {
    height: 100%;
    background: var(--primary-light);
    border-radius: 4px;
}

/* Compare View */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    display: none;
}

@media (min-width: 768px) {
    .compare-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.compare-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.compare-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compare-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
}

.compare-latency {
    font-size: 0.8rem;
    background: rgba(0,0,0,0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.compare-body {
    padding: 1.5rem;
    text-align: center;
}

.compare-prediction {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.compare-confidence {
    display: inline-block;
    background: #f0f4f1;
    color: var(--primary-light);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ---- Navigation ---- */
.top-nav {
    background-color: var(--primary);
    border-bottom: 3px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 0.25rem;
}
.nav-brand {
    font-family: 'Playfair Display', serif;
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.75rem 1rem 0.75rem 0;
    margin-right: 1.5rem;
    border-right: 1px solid rgba(255,255,255,0.15);
    text-decoration: none;
    white-space: nowrap;
}
.nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}
.nav-link.active {
    color: white;
    border-bottom-color: var(--accent);
}
.nav-link.nav-admin {
    margin-left: auto;
    color: var(--accent);
}
.nav-link.nav-admin:hover,
.nav-link.nav-admin.active {
    color: var(--accent-hover);
    border-bottom-color: var(--accent);
}
.nav-button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* Mobile nav */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding-bottom: 0.5rem;
    }
    .nav-links.open { display: flex; }
    .nav-inner { flex-wrap: wrap; }
    .nav-link { border-bottom: none; padding: 0.6rem 1rem; }
    .nav-link.nav-admin { margin-left: 0; }
}
@media (min-width: 769px) {
    .nav-links {
        display: flex;
        align-items: center;
        flex: 1;
    }
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease forwards;
    animation-delay: 0s, var(--toast-duration, 4s);
    font-size: 0.9rem;
}
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-info { border-left: 4px solid var(--info); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1rem;
    margin-left: auto;
    padding: 0 0.25rem;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- Page Containers ---- */
.page { display: none; }
.page.active { display: block; }

.page-header {
    margin-bottom: 2rem;
}
.page-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}
.page-header p {
    color: var(--text-light);
    font-size: 1rem;
}

/* ---- Stats Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
}
.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- Species Browser ---- */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.search-input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: border-color var(--transition);
}
.search-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44, 90, 67, 0.1);
}
.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.species-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all var(--transition);
    cursor: default;
}
.species-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}
.species-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.species-card.is-empty {
    background: #fafaf7;
    border-style: dashed;
}
.species-card.is-cultivar {
    border-left: 3px solid #b58c00;
}
.species-card.is-legacy {
    border-color: #c98a3c;
    background: #fff7ec;
}
.species-name {
    font-weight: 600;
    font-style: italic;
    color: var(--primary);
}
.species-count {
    background: #f0f4f1;
    color: var(--primary-light);
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    align-self: flex-start;
}
.species-count-empty {
    background: transparent;
    color: var(--text-light);
    font-weight: 500;
    padding-left: 0;
}
.species-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.species-tag-cultivar {
    background: #fff4d4;
    color: #8a6500;
}
.species-tag-legacy {
    background: #ffe7d2;
    color: #8a4a14;
}
.species-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 130px;
}
.summary-card.summary-warn {
    border-color: #c98a3c;
    background: #fff7ec;
}
.summary-num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.summary-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}
.species-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.filter-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.filter-chip:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}
.filter-chip.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ---- Ingest Form ---- */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text);
}
.form-label .required {
    color: var(--error);
}
.form-label .optional {
    color: var(--text-light);
    font-weight: normal;
    font-size: 0.85em;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44, 90, 67, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input.input-invalid {
    border-color: #c0392b;
    background-color: #fdecea;
}
.form-input.input-invalid:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ---- Admin Panel ---- */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 900px) {
    .admin-grid { grid-template-columns: 1fr 1fr; }
}
.admin-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.admin-section-header {
    background: #f9fbf9;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}
.admin-section-body { padding: 1.25rem; }

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: var(--success); }
.status-dot.red { background: var(--error); }
.status-dot.yellow { background: var(--warning); }

.kv-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--text-light); }
.kv-val { font-weight: 600; color: var(--text); }

/* Data Table */
.data-table-wrapper { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th, .data-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: #f9fbf9;
    font-weight: 600;
    color: var(--primary);
    position: sticky;
    top: 0;
}
.data-table tr:hover td { background: #fafcfa; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-light);
}
.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-light);
    color: var(--primary);
}
.btn-danger {
    background-color: var(--error);
    color: white;
}
.btn-danger:hover:not(:disabled) {
    background-color: #b71c1c;
}
.btn-success {
    background-color: var(--success);
    color: white;
}
.btn-success:hover:not(:disabled) {
    background-color: #2e7d32;
}
.btn-warning {
    background-color: var(--warning);
    color: white;
}

/* ---- Footer ---- */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    margin-top: auto;
}
.site-footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ---- Identify Page Layout ---- */
.identify-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
@media (min-width: 900px) {
    .identify-layout {
        grid-template-columns: 350px 1fr;
    }
}

/* ---- Compare View Enhancements ---- */
.compare-card.agree {
    border-color: var(--success);
    border-width: 2px;
}
.compare-card.agree .compare-header {
    background: var(--success);
}
.compare-card.disagree .compare-header {
    background: var(--text-light);
}
.compare-summary {
    background: #f9fbf9;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
}
.compare-view-count {
    display: inline-block;
    background: var(--accent);
    color: var(--primary);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* ---- Multi-Upload Area ---- */
.multi-upload-area {
    margin-top: 1rem;
}
.upload-zone.compact {
    min-height: 70px;
    padding: 1rem;
}
.upload-zone.compact .upload-icon { display: none; }
.upload-zone.compact .upload-text { font-size: 0.9rem; }
.upload-zone.compact .upload-subtext { font-size: 0.8rem; }

.quick-select-bar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #f0f4f1;
    border-radius: var(--radius-sm);
}
.quick-select-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    margin-right: 0.25rem;
}
.quick-btn {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}
.quick-btn:hover {
    border-color: var(--primary-light);
    background: #e3ebe6;
    color: var(--primary);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.thumb-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    transition: border-color var(--transition);
}
.thumb-card:hover {
    border-color: var(--primary-light);
}
.thumb-image-wrap {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f0f4f1;
}
.thumb-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255,255,255,0.9);
    color: var(--error);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform var(--transition);
}
.thumb-remove:hover {
    transform: scale(1.15);
    background: white;
}
.thumb-view-select {
    width: 100%;
    padding: 0.3rem 0.25rem;
    border: none;
    border-top: 1px solid var(--border);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: var(--text);
    background: #fafcfa;
    cursor: pointer;
}
.thumb-view-select:focus {
    outline: none;
    background: #f0f4f1;
}

.file-count {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    padding: 0.25rem 0;
}
.file-limit-warning {
    color: var(--warning);
    font-weight: 600;
}

/* ---- Upload Progress ---- */
.upload-progress {
    width: 80%;
    max-width: 300px;
    margin: 1rem auto 0;
}
.upload-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--primary-light);
    border-radius: 3px;
    animation: progressSlide 1.2s ease-in-out infinite;
}
@keyframes progressSlide {
    0% { left: -40%; }
    100% { left: 100%; }
}
.upload-progress-text {
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 0.4rem;
}

/* ---- Multi-View Result Badge ---- */
.multi-view-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ---- Per-View Breakdown ---- */
.per-view-section {
    margin-top: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.per-view-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f0f4f1;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
    transition: background var(--transition);
    user-select: none;
}
.per-view-toggle:hover {
    background: #e3ebe6;
}
.toggle-arrow {
    font-size: 0.85rem;
    transition: transform var(--transition);
}
.toggle-arrow.open {
    transform: rotate(90deg);
}
.per-view-list {
    display: none;
}
.view-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.view-item:last-child { border-bottom: none; }
.view-item.agree {
    background: rgba(56, 142, 60, 0.06);
    border-left: 3px solid var(--success);
}
.view-item.disagree {
    background: rgba(245, 124, 0, 0.06);
    border-left: 3px solid var(--warning);
}
.view-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.view-type-tag {
    display: inline-block;
    background: #f0f4f1;
    color: var(--primary-light);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    min-width: 60px;
    text-align: center;
    flex-shrink: 0;
}
.view-match {
    flex: 1;
    font-style: italic;
    color: var(--text);
}
.view-score {
    font-weight: 600;
    color: var(--primary-light);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* View type highlights in reasoning */
.view-type-highlight {
    background: rgba(212, 168, 67, 0.2);
    color: var(--primary);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-weight: 600;
}

/* ---- Contributor Upload Enhancements ---- */
.ingest-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}
.confirmation-banner {
    background: rgba(56, 142, 60, 0.08);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    color: var(--success);
    font-weight: 600;
    margin-top: 1rem;
}

/* ---- Guided Capture (Advanced) ---- */
.ingest-mode-btn {
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    text-align: center;
}
.ingest-mode-btn:hover {
    color: var(--text);
}
.guided-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.guided-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.guided-card.dragover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}
.guided-card.filled {
    border-color: var(--success);
    background: #fafdfb;
}
.guided-card-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: #fbfcfb;
}
.guided-card-num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.78em;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.guided-card-icon {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}
.guided-card-title {
    font-weight: 700;
    font-size: 0.96em;
    line-height: 1.2;
}
.guided-card-short {
    font-size: 0.82em;
    color: var(--text-light);
    margin-top: 2px;
}
.guided-status {
    font-size: 1.1em;
    line-height: 1;
    margin-top: 2px;
}
.guided-optional-tag {
    display: inline-block;
    font-size: 0.7em;
    font-weight: 500;
    color: var(--text-light);
    background: #eef2ee;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.guided-card-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.guided-why, .guided-tip {
    font-size: 0.82em;
    color: var(--text);
    line-height: 1.4;
}
.guided-why strong, .guided-tip strong {
    color: var(--primary);
    font-weight: 600;
}
.guided-slot {
    margin-top: 4px;
}
.guided-slot-empty {
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    background: #fafbfa;
}
.guided-slot-empty .btn-outline {
    background: #fff;
}
.guided-slot-filled {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4 / 3;
}
.guided-slot-filled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.guided-slot-actions {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    display: flex;
    gap: 6px;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    opacity: 0;
    transition: opacity 0.15s;
}
.guided-slot-filled:hover .guided-slot-actions {
    opacity: 1;
}
.guided-slot-actions button {
    flex: 1;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
}
.guided-slot-actions .guided-remove {
    color: var(--error);
}
.guided-slot-actions button:hover {
    background: #fff;
}
