/* ─── Inventory / Images page ─────────────────────────────────────────── */

/* Panel layout helpers */
.panel-content-relative { position: relative; }
#imagesView { position: relative; min-height: 100%; }

/* Wider panel for Inventory view */
.control-panel.panel-wide { width: 440px; max-height: calc(100% - 24px); }

/* ── Inventory hero stats ── */
.inv-hero {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    background: #fff;
    border: 1px solid rgba(51,123,48,0.15);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 4px;
}
.inv-hero-cell {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.inv-hero-cell:not(:last-child) { border-right: 1px solid rgba(51,123,48,0.12); }
.inv-hero-val {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-tertiary);
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: -0.01em;
}
.inv-hero-label {
    font-size: 8.5px;
    font-weight: 700;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(61,61,58,0.5);
}

/* ── Section titles ── */
.inv-section-title {
    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: 18px 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.inv-section-title .inv-chip-row { display: flex; gap: 4px; }

/* ── Filter chips ── */
.inv-chip {
    background: transparent;
    border: 1px solid rgba(51,123,48,0.25);
    border-radius: 999px;
    padding: 3px 9px;
    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.12s;
}
.inv-chip:hover { border-color: rgba(51,123,48,0.55); color: var(--text-primary); }
.inv-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Toolbar: search + sort ── */
.inv-toolbar { display: flex; gap: 6px; margin-bottom: 12px; }
.inv-search { flex: 1; position: relative; }
.inv-search svg {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: rgba(61,61,58,0.45);
}
.inv-search input {
    width: 100%; padding: 8px 10px 8px 32px;
    border: 1px solid rgba(51,123,48,0.2);
    border-radius: var(--radius-sm);
    font-size: 12px; font-family: var(--font-secondary);
    color: var(--text-primary); background: #fff; outline: none;
    transition: border-color 0.12s;
}
.inv-search input:focus { border-color: var(--primary); }

.inv-sort-select {
    padding: 8px 28px 8px 10px;
    border: 1px solid rgba(51,123,48,0.2);
    border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 600; font-family: var(--font-primary);
    color: var(--text-primary); background: #fff;
    cursor: pointer; outline: none; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(28,28,25,0.45)' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ── Collection cards ── */
.coll-card {
    background: #fff;
    border: 1px solid rgba(51,123,48,0.15);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column;
    margin-bottom: 10px;
    position: relative;
}
.coll-card:hover { border-color: rgba(51,123,48,0.55); box-shadow: 0 4px 14px rgba(28,28,25,0.08); }
.coll-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(51,123,48,0.2); }

.coll-card-status {
    position: absolute; top: 8px; right: 8px;
    font-size: 8.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.1em; text-transform: uppercase;
    padding: 3px 7px; border-radius: 999px;
    background: rgba(255,255,255,0.92); backdrop-filter: blur(6px);
    display: flex; align-items: center; gap: 4px;
}
.coll-card-status .status-dot { width: 6px; height: 6px; border-radius: 50%; background: #aaa; }
.coll-card-status.status-raw { color: #8B6914; }
.coll-card-status.status-raw .status-dot { background: #C89A1E; }
.coll-card-status.status-processed { color: var(--primary); }
.coll-card-status.status-processed .status-dot { background: var(--primary); }
.coll-card-status.status-processing { color: var(--brand-navy); }
.coll-card-status.status-processing .status-dot { background: var(--brand-navy); animation: pulse-dot 1.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.coll-card-thumbs {
    height: 64px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr;
    gap: 1px;
    background: rgba(51,123,48,0.1);
    overflow: hidden;
}
.coll-card-thumb { background-size: cover; background-position: center; background-color: #b8c5a8; }
.coll-card-thumb-more {
    display: flex; align-items: center; justify-content: center;
    background: rgba(25,28,27,0.82); color: #fff;
    font-family: var(--font-primary); font-weight: 700; font-size: 13px; letter-spacing: 0.04em;
}

.coll-card-body { padding: 10px 12px 12px; }
.coll-card-title {
    font-size: 13px; font-weight: 700; font-family: var(--font-primary);
    color: var(--text-primary); margin-bottom: 2px; line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coll-card-sub {
    font-size: 10.5px; font-weight: 500; color: rgba(61,61,58,0.55);
    font-family: var(--font-secondary);
    display: flex; align-items: center; gap: 4px; margin-bottom: 9px;
}
.coll-card-sub svg { flex-shrink: 0; opacity: 0.7; }

.coll-card-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    padding-top: 9px; border-top: 1px solid rgba(51,123,48,0.12);
}
.coll-card-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.coll-card-stat:not(:last-child) { border-right: 1px solid rgba(51,123,48,0.08); padding-right: 6px; }
.coll-card-stat:not(:first-child) { padding-left: 10px; }
.coll-card-stat-val {
    font-size: 14px; font-weight: 700; font-family: var(--font-tertiary);
    color: var(--text-primary); line-height: 1.1; letter-spacing: -0.01em;
}
.coll-card-stat-label {
    font-size: 8.5px; font-weight: 700; font-family: var(--font-primary);
    text-transform: uppercase; letter-spacing: 0.1em; color: rgba(61,61,58,0.45);
}

.coll-card-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.coll-card-btn {
    flex: 1; min-height: 32px; padding: 6px 8px;
    border: 1px solid rgba(51,123,48,0.25); border-radius: var(--radius-sm);
    font-size: 9.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer; background: #fff; color: var(--text-primary);
    transition: all 0.12s; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.coll-card-btn:hover { background: var(--surface-container); border-color: rgba(51,123,48,0.5); }
.coll-card-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.coll-card-btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.coll-card-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Reuse banner ── */
.reuse-banner {
    background: linear-gradient(135deg, rgba(31,71,129,0.08), rgba(31,71,129,0.02));
    border: 1px solid rgba(31,71,129,0.2);
    border-radius: var(--radius-md);
    padding: 10px 12px; margin-bottom: 14px;
    display: flex; gap: 10px; align-items: center;
}
.reuse-banner-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: var(--brand-navy); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.reuse-banner-body { flex: 1; min-width: 0; }
.reuse-banner-title {
    font-size: 11px; font-weight: 800; font-family: var(--font-primary);
    color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1px;
}
.reuse-banner-desc { font-size: 10.5px; color: rgba(61,61,58,0.6); font-family: var(--font-secondary); line-height: 1.3; }

/* ── Mission timeline (grouped by date) ── */
.mission-timeline-group { margin-bottom: 14px; }
.mission-timeline-date {
    font-size: 10px; font-weight: 700; font-family: var(--font-primary);
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--primary);
    padding: 4px 0 6px; display: flex; align-items: center; gap: 8px;
}
.mission-timeline-date::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(to right, rgba(51,123,48,0.25), transparent);
}

/* ── Empty state ── */
.inv-empty {
    text-align: center; padding: 40px 20px;
    color: rgba(61,61,58,0.55); font-family: var(--font-secondary); font-size: 12px; line-height: 1.6;
}
.inv-empty svg { color: rgba(51,123,48,0.35); margin-bottom: 10px; }

/* ── Map markers ── */
.drone-img-marker {
    width: 24px; height: 24px; background: #fff;
    border: 2px solid var(--brand-navy); border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(28,28,25,0.25); position: relative;
}
.drone-img-marker::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 6px solid var(--brand-navy);
}
.drone-img-marker:hover { transform: scale(1.15); z-index: 10; }
.drone-img-marker svg { color: var(--brand-navy); }

.drone-img-marker.mission-a { border-color: var(--primary); }
.drone-img-marker.mission-a::after { border-top-color: var(--primary); }
.drone-img-marker.mission-a svg { color: var(--primary); }
.drone-img-marker.mission-b { border-color: #8B4789; }
.drone-img-marker.mission-b::after { border-top-color: #8B4789; }
.drone-img-marker.mission-b svg { color: #8B4789; }
.drone-img-marker.mission-c { border-color: #C89A1E; }
.drone-img-marker.mission-c::after { border-top-color: #C89A1E; }
.drone-img-marker.mission-c svg { color: #C89A1E; }

/* Hover popover */
.drone-img-popover {
    position: absolute; width: 220px;
    background: rgba(255,255,255,0.98); border: 1px solid rgba(51,123,48,0.18);
    border-radius: var(--radius-md); box-shadow: 0 8px 28px rgba(28,28,25,0.18);
    backdrop-filter: blur(8px); z-index: 2100; overflow: hidden;
    pointer-events: none; opacity: 0; transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
}
.drone-img-popover.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.drone-img-popover-body { padding: 9px 11px 11px; }
.drone-img-popover-title {
    font-size: 11px; font-weight: 700; font-family: var(--font-tertiary);
    color: var(--text-primary); margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drone-img-popover-meta {
    font-size: 9.5px; font-weight: 500; color: rgba(61,61,58,0.55);
    font-family: var(--font-secondary);
    display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin-top: 6px;
}
.drone-img-popover-meta dt { font-size: 8.5px; font-weight: 700; font-family: var(--font-primary); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(61,61,58,0.45); }
.drone-img-popover-meta dd { font-family: var(--font-tertiary); font-weight: 600; color: var(--text-primary); }

/* Footprint SVG polygons */
.footprint-poly { stroke: var(--brand-navy); stroke-width: 1; fill: rgba(31,71,129,0.12); stroke-dasharray: 2 2; pointer-events: none; }
.footprint-poly.mission-a { stroke: var(--primary); fill: rgba(51,123,48,0.12); }
.footprint-poly.mission-b { stroke: #8B4789; fill: rgba(139,71,137,0.12); }
.footprint-poly.mission-c { stroke: #C89A1E; fill: rgba(200,154,30,0.12); }

/* ── Lightbox ── */
.lightbox-backdrop {
    position: fixed; inset: 0; background: rgba(10,12,10,0.85); backdrop-filter: blur(8px);
    z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 40px;
}
.lightbox-backdrop.hidden { display: none; }
.lightbox-close {
    position: absolute; top: 20px; right: 24px;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff;
    width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-body {
    max-width: 1100px; width: 100%;
    display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start;
}
.lightbox-image {
    aspect-ratio: 3 / 2; background-color: #1a1a1a; background-size: cover;
    border-radius: var(--radius-md); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.3); font-family: var(--font-tertiary); font-size: 12px;
}
.lightbox-meta { background: #1e1e1c; border-radius: var(--radius-md); padding: 18px 18px 16px; color: #e9e9e5; }
.lightbox-meta h3 { font-size: 13px; font-weight: 800; font-family: var(--font-primary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; color: #fff; }
.lightbox-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 11px; }
.lightbox-meta dt { font-family: var(--font-primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.45); font-size: 9.5px; padding-top: 1px; }
.lightbox-meta dd { font-family: var(--font-tertiary); font-weight: 600; color: #fff; }

/* ── Map toolbar (stacked) ── */
.map-toolbar-stack {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0 !important;
    gap: 0 !important;
    min-width: fit-content;
    right: 16px; left: auto; top: 16px; overflow: visible;
}
.map-toolbar-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.map-toolbar-row-layers {
    border-top: 1px solid rgba(51,123,48,0.12);
    padding: 2px 0 0;
    gap: 0;
    justify-content: center;
}

/* Compact density */
body.tw-density-compact .map-toolbar-row { padding: 6px 10px; }
body.tw-density-compact .map-toolbar-row-layers { padding: 2px 0 0; }
body.tw-density-compact .map-toolbar-stack { min-width: fit-content; }

/* ── Layer toggle switches ── */
.tb-switch {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    background: transparent; border: none;
    padding: 6px 14px; cursor: pointer;
    font-family: var(--font-secondary); font-size: 12px; font-weight: 500;
    color: rgba(61,61,58,0.55);
    transition: color 0.12s, opacity 0.12s;
    border-radius: 0;
}
.tb-switch:hover { color: var(--text-primary); }
.tb-switch.on { color: var(--primary); font-weight: 600; }

/* Eye icons — replace colored dots */
.tb-eye-on, .tb-eye-off { display: none; flex-shrink: 0; }
.tb-switch.on     .tb-eye-on  { display: inline-block; color: var(--primary); }
.tb-switch:not(.on) .tb-eye-off { display: inline-block; opacity: 0.4; }
.tb-switch:not(.on) span { opacity: 0.4; }

/* ── Ortho runs popover ── */
.ortho-runs-popover {
    position: absolute; z-index: 3000;
    background: var(--floating-island-bg); backdrop-filter: blur(14px);
    border: var(--floating-island-border); border-radius: var(--radius-lg);
    box-shadow: 0 10px 32px rgba(28,28,25,0.18); padding: 8px;
    min-width: 240px; font-family: var(--font-secondary);
}
.ortho-runs-popover[hidden] { display: none; }
.runs-pop-header { font-family: var(--font-primary); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(61,61,58,0.55); padding: 6px 10px 8px; border-bottom: 1px solid rgba(51,123,48,0.08); margin-bottom: 4px; }
.runs-pop-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: transparent; border: none; border-radius: 8px; padding: 8px 10px;
    cursor: pointer; font-family: inherit; font-size: 12px; color: var(--text-primary);
    text-align: left; transition: background 0.12s;
}
.runs-pop-item:hover { background: rgba(51,123,48,0.08); }
.runs-pop-item.active { background: rgba(51,123,48,0.12); color: var(--primary); }
.runs-pop-item.active svg { color: var(--primary); }
.runs-pop-label { flex: 1; font-size: 12px; font-weight: 600; }
.runs-pop-meta { font-size: 10.5px; color: rgba(61,61,58,0.55); margin-top: 1px; }
.runs-pop-divider { height: 1px; background: rgba(51,123,48,0.08); margin: 6px 4px; }
.runs-pop-action {
    display: block; width: 100%; background: transparent; border: none;
    border-radius: 8px; padding: 8px 10px; cursor: pointer; font-family: inherit;
    font-size: 11.5px; font-weight: 600; color: var(--primary); text-align: left; transition: background 0.12s;
}
.runs-pop-action:hover { background: rgba(51,123,48,0.08); }

/* Custom select in toolbar */
.map-toolbar-custom-select { position: relative; }
.map-toolbar-select-trigger {
    background: transparent; border: none; outline: none;
    font-size: 13px; font-weight: 600; font-family: var(--font-secondary);
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; gap: 6px; padding: 0; padding-right: 4px;
}
.map-toolbar-select-trigger:hover { color: var(--primary); }

/* .pipeline-spinner consolidated into panels.css (single navy definition) */

/* ── Images view: farm / batch / mission tree ─────────────────────────────── */

/* Farm group */
.ibv-farm-group { margin-bottom: 6px; }

.ibv-farm-header {
    display: flex; flex-direction: column; gap: 6px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    cursor: pointer; user-select: none;
    background: rgba(51,123,48,0.06);
    border: 1px solid rgba(51,123,48,0.12);
    transition: background 0.12s;
}
.ibv-farm-header:hover { background: rgba(51,123,48,0.1); }
.ibv-farm-header-row {
    display: flex; align-items: center; gap: 6px; width: 100%;
}

.ibv-farm-name {
    flex: 1; font-size: 12px; font-weight: 700;
    font-family: var(--font-primary);
    color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ibv-farm-meta {
    font-size: 10px; color: rgba(61,61,58,0.5);
    font-family: var(--font-secondary); white-space: nowrap; flex-shrink: 0;
}

.ibv-farm-body { padding-left: 10px; margin-top: 2px; }
.ibv-farm-body.hidden { display: none; }

/* Batch row */
.ibv-batch-row { margin-bottom: 4px; }

.ibv-batch-header {
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    user-select: none;
    background: #fff; border: 1px solid rgba(51,123,48,0.12);
    transition: background 0.12s, border-color 0.12s;
}
.ibv-batch-header[data-locatable="1"] { cursor: pointer; }
.ibv-batch-header[data-locatable="1"]:hover { border-color: rgba(51,123,48,0.3); background: rgba(51,123,48,0.03); }

.ibv-batch-row-top {
    display: flex; align-items: center; gap: 6px; width: 100%;
}
.ibv-batch-row-bottom {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px; color: rgba(61,61,58,0.5);
    font-family: var(--font-secondary);
}
.ibv-batch-date, .ibv-batch-imgs { white-space: nowrap; }

.ibv-batch-name {
    flex: 1; font-size: 11.5px; font-weight: 600;
    font-family: var(--font-primary); color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ibv-batch-actions {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

.ibv-run-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 999px;
    background: var(--primary); color: #fff; border: none;
    font-size: 9.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: background 0.12s;
}
.ibv-run-btn:hover { background: #2a6428; }
.ibv-run-btn--disabled,
.ibv-run-btn:disabled {
    background: rgba(107,114,128,0.30);
    color: rgba(255,255,255,0.7);
    cursor: not-allowed;
}
.ibv-run-btn--disabled:hover,
.ibv-run-btn:disabled:hover { background: rgba(107,114,128,0.30); }

.ibv-more-btn {
    padding: 3px 7px; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid rgba(51,123,48,0.2);
    font-size: 13px; color: rgba(61,61,58,0.55);
    cursor: pointer; line-height: 1; transition: all 0.12s;
}
.ibv-more-btn:hover { background: rgba(51,123,48,0.08); border-color: rgba(51,123,48,0.35); color: var(--text-primary); }

/* Acres readout — sits where the Run button used to, for batches with at
   least one completed mission. Re-runs are reached via the gray slot pills. */
.ibv-batch-acres {
    display: inline-flex; align-items: baseline; gap: 3px;
    padding: 2px 8px;
    font-size: 11px; font-weight: 600;
    font-family: var(--font-primary);
    color: var(--text-primary);
    white-space: nowrap;
}
.ibv-batch-acres-unit {
    font-size: 9.5px; font-weight: 500;
    color: rgba(61,61,58,0.55);
    letter-spacing: 0.02em;
}

.ibv-batch-body { padding-left: 12px; margin-top: 2px; }
.ibv-batch-body.hidden { display: none; }

/* Mission row */
.ibv-mission-row {
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    background: #fff; border: 1px solid rgba(51,123,48,0.1);
    margin-bottom: 3px; transition: border-color 0.12s, box-shadow 0.12s;
}
.ibv-mission-row:hover { border-color: rgba(51,123,48,0.3); box-shadow: 0 2px 8px rgba(28,28,25,0.06); }

.ibv-mission-row-top {
    display: flex; align-items: center; gap: 8px; width: 100%;
}
.ibv-mission-row-bottom {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px; color: rgba(61,61,58,0.5);
    font-family: var(--font-secondary);
}
.ibv-mission-date, .ibv-mission-res { white-space: nowrap; }

.ibv-mission-name {
    font-size: 11.5px; font-weight: 600;
    font-family: var(--font-primary); color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1;
}

.ibv-view-btn {
    flex-shrink: 0;
    width: auto;
    min-height: 0;
    margin-bottom: 0;
    padding: 4px 10px !important;
    font-size: 11px !important;
    height: auto;
}

.ibv-empty-missions {
    font-size: 11px; color: rgba(61,61,58,0.45);
    font-family: var(--font-secondary);
    padding: 8px 10px; font-style: italic;
}

/* Chevron icon — rotates when expanded */
.ibv-chevron {
    flex-shrink: 0; color: rgba(61,61,58,0.4);
    transition: transform 0.18s ease;
}
.ibv-farm-header.expanded .ibv-chevron,
.ibv-batch-header.expanded .ibv-chevron { transform: rotate(180deg); }

/* Batch context menu */
.batch-context-menu {
    position: fixed; z-index: 9999;
    background: #fff; border: 1px solid rgba(51,123,48,0.18);
    border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(28,28,25,0.14);
    overflow: hidden; min-width: 160px;
}
.batch-menu-item {
    display: block; width: 100%; padding: 9px 14px;
    background: transparent; border: none; text-align: left;
    font-size: 12px; font-family: var(--font-secondary);
    color: var(--text-primary); cursor: pointer; transition: background 0.1s;
}
.batch-menu-item:hover { background: rgba(51,123,48,0.08); }

/* Resolution preset buttons (Run Mission dialog) */
.res-preset-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 4px; }
.res-preset-row--five { grid-template-columns: repeat(5, 1fr); }
.res-preset {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 6px; border: 1.5px solid rgba(51,123,48,0.2);
    border-radius: var(--radius-sm); background: #fff;
    cursor: pointer; transition: all 0.12s; text-align: center;
}
.res-preset:hover { border-color: rgba(51,123,48,0.5); background: rgba(51,123,48,0.04); }
.res-preset.active { border-color: var(--primary); background: rgba(51,123,48,0.08); }
.res-preset-label { font-size: 11px; font-weight: 700; font-family: var(--font-primary); color: var(--text-primary); }
.res-preset-desc { font-size: 9px; color: rgba(61,61,58,0.5); font-family: var(--font-secondary); margin-top: 2px; }
.res-preset.active .res-preset-label { color: var(--primary); }

/* Processing-mode toggle: Fast (gps_mosaic) vs Accurate (odm) */
.stitch-mode-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 4px; }
.stitch-mode {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 8px; border: 1.5px solid rgba(51,123,48,0.2);
    border-radius: var(--radius-sm); background: #fff;
    cursor: pointer; transition: all 0.12s; text-align: center;
}
.stitch-mode:hover { border-color: rgba(51,123,48,0.5); background: rgba(51,123,48,0.04); }
.stitch-mode.active { border-color: var(--primary); background: rgba(51,123,48,0.08); }
.stitch-mode-label { font-size: 13px; font-weight: 700; font-family: var(--font-primary); color: var(--text-primary); }
.stitch-mode-desc  { font-size: 10px; color: rgba(61,61,58,0.6); font-family: var(--font-primary); margin-top: 3px; }
.stitch-mode.active .stitch-mode-label { color: var(--primary); }

/* Detection-model pill variant: icon on the left, label (+ optional subtext) on the right. */
.stitch-mode.detection-pill {
    flex-direction: row; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 10px;
}
.stitch-mode.detection-pill svg { color: rgba(61,61,58,0.6); flex-shrink: 0; }
.stitch-mode.detection-pill.active svg { color: var(--primary); }
.stitch-mode.detection-pill .detection-pill-text {
    display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15;
}

/* Resume-upload button: amber to flag the partial state */
.ibv-resume-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 999px;
    background: #F59E0B; color: #fff; border: none;
    font-size: 9.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: background 0.12s;
}
.ibv-resume-btn:hover { background: #D97706; }

/* Orphan-start button: upload is complete but /start was never fired.
   Distinct from Resume (amber, files missing) and Run (green, fresh
   mission). Uses the brand primary green to signal "ready to go" but
   doesn't overload the Run-button class — clicking goes through the
   /start path, not the file-picker. */
.ibv-start-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 999px;
    background: var(--primary); color: #fff; border: none;
    font-size: 9.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: background 0.12s;
}
.ibv-start-btn:hover { background: #2a6428; }
.ibv-start-btn:disabled {
    background: rgba(107,114,128,0.30); color: rgba(31,71,129,0.55);
    cursor: not-allowed;
}

/* Background upload in progress — replaces the amber Resume pill while the
   modal's XHR queue is still draining after the user closed the dialog.
   Clickable: re-opens the live progress modal. */
.ibv-uploading-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px; border-radius: 999px;
    background: var(--primary); color: #fff; border: none;
    font-size: 9.5px; font-weight: 700; font-family: var(--font-primary);
    letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; user-select: none;
    transition: background 0.12s;
}
.ibv-uploading-pill:hover { background: #285F26; }
.ibv-uploading-pill-spinner {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    animation: ibv-hero-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

/* Prominent counter shown in the Resume Upload modal while files are
   streaming to S3 — matches the "N / M images uploaded" feel of the
   regular + → Upload Images flow. */
.resume-upload-count {
    text-align: center;
    margin: 8px 0 14px;
}
.resume-upload-count-num {
    font-family: var(--font-tertiary), var(--font-mono);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--primary);
    letter-spacing: 0.01em;
}
.resume-upload-count-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ibv-partial-badge {
    display: inline-block; padding: 1px 6px; border-radius: 999px;
    background: #FEF3C7; color: #78350F; border: 1px solid #F59E0B;
    font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
}

/* ── Farm-header hover actions (rename, delete) ───────────────────────────── */
.ibv-farm-header { position: relative; }
.ibv-farm-actions {
    display: flex; align-items: center; gap: 2px;
    margin-left: 4px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.12s;
}
.ibv-farm-header:hover .ibv-farm-actions,
.ibv-farm-header:focus-within .ibv-farm-actions {
    opacity: 1; pointer-events: auto;
}
.ibv-farm-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    padding: 0; border: none; background: transparent;
    border-radius: var(--radius-sm);
    color: rgba(61,61,58,0.55); cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.ibv-farm-action:hover { background: rgba(51,123,48,0.12); color: var(--text-primary); }
.ibv-farm-action.ibv-farm-delete:hover { background: rgba(220,38,38,0.1); color: #b91c1c; }

/* ── Inline rename (farm name + batch name) ───────────────────────────────── */
.ibv-inline-editing {
    outline: none;
    background: #fff;
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 1px 5px;
    margin: -1px -5px;
    cursor: text;
    user-select: text;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    box-shadow: 0 0 0 3px rgba(51,123,48,0.12);
}

/* ── Hero pill + collapsible run grid ─────────────────────────────────────── */
.ibv-runs {
    margin-top: 6px;
}
.ibv-hero-row {
    display: flex; align-items: center; gap: 6px;
}
.ibv-hero-pill {
    flex: 1 1 auto; min-width: 0;
    display: flex; align-items: center; gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-family: var(--font-primary);
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(61,61,58,0.06);
    color: rgba(61,61,58,0.5);
    border: 1px solid transparent;
    cursor: default;
    user-select: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
}
.ibv-hero-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibv-hero-date {
    margin-left: auto;
    font-weight: 600;
    font-size: 10px;
    opacity: 0.75;
    white-space: nowrap;
}
.ibv-hero-pill--done {
    background: rgba(51,123,48,0.15);
    color: var(--primary);
    border-color: rgba(51,123,48,0.3);
    cursor: pointer;
}
.ibv-hero-pill--done:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.ibv-hero-pill--done:active { transform: scale(0.98); }
.ibv-hero-pill--done:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.ibv-hero-pill--running {
    background: rgba(245,179,40,0.18);
    color: #8a5a00;
    border-color: rgba(245,179,40,0.55);
    cursor: pointer;
}
.ibv-hero-pill--running:hover {
    background: rgba(245,179,40,0.32);
    border-color: rgba(245,179,40,0.8);
}
.ibv-hero-pill--running:active { transform: scale(0.98); }
.ibv-hero-pill--running:focus-visible {
    outline: 2px solid #b45309;
    outline-offset: 2px;
}
/* Queued (quota-held or pre-pickup) — paler yellow vs the running pill so
   at a glance the user can tell "this hasn't started" from "this is
   actively processing". R5 bug #10 fix. */
.ibv-hero-pill--queued {
    background: rgba(250,204,21,0.14);
    color: #92400e;
    border-color: rgba(250,204,21,0.45);
    cursor: pointer;
}
.ibv-hero-pill--queued:hover {
    background: rgba(250,204,21,0.26);
    border-color: rgba(250,204,21,0.7);
}
.ibv-hero-pill--queued:active { transform: scale(0.98); }
.ibv-hero-pill--queued:focus-visible {
    outline: 2px solid #a16207;
    outline-offset: 2px;
}
.ibv-hero-pill--failed {
    background: rgba(220,38,38,0.10);
    color: #b91c1c;
    border-color: rgba(220,38,38,0.45);
    cursor: pointer;
}
.ibv-hero-pill--failed:hover {
    background: rgba(220,38,38,0.18);
    border-color: rgba(220,38,38,0.7);
}
.ibv-hero-pill--cancelled {
    background: rgba(107,114,128,0.10);
    color: #4b5563;
    border-color: rgba(107,114,128,0.40);
    cursor: default;
}
.ibv-hero-spinner {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(138,90,0,0.25);
    border-top-color: #8a5a00;
    animation: ibv-hero-spin 0.8s linear infinite;
    flex: 0 0 auto;
}
@keyframes ibv-hero-spin { to { transform: rotate(360deg); } }

.ibv-grid-toggle {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(61,61,58,0.15);
    background: #fff;
    color: rgba(61,61,58,0.55);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.18s;
}
.ibv-grid-toggle:hover {
    background: rgba(51,123,48,0.08);
    color: var(--primary);
    border-color: rgba(51,123,48,0.3);
}
.ibv-grid-toggle.expanded svg { transform: rotate(180deg); }
.ibv-grid-toggle svg { transition: transform 0.18s; }

.ibv-slot-grid-wrap { padding-top: 6px; }
.ibv-slot-grid-wrap.hidden { display: none; }

/* ── Mission slot grid (revealed via chevron) ─────────────────────────────── */
/* Fast dot + Accurate pills live on a single line:  Accurate [1][10][30]   Fast ● */
.ibv-slot-grid {
    display: flex; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: 14px;
}
.ibv-slot-row {
    display: flex; align-items: center; gap: 6px;
}
.ibv-slot-row-label {
    font-size: 9px; font-weight: 700;
    font-family: var(--font-primary);
    color: rgba(61,61,58,0.55);
    letter-spacing: 0.06em; text-transform: uppercase;
}
.ibv-slot-cells {
    display: flex; gap: 4px;
}
.ibv-slot-cells--odm .ibv-slot {
    min-width: 26px; padding: 0 4px;
}
/* Fast-mode row collapses to a single status dot — no resolution grid. */
.ibv-gps-cell {
    display: flex; align-items: center; gap: 4px;
}
.ibv-gps-dot {
    display: inline-block;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: rgba(61,61,58,0.18);
    border: 1px solid rgba(61,61,58,0.25);
    transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.ibv-gps-dot--empty { /* gray base — default */ }
.ibv-gps-dot--done {
    background: var(--primary);
    border-color: var(--primary);
}
.ibv-gps-dot--running {
    background: #F59E0B;
    border-color: #B45309;
    animation: ibv-slot-pulse 1.6s ease-in-out infinite;
}
.ibv-gps-dot--failed {
    background: #DC2626;
    border-color: #991B1B;
}
.ibv-gps-dot--cancelled {
    background: rgba(61,61,58,0.18);
    border-color: rgba(61,61,58,0.35);
}
.ibv-gps-dot.ibv-slot--clickable { cursor: pointer; }
.ibv-gps-dot.ibv-slot--clickable:hover { transform: scale(1.15); }
.ibv-gps-dot.ibv-slot--clickable:active { transform: scale(0.95); }
.ibv-gps-dot.ibv-slot--clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
/* Disabled empty pills/dots — shown when batch has a non-terminal mission
   so users can't accidentally dispatch a second concurrent run via the grid. */
.ibv-slot--disabled,
.ibv-gps-dot.ibv-slot--disabled {
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: auto;  /* keep tooltip; click handler still no-ops */
}
.ibv-slot--disabled:hover,
.ibv-gps-dot.ibv-slot--disabled:hover {
    transform: none;
    background: rgba(61,61,58,0.08);
    border-color: transparent;
}
.ibv-slot {
    display: flex; align-items: center; justify-content: center;
    min-width: 0;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 9.5px; font-weight: 700;
    font-family: var(--font-primary);
    letter-spacing: 0.04em;
    background: rgba(61,61,58,0.08);
    color: rgba(61,61,58,0.45);
    border: 1px solid transparent;
    user-select: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.06s;
}
.ibv-slot-label { line-height: 1; pointer-events: none; }
.ibv-slot-label::after { content: ''; }
.ibv-slot--empty { /* gray base — same as default */ }
.ibv-slot--done {
    background: rgba(51,123,48,0.18);
    color: var(--primary);
    border-color: rgba(51,123,48,0.3);
}
.ibv-slot--running {
    background: #FEF3C7;
    color: #78350F;
    border-color: #F59E0B;
    animation: ibv-slot-pulse 1.6s ease-in-out infinite;
}
.ibv-slot--failed {
    background: rgba(220,38,38,0.1);
    color: #b91c1c;
    border-color: rgba(220,38,38,0.35);
}
/* Cancelled mission: muted neutral. Same baseline as --empty but with the
   resolution label rendered (rather than blank) so users can still see what
   they cancelled at a glance. Not clickable — the row is audit-only. */
.ibv-slot--cancelled {
    background: rgba(61,61,58,0.08);
    color: rgba(61,61,58,0.5);
    border-color: rgba(61,61,58,0.2);
    text-decoration: line-through;
}
.ibv-slot--clickable { cursor: pointer; }
.ibv-slot--empty.ibv-slot--clickable:hover {
    background: rgba(51,123,48,0.14);
    color: var(--primary);
    border-color: rgba(51,123,48,0.3);
}
.ibv-slot--done.ibv-slot--clickable:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.ibv-slot--failed.ibv-slot--clickable:hover {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}
.ibv-slot--running.ibv-slot--clickable:hover {
    background: #b45309;
    color: #fff;
    border-color: #b45309;
}
.ibv-slot--clickable:active { transform: scale(0.96); }
.ibv-slot--clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@keyframes ibv-slot-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

/* ── Delete-farm modal options ────────────────────────────────────────────── */
.ibv-delete-options { display: flex; flex-direction: column; gap: 8px; }
.ibv-delete-option {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 12px 14px; text-align: left;
    background: #fff; border: 1.5px solid rgba(61,61,58,0.15);
    border-radius: 8px; cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    font-family: var(--font-primary);
}
.ibv-delete-option:hover {
    border-color: var(--primary);
    background: rgba(51,123,48,0.04);
}
.ibv-delete-option--danger:hover {
    border-color: #b91c1c;
    background: rgba(220,38,38,0.04);
}
.ibv-delete-option:disabled { opacity: 0.5; cursor: not-allowed; }
.ibv-delete-option-title {
    font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.ibv-delete-option--danger .ibv-delete-option-title { color: #b91c1c; }
.ibv-delete-option-desc {
    font-size: 11px; color: rgba(61,61,58,0.6); font-weight: 400;
}

/* ── Multi-mission comparison (always-on checkbox model) ──────────────────── */

/* Clear All button — drops every secondary, keeps the primary. Disabled when
   no secondaries are checked. */
.inv-clear-secondaries {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: 8px 12px;
    border: 1px solid rgba(51,123,48,0.2);
    border-radius: var(--radius-sm);
    background: #fff; color: var(--text-primary);
    font-size: 12px; font-weight: 600; font-family: var(--font-primary);
    cursor: pointer; user-select: none;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.inv-clear-secondaries:hover:not(:disabled) { border-color: rgba(51,123,48,0.55); }
.inv-clear-secondaries:disabled { opacity: 0.4; cursor: default; }

/* Per-card checkbox — sits to the left of the mission name. Disabled on cards
   without a runnable mission (cancelled/pending/legacy) so they can't enter
   the overlay set. */
.ibv-batch-checkbox {
    flex-shrink: 0;
    width: 14px; height: 14px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}
.ibv-batch-checkbox:disabled { cursor: not-allowed; opacity: 0.4; }

/* Subtle highlight on checked rows so the selection is legible at a glance. */
.ibv-batch-row--checked .ibv-batch-header {
    border-color: var(--primary);
    background: rgba(51,123,48,0.05);
}

/* Per-farm "Select All" — second row inside the farm-header box, just below
   the farm name. Left-aligned so it doesn't visually compete with the meta
   text or hover actions on the top row. */
.ibv-farm-select-all {
    align-self: flex-start;
    margin-left: 18px;  /* visually aligns under the farm name (past chevron) */
    padding: 3px 10px;
    border: 1px solid rgba(51,123,48,0.3);
    border-radius: var(--radius-sm);
    background: #fff; color: var(--primary);
    font-size: 10.5px; font-weight: 600; font-family: var(--font-primary);
    cursor: pointer; user-select: none; white-space: nowrap;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ibv-farm-select-all:hover:not(:disabled) {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.ibv-farm-select-all:disabled { opacity: 0.4; cursor: default; }
