/* ─── Farm Menu Panel ("..." repo tree dropdown) ────────────────────────── */
.farm-menu-panel.hidden {
    display: none;
}

.farm-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    max-height: min(420px, calc(100vh - 120px));
    background: var(--floating-island-bg);
    border: var(--floating-island-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    padding: 6px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.55) transparent;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.farm-menu-panel::-webkit-scrollbar {
    width: 7px;
}

.farm-menu-panel::-webkit-scrollbar-track {
    background: transparent;
}

.farm-menu-panel::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.5);
    border-radius: 999px;
}

.farm-menu-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.7);
}

.farm-menu-group {
    padding: 0;
}

.farm-menu-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(61, 61, 58, 0.45);
    font-family: var(--font-primary);
}

.farm-menu-group-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.farm-menu-group-header .farm-menu-item-actions {
    text-transform: none;
    letter-spacing: 0;
}

.farm-menu-group-header:hover .farm-menu-item-actions,
.farm-menu-group-header:hover .farm-menu-action-btn {
    opacity: 0.55;
}

.farm-menu-batch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 4px 18px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(61, 61, 58, 0.7);
    font-family: var(--font-primary);
}

.farm-menu-batch-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.farm-menu-batch-meta {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 500;
    color: rgba(61, 61, 58, 0.5);
}

.farm-menu-batch + .farm-menu-item {
    padding-left: 32px;
}

.farm-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 24px;
    font-size: 12.5px;
    font-weight: 500;
    color: #3D3D3A;
    font-family: var(--font-primary);
}

.farm-menu-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.farm-menu-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s;
}

.farm-menu-item:hover .farm-menu-item-actions,
.farm-menu-item:hover .farm-menu-action-btn {
    opacity: 0.55;
}

.farm-menu-action-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #3D3D3A;
    opacity: 0.55;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: background 0.12s, color 0.12s, opacity 0.12s;
}

.farm-menu-action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    opacity: 1;
}

.farm-menu-action-btn[data-action="delete"]:hover {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
    opacity: 1;
}

.farm-menu-divider {
    height: 1px;
    background: rgba(51, 123, 48, 0.1);
    margin: 4px 0;
}

/* ─── No Map Available Overlay ──────────────────────────────────────────── */
.no-map-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.6);
    z-index: 500;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.no-map-overlay.hidden {
    display: none;
}

.no-map-message {
    position: relative;
    text-align: center;
    color: var(--text-primary);
    padding: 40px 48px;
    background: rgba(253, 252, 248, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--modal-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 48px rgba(28, 28, 25, 0.15);
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.no-map-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.no-map-close svg {
    display: block;
    flex-shrink: 0;
    margin: 0;
    opacity: 1;
    color: inherit;
}

.no-map-close:hover {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
}

/* icon svg only — use :not to exclude the close button svg */
.no-map-message > svg {
    color: var(--primary);
    margin-bottom: 16px;
    opacity: 0.9;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.no-map-message h3 {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.no-map-message p {
    font-size: 12px;
    font-family: var(--font-secondary);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 4px;
}

/* ─── Pipeline Progress (inside upload modal) ───────────────────────────── */
.pipeline-progress {
    padding: 8px 0;
}

/* Spinner + message row */
.pipeline-spinner-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.pipeline-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(31,71,129,0.2);
    border-top-color: var(--brand-navy);
    border-radius: 50%;
    flex-shrink: 0;
    animation: spin 0.8s linear infinite;  /* global keyframe in utilities.css */
}

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

.pipeline-progress-msg {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
}

.pipeline-progress-track {
    background: #e5e7eb;
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
}

/* Shimmering bar so the user can see it's alive even when % barely moves */
.pipeline-progress-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
    background: linear-gradient(
        90deg,
        var(--green-primary, #698F3F) 0%,
        #9bbf5a 50%,
        var(--green-primary, #698F3F) 100%
    );
    background-size: 200% 100%;
    animation: pipeline-shimmer 1.8s ease-in-out infinite;
}

@keyframes pipeline-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.pipeline-progress-eta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    min-height: 1.4em; /* prevent layout jump when text appears */
}

/* ─── UI Progress Stepper (replaces .pipeline-progress for job runs) ─────────
   docs/planning/ui-progress-stepper.md. Rendered by frontend/js/stepper.js
   inside #uploadModal .modal-body when a job is in flight. */
.stepper-container {
    padding: 8px 4px;
    font-family: 'Montserrat', sans-serif;
}
.stepper-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.stepper-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 4px;
    border-radius: 8px;
    position: relative;
    transition: background 0.18s ease, opacity 0.18s ease;
}
/* Vertical connector line between icons */
.stepper-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 13px;            /* center of the 26px icon */
    top: 32px;             /* below the icon */
    bottom: -6px;          /* into the next row's gap */
    width: 2px;
    background: #e5e7eb;
    z-index: 0;
}
.stepper-step.stepper-done:not(:last-child)::before,
.stepper-step.stepper-reused:not(:last-child)::before {
    background: var(--primary, #337B30);
}
.stepper-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f4f5;
    color: #a1a1aa;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    z-index: 1;             /* sit above the connector line */
    position: relative;
}
.stepper-pending .stepper-icon .stepper-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c4c4c8;
    display: inline-block;
}
.stepper-done .stepper-icon,
.stepper-reused .stepper-icon {
    background: var(--primary, #337B30);
    color: #fff;
}
/* "Reused from previous run" subtext sits at slightly reduced opacity so the
   step still reads as "complete" but the user can tell it wasn't re-run. */
.stepper-reused .stepper-subtext {
    font-style: italic;
    color: var(--text-secondary, #71717a);
}
.stepper-active .stepper-icon {
    background: var(--primary, #337B30);
    color: #fff;
}
.stepper-failed .stepper-icon {
    background: #ef4444;
    color: #fff;
}
.stepper-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pipeline-spin 0.8s linear infinite;
}
.stepper-text {
    flex: 1;
    min-width: 0;
    padding-top: 3px;
}
.stepper-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #3D3D3A);
}
.stepper-pending .stepper-label {
    color: #9ca3af;
    font-weight: 500;
}
.stepper-subtext {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary, #71717a);
    line-height: 1.4;
}

/* Parallel-tracks section for dual-dispatch ODM jobs. Two side-by-side
   columns sit between the linear prefix (uploading → downloading) and the
   linear suffix (merging → complete). Each column drives off its own
   per-stage phase field (map_phase / detections_phase) so the visible state
   doesn't ping-pong as the c6 and g4 workers race on `phase` writes. */
.stepper-parallel {
    display: flex;
    gap: 12px;
    margin: 4px 0;
    padding: 8px 4px 4px;
    border-top: 1px dashed #e5e7eb;
    border-bottom: 1px dashed #e5e7eb;
}
.stepper-track {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stepper-track-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary, #71717a);
    padding: 0 4px 2px;
}
/* Inside a track, suppress the vertical connector that pokes into the
   linear suffix below — each track is self-contained. */
.stepper-track .stepper-step:not(:last-child)::before {
    bottom: -6px;
}
.stepper-track .stepper-step:last-child::before {
    display: none;
}

/* Footer line: elapsed / ETA / success / error */
/* Upload progress bar — appears only while phase=uploading, sits between
   the phase rows and the footer. Per-file updates from
   _handlePollUpdate make the fill animate smoothly. */
.stepper-upload-bar {
    position: relative;
    margin: 16px 0 6px;
    height: 10px;
    background: #eef0f2;
    border-radius: 5px;
    overflow: hidden;
}
.stepper-upload-bar-fill {
    height: 100%;
    background: var(--primary, #337B30);
    border-radius: 5px;
    transition: width 0.25s ease;
}
.stepper-upload-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.04em;
    pointer-events: none;
}

/* ETA-driven progress bar — appears below the step list once processing
   starts (not during upload — upload has its own bar). Uses a slow ease so
   the bar fills smoothly even when the parent stepper re-renders sparsely.
   Catchup logic in eta-model.js makes the bar jump forward when a stage
   finishes early; the ease softens the jump visually. */
.stepper-progress-bar {
    position: relative;
    margin: 14px 0 6px;
    height: 12px;
    background: #eef0f2;
    border-radius: 6px;
    overflow: hidden;
}
.stepper-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #337B30), #4a9d44);
    border-radius: 6px;
    transition: width 0.8s ease-out;
}
.stepper-progress-bar-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.45);
    letter-spacing: 0.04em;
    pointer-events: none;
}

.stepper-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: var(--text-secondary, #71717a);
    line-height: 1.5;
}
.stepper-elapsed { font-weight: 600; color: var(--text-primary, #3D3D3A); }
.stepper-remaining { color: var(--text-secondary, #71717a); }
.stepper-footer-success {
    color: var(--primary, #337B30);
    font-weight: 600;
    font-size: 14px;
}
.stepper-footer-cancel {
    color: #b45309;
    font-weight: 500;
}
.stepper-footer-error {
    color: #ef4444;
}
.stepper-footer-error strong {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}
.stepper-error-msg {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary, #3D3D3A);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 10px;
}
.stepper-error-warning {
    margin: -4px 0 12px;
    font-size: 12px;
    line-height: 1.4;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 6px 10px;
}
.stepper-error-details {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-primary, #3D3D3A);
}
.stepper-error-details summary {
    cursor: pointer;
    color: #6b7280;
    user-select: none;
}
.stepper-error-details summary:hover {
    color: var(--text-primary, #3D3D3A);
}
.stepper-error-raw {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* ─── Floating job widget (bottom-right; shown when upload modal is "X"ed)
   Two states sharing one container, so the widget literally extends upward
   into a queue list rather than spawning a separate drawer.
     • Collapsed: just .widget-focused-row visible (compact pill).
     • Expanded (.expanded): .widget-queue-area animates open above the
       focused-row, growing the widget's overall height. */
.job-minimized.hidden { display: none; }
.job-minimized {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 950;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 240px;
    max-width: 360px;
    width: 280px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: box-shadow 0.18s ease, width 0.22s cubic-bezier(0.34, 1.2, 0.5, 1);
}
.job-minimized:hover {
    box-shadow: 0 14px 36px rgba(0,0,0,0.16);
}
.job-minimized.expanded {
    width: 320px;
    cursor: default;
}
/* Focused-row: always-visible summary at the bottom of the widget.
   When the widget is expanded, the focused job is rendered as a regular
   queue row inside .widget-queue-list (so it inherits the cancel-×,
   elapsed slot, and progress bar). Hide the compact-pill version in that
   state to avoid duplicating the same job. */
.widget-focused-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}
.job-minimized.expanded .widget-focused-row { display: none; }
/* Queue area: hidden when collapsed, animates open when .expanded.
   max-height transition gives the impression of the widget growing upward. */
.widget-queue-area {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    border-bottom: 1px solid transparent;
    transition: max-height 0.26s cubic-bezier(0.34, 1.2, 0.5, 1),
                opacity 0.18s ease,
                border-bottom-color 0.18s ease;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.job-minimized.expanded .widget-queue-area {
    max-height: 50vh;
    opacity: 1;
    border-bottom-color: #eef0f2;
}
.widget-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--panel-header-bg);
    color: #fff;
    font-family: var(--font-primary, 'Montserrat', sans-serif);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid transparent;
    flex-shrink: 0;
    cursor: default;
}
.widget-queue-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.job-minimized-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary, #337B30);
    border-radius: 50%;
    flex-shrink: 0;
    animation: pipeline-spin 0.8s linear infinite;
}
.job-minimized-text {
    flex: 1;
    min-width: 0;
}
.job-minimized-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #3D3D3A);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.job-minimized-elapsed {
    font-size: 11px;
    color: var(--text-secondary, #71717a);
    margin-top: 2px;
}

/* "+N more" badge on the focused widget — opens the jobs drawer.
   Hidden when the widget is expanded so the focused-row matches the styling
   of the other queue rows above it (no pill / count chrome). */
.job-queue-badge.hidden,
.job-minimized.expanded .job-queue-badge { display: none; }
.job-queue-badge {
    flex-shrink: 0;
    margin-left: 6px;
    padding: 4px 9px;
    background: var(--primary, #337B30);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.job-queue-badge:hover { background: #2c6a28; }

/* Header × button inside the expanded widget — sits on the green band, so it
   mirrors .close-modal: subtle white-on-dark chip that brightens on hover. */
.job-queue-drawer-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    color: #fff;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.job-queue-drawer-close:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
.job-queue-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "spin name cancel"
        "spin bar  cancel";
    column-gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f5;
    cursor: pointer;
    transition: background 0.12s ease;
}
.job-queue-row:last-child { border-bottom: none; }
.job-queue-row:hover { background: #f3f6f3; }
.job-queue-row.is-focused { background: #f8faf8; }
.job-queue-row.is-focused:hover { background: #eef4ee; }
.job-queue-row-spinner {
    grid-area: spin;
    width: 14px;
    height: 14px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary, #337B30);
    border-radius: 50%;
    animation: pipeline-spin 0.8s linear infinite;
}
/* Queued-for-quota rows: replace the spinner with a "paused" symbol — two
   vertical grey bars. Reads as "waiting" rather than "in progress" so users
   don't mistake a long quota wait for a stuck worker. Same 14×14 bounding
   box as the spinner (set above) so the row's vertical/horizontal rhythm
   doesn't shift when a row flips between states. */
.job-queue-row.is-waiting .job-queue-row-spinner {
    border: none;
    border-radius: 0;
    background: transparent;
    animation: none;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}
.job-queue-row.is-waiting .job-queue-row-spinner::before,
.job-queue-row.is-waiting .job-queue-row-spinner::after {
    content: '';
    position: static;
    width: 3px;
    height: 11px;
    background: #9ca3af;
    border-radius: 1.5px;
}
.job-queue-row-text { grid-area: name; min-width: 0; }
.job-queue-row-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #3D3D3A);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.job-queue-row-phase {
    font-size: 11px;
    color: var(--text-secondary, #71717a);
    margin-top: 2px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    overflow: hidden;
}
.job-queue-row-phase-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.job-queue-row-elapsed {
    font-variant-numeric: tabular-nums;
    color: #9ca3af;
    flex-shrink: 0;
}
.job-queue-row-bar {
    grid-area: bar;
    margin-top: 6px;
    height: 4px;
    background: #eef0f2;
    border-radius: 2px;
    overflow: hidden;
}
.job-queue-row-bar-fill {
    height: 100%;
    background: var(--primary, #337B30);
    transition: width 0.3s ease;
}
.job-queue-row.is-waiting .job-queue-row-bar-fill { background: #c0c4c8; }

/* ─── Needs-resume rows ──────────────────────────────────────────────────
   Surfaced when a queued job has been sitting without a phase for >5 min —
   classic abandoned-upload zombie. The row gets a yellow accent so the user
   knows to head to the library tab and resume; we also replace the spinner
   with a static refresh glyph (a chunky two-bar mark via ::before/::after)
   to kill the "in progress" impression. */
.job-queue-row.is-needs-resume .job-queue-row-spinner {
    border: none;
    border-radius: 0;
    background: transparent;
    animation: none;
    width: 14px;
    height: 14px;
    position: relative;
}
.job-queue-row.is-needs-resume .job-queue-row-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid #f59e0b;
    border-top-color: transparent;
    border-radius: 50%;
}
.job-queue-row.is-needs-resume .job-queue-row-spinner::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -1px;
    border: 3px solid transparent;
    border-bottom-color: #f59e0b;
    transform: rotate(-45deg);
}
.job-queue-row.is-needs-resume .job-queue-row-phase-text {
    color: #b45309;
    font-weight: 600;
}
.job-queue-row.is-needs-resume .job-queue-row-bar-fill { background: #f59e0b; }

/* ─── Widget-level stalled accent ────────────────────────────────────────
   When _anyJobStalled() is true, the whole pill turns yellow so the user
   notices at a glance even when minimized. */
.job-minimized.has-stalled {
    border-color: #f59e0b;
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.28);
}
.job-minimized.has-stalled .job-minimized-spinner {
    border-color: #fde7b3;
    border-top-color: #f59e0b;
}
.job-minimized.has-stalled .job-minimized-elapsed { color: #b45309; font-weight: 600; }
.job-minimized.has-stalled .job-queue-badge { background: #f59e0b; }
.job-minimized.has-stalled .job-queue-badge:hover { background: #d97706; }

.job-queue-row-cancel {
    grid-area: cancel;
    background: none;
    border: none;
    color: var(--text-secondary, #71717a);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.job-queue-row-cancel:hover { background: #fee2e2; color: #dc2626; }
.job-queue-row-cancel:disabled { cursor: not-allowed; opacity: 0.4; }

/* ─── Success toast (after job completes) ────────────────────────────────── */
.success-toast {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 1100;
    background: var(--primary, #337B30);
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(51,123,48,0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
}
.success-toast.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ─── Farm Name Prompt (inside upload modal) ────────────────────────────── */
.farm-name-prompt input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
    background: var(--panel-bg, #fff);
    color: var(--text-primary);
}

/* Control Panel */
.control-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 380px;
    max-height: calc(100% - 24px);
    background: rgba(253, 252, 248, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--modal-radius);
    border: 1px solid rgba(var(--primary-rgb), 0.12);
    box-shadow: 0 8px 40px rgba(28, 28, 25, 0.18);
    z-index: 1001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.control-panel.hidden {
    display: none;
}

.panel-header {
    padding: 20px 24px 18px;
    border-bottom: none;
    position: relative;
    background: var(--panel-header-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.panel-header h2 {
    font-family: var(--font-primary);
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    line-height: 1.2;
    padding-right: 36px;
}

.species-scientific-name {
    font-size: 12px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.65);
    margin: 2px 0 0;
    font-weight: 400;
}

.farm-location {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.close-panel {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 4px;
    border-radius: 2px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    transition: background 0.15s, color 0.15s;
}

.close-panel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.panel-content {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    background: var(--surface-container-low);
}

/* Hide redundant view-level h3 titles — panel header provides context */
.view-content > h3 {
    display: none;
}

.view-content {
    display: block;
}

.view-content.hidden {
    display: none;
}

/* Panel footer — white, border-top, ghost + dark buttons */
.panel-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px;
    background: #ffffff;
    border-top: 1px solid var(--surface-container-high);
    flex-shrink: 0;
}

.panel-footer-btn-ghost {
    background: transparent;
    border: none;
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(28, 28, 25, 0.45);
    cursor: pointer;
    transition: color 0.15s;
}

.panel-footer-btn-ghost:hover {
    color: var(--text-primary);
}

.panel-footer-btn-dark {
    background: #191c1b;
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.15s;
}

.panel-footer-btn-dark:hover {
    background: #2d3030;
}

/* [hidden] alone is overridden by `.tab { display:flex }` / `.species-insight-card { display:flex }` — force hide zero-count species */
#weedsView .tabs > .tab[hidden],
#weedsView .species-insights-grid > .species-insight-card[hidden] {
    display: none !important;
}

/* Tabs (legacy standalone row — hidden when empty) */
.tabs:empty {
    display: none;
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    background: transparent;
    padding: 4px;
    border-radius: 10px;
}

.tab {
    flex: 0 0 auto;
    padding: 6px 14px;
    min-height: 32px;
    background: var(--surface-container);
    border: 1px solid rgba(51, 123, 48, 0.3);
    border-radius: var(--radius-md);
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(61, 61, 58, 0.55);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    pointer-events: auto;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab.active {
    background: var(--green-primary);
    color: var(--text-on-dark);
    border-color: var(--green-primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

/* ── Species-specific tab colors (match getWeedColor in detection-ui.js) ── */
/* Default (inactive): faded */
.tab[data-tab="thistle"]          { background: rgba(139, 71, 137, 0.28); border-color: rgba(139, 71, 137, 0.55); }
.tab[data-tab="agarita"]          { background: rgba(70, 130, 180, 0.28);  border-color: rgba(70, 130, 180, 0.55); }
.tab[data-tab="tree"]             { background: rgba(139, 105, 20, 0.28); border-color: rgba(139, 105, 20, 0.55); }
.tab[data-tab="prickly-pear"]      { background: rgba(220, 38, 38, 0.28);  border-color: rgba(220, 38, 38, 0.55); }
.tab[data-tab="ashe-juniper"]      { background: rgba(34, 139, 34, 0.28);   border-color: rgba(34, 139, 34, 0.55); }
.tab[data-tab="juniper-cluster"]  { background: rgba(20, 82, 20, 0.28);   border-color: rgba(20, 82, 20, 0.55); }
.tab[data-tab="tree-cluster"]     { background: rgba(92, 74, 0, 0.28);    border-color: rgba(92, 74, 0, 0.55); }
.tab[data-tab="cow"]              { background: rgba(194, 133, 77, 0.28); border-color: rgba(194, 133, 77, 0.55); }
.tab[data-tab="yucca"]            { background: rgba(125, 174, 90, 0.28); border-color: rgba(125, 174, 90, 0.55); }
.tab[data-tab="yucca-cluster"]    { background: rgba(78, 122, 43, 0.28);  border-color: rgba(78, 122, 43, 0.55); }

/* Hover (inactive only): brighten border */
.tab[data-tab="thistle"]:hover:not(.active)          { border-color: rgba(139, 71, 137, 1.0); }
.tab[data-tab="agarita"]:hover:not(.active)          { border-color: rgba(70, 130, 180, 1.0); }
.tab[data-tab="tree"]:hover:not(.active)            { border-color: rgba(139, 105, 20, 1.0); }
.tab[data-tab="prickly-pear"]:hover:not(.active)     { border-color: rgba(220, 38, 38, 1.0); }
.tab[data-tab="ashe-juniper"]:hover:not(.active)     { border-color: rgba(34, 139, 34, 1.0); }
.tab[data-tab="juniper-cluster"]:hover:not(.active) { border-color: rgba(20, 82, 20, 1.0); }
.tab[data-tab="tree-cluster"]:hover:not(.active)    { border-color: rgba(92, 74, 0, 1.0); }
.tab[data-tab="cow"]:hover:not(.active)             { border-color: rgba(194, 133, 77, 1.0); }
.tab[data-tab="yucca"]:hover:not(.active)           { border-color: rgba(125, 174, 90, 1.0); }
.tab[data-tab="yucca-cluster"]:hover:not(.active)   { border-color: rgba(78, 122, 43, 1.0); }

/* Active: full species color */
.tab[data-tab="thistle"].active          { background: #8B4789; border-color: #8B4789; box-shadow: 0 2px 8px rgba(139, 71, 137, 0.4); }
.tab[data-tab="agarita"].active          { background: #4682B4; border-color: #4682B4; box-shadow: 0 2px 8px rgba(70, 130, 180, 0.4); }
.tab[data-tab="tree"].active             { background: #8B6914; border-color: #8B6914; box-shadow: 0 2px 8px rgba(139, 105, 20, 0.4); }
.tab[data-tab="prickly-pear"].active     { background: #DC2626; border-color: #DC2626; box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4); }
.tab[data-tab="ashe-juniper"].active     { background: #228B22; border-color: #228B22; box-shadow: 0 2px 8px rgba(34, 139, 34, 0.4); }
.tab[data-tab="juniper-cluster"].active  { background: #145214; border-color: #145214; box-shadow: 0 2px 8px rgba(20, 82, 20, 0.4); }
.tab[data-tab="tree-cluster"].active     { background: #5C4A00; border-color: #5C4A00; box-shadow: 0 2px 8px rgba(92, 74, 0, 0.4); }
.tab[data-tab="cow"].active              { background: #C2854D; border-color: #C2854D; box-shadow: 0 2px 8px rgba(194, 133, 77, 0.4); }
.tab[data-tab="yucca"].active            { background: #7DAE5A; border-color: #7DAE5A; box-shadow: 0 2px 8px rgba(125, 174, 90, 0.4); }
.tab[data-tab="yucca-cluster"].active    { background: #4E7A2B; border-color: #4E7A2B; box-shadow: 0 2px 8px rgba(78, 122, 43, 0.4); }

.tab .info-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    flex-shrink: 0;
    /* Clicks pass through to the button; handler detects ? area via e.offsetX */
    pointer-events: none;
}

.tab.active .info-icon {
    background: rgba(255, 255, 255, 0.4);
}

/* Species card header strip */
.species-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 11px;
    min-height: 26px;
    background: rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(61, 61, 58, 0.75);
    transition: background 0.15s, color 0.15s;
}

/* Species Insights Grid */
.species-insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.species-insight-card {
    background: var(--surface-container);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.species-insight-card .species-insight-stats {
    opacity: 0.35;
    transition: opacity 0.15s;
}

/* Active state — white card background + species color header + full opacity stats */
.species-insight-card.active { background: #fff; }
.species-insight-card.active .species-insight-stats { opacity: 1; }


/* Active header color comes from --species-color, set in JS from getWeedColor()
   so cards always match their map markers (covers every species, no per-species
   rule to maintain). Falls back to brush navy if the var is somehow unset. */
.species-insight-card.active .species-card-header {
    background: var(--species-color, #1F4781);
    color: #fff;
}

.species-insight-name {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--font-primary);
    color: rgba(61, 61, 58, 0.45);
    padding: 10px 14px 6px;
}

.species-insight-stats {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 8px 14px 10px;
    gap: 0;
}

.species-insight-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.species-insight-divider {
    width: 1px;
    background: rgba(51, 123, 48, 0.3);
    margin: 0 12px;
    align-self: stretch;
}

.species-insight-value {
    font-family: var(--font-primary);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.species-insight-label {
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-primary);
    color: rgba(61, 61, 58, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#weedChart {
    min-height: 300px;
    height: 300px !important;
    width: 100% !important;
}

/* Route Info */
.route-info {
    margin-bottom: 24px;
}

.route-info h3 {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-primary);
    color: var(--text-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.route-details {
    background: var(--surface-container);
    border-radius: var(--radius-md);
    border: 1px solid rgba(51, 123, 48, 0.2);
    padding: 16px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.detail-item:not(:last-child) {
    border-bottom: 1px solid rgba(51, 123, 48, 0.2);
}

.detail-item .label {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(61, 61, 58, 0.4);
}

.detail-item .value {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--text-primary);
}

/* Tank Mix Calculator Styles */
.tank-mix-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: var(--cream-white);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.mix-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 80px;
    text-align: center;
}

.mix-item strong {
    font-family: var(--font-tertiary);
    font-size: 18px;
    color: var(--green-primary);
    text-align: center;
    width: 100%;
    display: block;
}

.mix-item .unit {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
    display: block;
}

.tank-mix-card .plus {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Farm Stats — 2-col grid of contained rectangles */
.farm-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 4px;
}

.stat-card {
    background: var(--white-pure);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    color: var(--text-primary);
}

#homeView .farm-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

#homeView .home-period-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
    margin: 2px 2px 8px;
}

#homeView .home-info-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

#homeView .home-info-card {
    background: var(--white-pure);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-primary);
}

#homeView .home-info-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted, #6b7280);
}

#homeView .home-info-value {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
}

#homeView .home-info-value .home-info-warning {
    color: #b91c1c;
}

#homeView .stat-card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 10px;
    padding: 7px 14px;
}

#homeView .home-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
    margin: 18px 2px 8px;
}

#homeView .home-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#homeView .home-job-card {
    position: relative;
    background: var(--white-pure);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px 14px 12px 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

#homeView .home-job-bookmark {
    position: absolute;
    top: 0;
    left: 14px;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 4px 10px;
    font-family: var(--font-primary);
    text-transform: uppercase;
    line-height: 1;
}

#homeView .home-job-bookmark--success { background: #337B30; }
#homeView .home-job-bookmark--pending { background: #E0A800; }
#homeView .home-job-bookmark--failed  { background: #B91C1C; }
#homeView .home-job-bookmark--cancelled { background: #6b7280; }

#homeView .home-job-bookmarks {
    position: absolute;
    top: 0;
    left: 14px;
    display: flex;
    gap: 4px;
}

#homeView .home-job-bookmarks .home-job-bookmark {
    position: static;
    left: auto;
    top: auto;
}

#homeView .home-job-bookmark--res-red    { background: #B91C1C; }
#homeView .home-job-bookmark--res-orange { background: #E0A800; }
#homeView .home-job-bookmark--res-green  { background: #337B30; }
#homeView .home-job-bookmark--res-blue   { background: #1F4781; }

#homeView .home-request-expiry {
    position: absolute;
    top: 8px;
    right: 14px;
    font-size: 11px;
    color: var(--text-secondary);
}

#homeView .home-request-titles {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

#homeView .home-request-farm {
    font-size: 12px;
    color: var(--text-secondary);
}

#homeView .home-job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

#homeView .home-job-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
}

#homeView .home-job-header .home-job-date {
    font-size: 11px;
    color: var(--text-secondary);
    flex: 0 0 auto;
    white-space: nowrap;
}

#homeView .home-job-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* "Retried →" link badge on a failed card → opens the newer mission in the stepper modal. */
#homeView .home-job-retried-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary, #337B30);
    background: rgba(51,123,48,0.10);
    border: 1px solid rgba(51,123,48,0.35);
    border-radius: 999px;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.15s ease, color 0.15s ease;
}
#homeView .home-job-retried-badge:hover {
    background: var(--primary, #337B30);
    color: #fff;
}
#homeView .home-job-retried-badge:focus-visible {
    outline: 2px solid var(--primary, #337B30);
    outline-offset: 2px;
}

/* "↻ Retry of an earlier run" subtext on the newer mission card. */
#homeView .home-job-retry-of {
    font-size: 11px;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 2px;
}

#homeView .home-job-stats {
    margin-top: 8px;
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: var(--text-secondary);
}

#homeView .home-job-stat strong {
    color: var(--text-primary);
    font-weight: 700;
    margin-right: 4px;
}

#homeView .home-job-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding: 6px 10px;
    background: #F1F3F5;
    border-radius: 6px;
}

#homeView .home-job-divider {
    height: 1px;
    background: var(--border-color, #e5e7eb);
    margin: 10px 0 4px;
}

#homeView .home-job-meta-key {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

#homeView .home-job-meta-val {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

#homeView .home-job-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 10px;
    background: #F1F3F5;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

#homeView .home-job-method-pill {
    flex: 0 0 auto;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    font-family: var(--font-primary);
    line-height: 1.2;
}

#homeView .home-job-method-gps { background: var(--brand-navy, #1F4781); }
#homeView .home-job-method-odm { background: var(--primary, #337B30); }

#homeView .home-job-info-item {
    flex: 0 0 auto;
    font-weight: 600;
}

#homeView .home-job-info-stage {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

#homeView .home-job-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

#homeView .home-job-detections {
    color: var(--text-primary);
    font-weight: 600;
}

#homeView .home-job-detections strong {
    font-weight: 700;
    margin-right: 4px;
}

#homeView .home-requests-box {
    background: var(--white-pure);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 10px;
    max-height: 180px;
    overflow-y: auto;
}

#homeView .home-request-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-color);
}

#homeView .home-request-row:last-child {
    border-bottom: none;
}

#homeView .home-request-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#homeView .home-request-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

#homeView .home-request-status {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
}

#homeView .home-request-status--pending  { background: #E0A800; }
#homeView .home-request-status--complete { background: #337B30; }
#homeView .home-request-status--expired  { background: #6b7280; }

#homeView .home-empty-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin: 4px 6px;
}

#homeView .stat-label {
    min-height: unset;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0;
}

#weedsView .farm-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

#weedsView .stat-card {
    background: var(--white-pure);
    border-radius: var(--radius-md);
    padding: 7px 14px;
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 10px;
}

.stat-card.alert { background: #fffafa; }
.stat-card.warning { background: #fffef5; }

.stat-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
}

.stat-value {
    font-size: 40px;
    font-weight: 900;
    font-family: var(--font-primary);
    color: var(--text-primary);
    line-height: 1;
}

#weedsView .stat-value-row,
#homeView .stat-value-row {
    justify-content: flex-start;
    margin-top: 0;
    margin-left: auto;
}

#weedsView .stat-value,
#homeView .stat-value {
    font-size: 22px;
}

.stat-unit {
    font-size: 13px;
    font-weight: 400;
    color: rgba(61, 61, 58, 0.45);
    font-family: var(--font-primary);
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(28, 28, 25, 0.45);
    margin-bottom: 2px;
    min-height: 2.8em;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

#weedsView .stat-label {
    min-height: unset;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0;
}

/* Coverage Breakdown — Home Tab */
.coverage-breakdown {
    margin-top: 10px;
}

.coverage-bar {
    display: flex;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #e8e8e8;
}

.coverage-segment {
    height: 100%;
    transition: width 0.5s ease;
    min-width: 0;
}

.coverage-segment--canopy { background: #2D5A1B; }
.coverage-segment--weeds  { background: #C0392B; }
.coverage-segment--forage { background: #337B30; }
.coverage-segment--ground { background: #C4A77D; }

.coverage-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-family: var(--font-primary);
}

.coverage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.coverage-dot--canopy { background: #2D5A1B; }
.coverage-dot--weeds  { background: #C0392B; }
.coverage-dot--forage { background: #337B30; }
.coverage-dot--ground { background: #C4A77D; }

.coverage-label {
    flex: 1;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.coverage-pct {
    font-weight: 800;
    font-size: 13px;
    min-width: 38px;
    text-align: right;
    color: var(--text-primary);
}

.coverage-area {
    color: rgba(61,61,58,0.5);
    font-size: 10px;
    min-width: 64px;
    text-align: right;
    font-weight: 500;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    width: 100%;
    min-height: 44px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-primary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease;
    pointer-events: auto;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

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

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    position: relative;
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--text-primary);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-tertiary);
    white-space: nowrap;
    border-radius: 6px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(58, 90, 64, 0.15);
}

.btn-primary:disabled:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-primary);
    pointer-events: none;
    z-index: 1000;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
    margin-bottom: 12px;
}

.btn-secondary:hover {
    background: var(--surface-container);
    border-color: rgba(51, 123, 48, 0.4);
}

.btn-secondary.btn-green {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.btn-secondary.btn-green:hover {
    background: #2d6630;
}

.btn-secondary:disabled,
.btn-secondary.btn-green:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.btn-secondary:disabled:hover {
    background: transparent;
    border-color: var(--border-color);
}

.btn-secondary.btn-green:disabled:hover {
    background: var(--primary);
}

/* Detection popups — floating, multi-instance, draggable. Replaces the old
   full-screen #detectionModal. Each popup is position:fixed inside the
   pointer-events:none #detPopupsRoot container, then re-enables pointer-events
   on itself so the rest of the map stays clickable. */
.det-popup {
    position: fixed;
    pointer-events: auto;
    /* left/top set inline by JS (initial + drag) */
}
.det-popup .det-popup-content {
    background: var(--top-bar-bg);
    border: none;
    border-radius: var(--modal-radius);
    box-shadow: 0 12px 36px rgba(28, 28, 25, 0.28);
    overflow: hidden;
    color: var(--text-primary);
}
.det-popup .det-popup-header {
    background: var(--panel-header-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.det-popup .det-popup-title {
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffffff;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(28, 28, 25, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--top-bar-bg);
    border: none;
    border-radius: var(--modal-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 24px 64px rgba(28, 28, 25, 0.2);
    overflow: hidden;
    color: var(--text-primary);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: none;
    background: var(--panel-header-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffffff;
}

.close-modal {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #ffffff;
    transition: all 0.15s;
    flex-shrink: 0;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

.modal-body {
    padding: 24px;
    color: var(--text-primary);
}

.mission-name-row {
    margin-bottom: 16px;
}

.mission-name-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mission-name-row input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface-container-low);
    color: var(--text-primary);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.mission-name-row input[type="text"]::placeholder { color: rgba(250,250,247,0.35); }

.mission-name-row input[type="text"]:focus {
    border-color: var(--primary);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--deep-green);
    background: var(--green-light);
}

.upload-area .icon {
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.upload-area .icon svg {
    display: block;
    color: var(--text-secondary);
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Active state while dragging files/folders over the drop zone */
.upload-area.drag-over {
    border-color: var(--deep-green);
    background: var(--green-light);
}

/* "+ Add" affordance inside the empty drop zone */
.upload-folder-btn {
    margin-top: 14px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.upload-folder-btn:hover {
    background: var(--primary-hover, #2d6630);
}

/* Finder-style file browser shown after files are selected */
.upload-area:has(.upload-browser) {
    padding: 0;
    border-style: solid;
    cursor: default;
    text-align: left;
}
.upload-area:has(.upload-browser):hover {
    background: transparent;
    border-color: var(--border-color);
}

.upload-browser {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.upload-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #f7f7f5;
    font-size: 13px;
    color: var(--text-primary);
}

.upload-browser-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Action row beneath the image list */
.upload-browser-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    background: #f7f7f5;
}

.upload-browser-footer .change-link {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.upload-browser-footer .change-link:hover {
    background: var(--green-light);
    border-color: var(--deep-green);
}

.upload-browser-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.upload-browser-toggle button {
    border: none;
    background: transparent;
    padding: 5px 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-browser-toggle button + button {
    border-left: 1px solid var(--border-color);
}

.upload-browser-toggle button.active {
    background: var(--primary);
}

.upload-browser-body {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
}

/* Finder-style per-folder sections (shown when folders are added/dropped) */
.upload-folder-group { margin-bottom: 8px; }
.upload-folder-group:last-child { margin-bottom: 0; }

.upload-folder-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: #f3f4f1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
}
.upload-folder-head:hover { background: var(--green-light); }
.upload-folder-head .ufg-folder { color: var(--primary); flex-shrink: 0; }
.upload-folder-head .ufg-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-folder-head .ufg-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: #fff;
    border-radius: 10px;
    padding: 1px 8px;
}
.upload-folder-head .ufg-chevron {
    display: flex;
    color: var(--text-secondary);
    transition: transform 0.15s;
}
.upload-folder-group.collapsed .ufg-chevron { transform: rotate(-90deg); }

.upload-folder-items { padding: 10px 4px 4px; }
.upload-folder-group.collapsed .upload-folder-items { display: none; }

.upload-browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
}

.upload-file-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.upload-file-icon .thumb-slot,
.upload-file-icon img {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    background: #f3f3f1;
    box-sizing: border-box;
    display: block;
}

.upload-file-icon img {
    object-fit: cover;
}

.upload-file-icon .name {
    font-size: 11px;
    color: var(--text-primary);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-browser-list {
    display: flex;
    flex-direction: column;
}

.upload-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px;
    border-radius: 6px;
}

.upload-file-row:hover {
    background: var(--green-light, #f0f4ef);
}

.upload-file-row .thumb-slot,
.upload-file-row img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    background: #f3f3f1;
    box-sizing: border-box;
    flex-shrink: 0;
    display: block;
}

.upload-file-row img {
    object-fit: cover;
}

.upload-file-row .name {
    flex: 1;
    font-size: 12.5px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-row .size {
    font-size: 11.5px;
    color: #888;
    min-width: 64px;
    text-align: right;
}

.upload-options {
    padding: 12px 0;
}

.upload-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.upload-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.processing-settings {
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: 16px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.setting-header label {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--text-primary, #111);
}

.setting-value {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--green-primary, #3a7d44);
}

.setting-recommended {
    font-weight: 400;
    color: var(--text-secondary, #6b7280);
}

.setting-row input[type="range"] {
    width: 100%;
    accent-color: var(--green-primary, #3a7d44);
    cursor: pointer;
    height: 4px;
}

.setting-desc {
    font-size: 11px;
    font-family: var(--font-primary);
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.4;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    width: auto;
    flex: 1;
    margin-bottom: 0;
}

#uploadModal .modal-content {
    max-width: 420px;
}

/* ─── Settings View (in-panel) ────────────────────────────────────────────── */
#settingsView .settings-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

#settingsView .settings-section:first-child {
    padding-top: 4px;
}

#settingsView .settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 123, 48, 0.12);
}

.settings-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: #fff;
    box-sizing: border-box;
    resize: vertical;
    min-height: 88px;
    line-height: 1.45;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 123, 48, 0.12);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.5;
}

.settings-hint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.settings-hint a:hover {
    text-decoration: underline;
}

.signout-link {
    color: #b22222 !important;
}

.signout-link:hover {
    color: #8b1a1a !important;
}

#uploadImagesOnly {
    background: var(--brand-navy);
    color: #fff;
    border-color: transparent;
}

#uploadImagesOnly:hover {
    background: #16376a;
}

/* ── Detection validation buttons ──────────────────────────────────────────── */
.det-validation-row {
    display: flex;
    gap: 5px;
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
}

.det-val-btn {
    flex: 1;
    padding: 5px 0;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--surface-container);
    color: rgba(28, 28, 25, 0.55);
    font-family: var(--font-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    letter-spacing: 0.02em;
}

.det-val-btn:hover:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--text-primary);
}

.det-val-btn.active-accept {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.5);
    color: var(--primary);
    cursor: default;
}

.det-val-btn.active-reject {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.4);
    color: #c0392b;
    cursor: default;
}

.det-val-btn.active-correct {
    background: rgba(25, 118, 210, 0.1);
    border-color: rgba(25, 118, 210, 0.4);
    color: #1565c0;
    cursor: default;
}

/* ── Detection modal: floating draggable panel ──────────────────────────── */
#detectionModal {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 80px 24px 0 0;
}

#detectionModal .modal-content {
    pointer-events: auto;
    will-change: transform;
    box-shadow: 0 8px 32px rgba(28, 28, 25, 0.28), 0 2px 8px rgba(28, 28, 25, 0.12);
}

#detectionModal .modal-header {
    cursor: grab;
    user-select: none;
}

#detectionModal .modal-header:active {
    cursor: grabbing;
}

/* Plan sub-tab bar */
.plan-subtab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.2);
    padding-bottom: 12px;
}

.plan-subtab {
    flex: 1;
    padding: 8px 10px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: var(--radius-sm);
    background: var(--surface-container);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.plan-subtab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.plan-subtab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}


/* ─── Upload modal pre-flight warnings ──────────────────────────────────── */
.upload-warn {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    border: 1px solid transparent;
}
.upload-warn strong { font-weight: 600; }
.upload-warn--dup {
    background: #FEF3C7;
    border-color: #F59E0B;
    color: #78350F;
}
.upload-warn--outlier {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #7F1D1D;
}
.upload-warn--info {
    background: #DBEAFE;
    border-color: #3B82F6;
    color: #1E3A8A;
}
.upload-warn--region {
    background: #FFEDD5;
    border-color: #EA580C;
    color: #7C2D12;
}
.upload-warn--time {
    background: #EDE9FE;
    border-color: #8B5CF6;
    color: #4C1D95;
}
.upload-warn-outlier-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: rgba(255,255,255,0.55);
    border-radius: 6px;
    cursor: pointer;
}
.upload-warn-outlier-row input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

/* ── Labeling Tool ──────────────────────────────────────────────────────── */
.labeling-tool-section {
    margin: 8px 0 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
/* Hints span the full width so the Labeling / Edit buttons sit side by side. */
.labeling-tool-section .labeling-hint { flex-basis: 100%; }

.labeling-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.labeling-toggle-btn:hover {
    background: rgba(51, 123, 48, 0.08);
}
.labeling-toggle-btn.drawing-active {
    background: var(--primary);
    color: #fff;
}

.labeling-hint {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--text-primary);
    opacity: 0.75;
}
.labeling-hint kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 1px 4px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    background: #fff;
}
.labeling-hint.hidden { display: none; }

/* "Corrected → class" banner pinned to the top of the detection modal body. */
.det-corrected-banner {
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #337B30);
    background: rgba(51, 123, 48, 0.12);
    border-bottom: 1px solid rgba(51, 123, 48, 0.25);
    text-align: center;
}

/* Review mode — floating validation-navigation bar (bottom-right). */
.review-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    /* Two stacked rows: optional .review-bar__batch on top, main filter/nav row below. */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--white-pure, #fff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    font-family: var(--font-primary);
}
.review-bar__main {
    display: flex;
    align-items: center;
    gap: 10px;
}
.review-bar__batch {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.review-bar__batch.hidden { display: none; }
.review-bar__batch-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-right: auto;       /* push action buttons to the right edge */
    white-space: nowrap;
}
.review-bar__batch .det-val-btn {
    padding: 6px 12px;
    white-space: nowrap;
}
.review-filter {
    position: relative;
    flex: 0 0 auto;
}
.review-bar__filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: var(--app-bg, #f8f9fa);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.review-bar__filter:hover { border-color: var(--primary); }
.review-bar__caret { font-size: 10px; color: var(--primary); }
.review-filter__menu {
    position: absolute;
    bottom: calc(100% + 8px);   /* opens upward — no room below the bottom-anchored bar */
    left: 0;
    min-width: 184px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 6px;
    border-radius: 10px;
    background: var(--white-pure, #fff);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    z-index: 1201;
}
.review-filter__menu.hidden { display: none; }   /* no generic .hidden rule exists */
.review-filter__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}
.review-filter__item:hover { background: var(--white-sage, #cddcca); }
.review-filter__item input { accent-color: var(--primary); cursor: pointer; }
.review-filter__sep {
    height: 1px;
    margin: 6px 4px;
    background: rgba(0, 0, 0, 0.1);
}
.review-bar__count {
    font-size: 14px;
    color: var(--text-primary);
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.review-bar__pos {
    width: 46px;
    padding: 2px 4px;
    margin-right: 2px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    background: var(--app-bg, #f8f9fa);
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.review-bar__pos:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white-pure, #fff);
    box-shadow: 0 0 0 2px rgba(51, 123, 48, 0.18);
}
.review-bar__nav {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.review-bar__nav:hover:not(:disabled) { background: var(--primary); color: #fff; }
.review-bar__nav:disabled { opacity: 0.35; cursor: default; }

/* Draggable handle for point-move (bbox-only detections). */
.edit-tool-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #F59E0B;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: move;
}

.labeling-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white-pure, #FEFEFE);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 16px 18px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 260px;
}
.labeling-picker__title {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}
.labeling-picker__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.labeling-picker__cancel {
    align-self: center;
    padding: 6px 12px;
}

/* Shining red preview line drawn while the user is placing vertices.
   Marching dashes give the sense of motion; opacity stays constant. */
@keyframes labeling-shimmer-march {
    to { stroke-dashoffset: -20; }
}
.labeling-preview-line {
    stroke-opacity: 1;
    animation: labeling-shimmer-march 0.6s linear infinite;
    filter:
        drop-shadow(0 0 2px rgba(255, 255, 255, 0.95))
        drop-shadow(0 0 6px rgba(220, 38, 38, 0.85))
        drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
}
