/* harvest.css — Fleet Ops "Picking insights" (components/harvest-insights.mjs) + its 16:9 slide deck
   (components/harvest-deck.mjs). Builds on app.css tokens and kpi.css (.ops-* filter bar, chips, buttons). */

/* view switch (Operations | Picking insights) */
.ops-viewbar { display: flex; }
.ops-viewbar .fleet-winbar { flex-wrap: wrap; }
.ops-viewbar .fleet-win { min-height: 32px; padding: 6px 14px; font-size: .85rem; }

.hv-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hv-wrap .ss-card { margin-bottom: 0; min-width: 0; }
.hv-body { display: flex; flex-direction: column; gap: 12px; transition: opacity .2s; min-width: 0; }
.hv-body.stale { opacity: .55; }
.hv-op-note { font-size: .75rem; color: var(--text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* card chrome */
.hv-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.hv-card-head h3 { margin: 0; }
.hv-card-title { min-width: 0; flex: 1 1 320px; }
.hv-sub { margin: 4px 0 0; font-size: .8rem; color: var(--text-muted); max-width: 80ch; }
.hv-note { margin: 8px 0 0; font-size: .75rem; color: var(--text-muted); }
.hv-sub-h { margin: 16px 0 6px; font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.hv-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.hv-tool { min-height: 28px; padding: 3px 10px; font-size: .75rem; }
.hv-tool.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.hv-more { margin-top: 10px; font-size: .8rem; }

/* findings */
.hv-findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.hv-find { background: var(--surface-2); border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.hv-find.sev-high { border-left-color: var(--err); }
.hv-find.sev-medium { border-left-color: var(--warn); }
.hv-find.sev-info { border-left-color: var(--text-muted); }
.hv-find-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.hv-sev { display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text); }
.hv-sev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.hv-sev.sev-high .hv-sev-dot { background: var(--err); }
.hv-sev.sev-medium .hv-sev-dot { background: var(--warn); }
.hv-cat { font-size: .68rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.hv-find-title { margin: 0 0 4px; font-size: .92rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.hv-find-detail { margin: 0 0 8px; font-size: .8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.hv-evidence { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hv-chip { display: inline-flex; gap: 6px; align-items: baseline; font-size: .72rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); overflow-wrap: anywhere; }
.hv-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.hv-action { margin: 0; font-size: .8rem; overflow-wrap: anywhere; }
.hv-action b { font-weight: 600; color: var(--text-muted); }

/* headline tiles */
.hv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 1100px) { .hv-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hv-tile { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.hv-tile-label { font-size: .75rem; color: var(--text-muted); }
.hv-tile-value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-delta { font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hv-delta.good, .hv-badge.good { color: var(--ok); }
.hv-delta.bad, .hv-badge.bad { color: var(--err); }
.hv-delta.flat, .hv-delta.none, .hv-badge.flat { color: var(--text-muted); font-weight: 500; }
.hv-tile-note { font-size: .7rem; color: var(--text-muted); }

/* operator scorecards */
.hv-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.hv-score { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hv-score-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hv-score-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hv-score-big { margin: 0; font-size: .85rem; color: var(--text-muted); }
.hv-score-big b { font-size: 1.6rem; font-weight: 600; color: var(--text); }
.hv-score-big span { white-space: nowrap; }
.hv-score-sub { margin: 0; font-size: .78rem; color: var(--text-muted); }
.hv-score-kv { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--text-muted); }
.hv-score-kv b { color: var(--text); font-weight: 600; }
.hv-score-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: space-between; margin-top: 2px; }
.hv-badge { font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); }
.hv-score-meta { font-size: .72rem; color: var(--text-muted); }
.hv-swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.hv-score-head .hv-swatch { margin-right: 0; width: 12px; height: 12px; }

/* charts */
.hv-chart-box { position: relative; width: 100%; min-width: 0; }
.hv-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.hv-svg:focus-visible, .hv-svg .hv-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hv-svg .hv-mark { cursor: default; outline: none; }
.hv-svg .hv-mark:hover .hv-m, .hv-svg .hv-mark:focus .hv-m { filter: brightness(1.25); }
.hv-svg .hv-mark:focus-visible .hv-m { stroke: var(--text); }
.hv-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .75rem; color: var(--text); margin: 0 0 8px; }
.hv-key { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.hv-key-svg { flex: 0 0 auto; }
.hv-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 140px; max-width: 260px; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; box-shadow: var(--shadow); font-size: .75rem; }
.hv-tip-h { color: var(--text-muted); margin-bottom: 4px; overflow-wrap: anywhere; }
.hv-tip-r { display: flex; align-items: center; gap: 7px; }
.hv-tip-r b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.hv-tip-r span:last-child { color: var(--text-muted); overflow-wrap: anywhere; }
.hv-tip-k { width: 12px; height: 2px; border-radius: 1px; background: transparent; flex: 0 0 auto; }
.hv-alt { margin-top: 4px; }

/* tables (scroll sideways inside their card; the first column stays put) */
.hv-table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.hv-table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hv-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .8rem; font-variant-numeric: tabular-nums; }
.hv-table th, .hv-table td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.hv-table thead th { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; vertical-align: bottom; }
.hv-table th:first-child, .hv-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.hv-table tbody th { font-weight: 600; }
.hv-table .t { text-align: left; }
.hv-table tfoot th:first-child, .hv-table tfoot td:first-child { background: var(--surface-2); }
.hv-table tfoot th, .hv-table tfoot td { font-weight: 700; border-bottom: 0; background: var(--surface-2); }
.hv-table tr.hv-group-start > * { border-top: 1px solid var(--text-muted); }
.hv-table tbody tr:first-child.hv-group-start > * { border-top: 0; }
.hv-table td.worse { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); box-shadow: inset 2px 0 0 var(--warn); }
.hv-scroll-y { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.hv-scroll-y.tall { max-height: 560px; }
.hv-scroll-y thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.hv-scroll-y thead th:first-child { z-index: 3; }
.hv-agecell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.hv-mbar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hv-mbar > span { display: block; height: 100%; border-radius: 0 3px 3px 0; background: #aab4c0; }

/* method */
.hv-method summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 32px; line-height: 1; }
.hv-method summary::before { line-height: 1; }
.hv-method summary::-webkit-details-marker { display: none; }
.hv-method summary::before { content: "▸"; color: var(--text-muted); transition: transform .15s; }
.hv-method details[open] summary::before { transform: rotate(90deg); }
.hv-method summary h3 { margin: 0; }
.hv-defs { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 16px; margin: 10px 0 0; font-size: .8rem; }
.hv-defs dt { font-weight: 600; }
.hv-defs dd { margin: 0; color: var(--text-muted); }
.hv-coverage { margin: 10px 0 0; font-size: .75rem; color: var(--text-muted); }

@media (max-width: 520px) {
  .hv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hv-tile { padding: 10px; }
  .hv-tile-value { font-size: 1.2rem; }
  .hv-defs { grid-template-columns: 1fr; gap: 2px; }
  .hv-defs dd { margin-bottom: 8px; }
  .hv-card-head { flex-direction: column; }
  .hv-card-title { flex-basis: auto; }
  .ops-viewbar .fleet-winbar { width: 100%; }
  .ops-viewbar .fleet-win { flex: 1 1 0; }
  .hv-export .ops-exp-btn { flex: 1 1 auto; }
}
@media (pointer: coarse) {
  .hv-tool, .hv-more, .ops-viewbar .fleet-win { min-height: 44px; }
  .hv-method summary { min-height: 44px; }
}

/* iPhone design layer (html.ios-app, js/ios.mjs) */
html.ios-app .hv-find, html.ios-app .hv-tile, html.ios-app .hv-score { border: 0; border-radius: 14px; }
html.ios-app .hv-find { box-shadow: inset 3px 0 0 var(--text-muted); }
html.ios-app .hv-find.sev-high { box-shadow: inset 3px 0 0 var(--err); }
html.ios-app .hv-find.sev-medium { box-shadow: inset 3px 0 0 var(--warn); }
html.ios-app .hv-cat { border: 0; background: var(--surface-3); }
html.ios-app .hv-tile-value, html.ios-app .hv-score-big b { font-family: var(--num, inherit); }
html.ios-app .hv-table th:first-child, html.ios-app .hv-table td:first-child { background: var(--surface); }

/* ===================== slide deck (#hv-deck, harvest-deck.mjs) — 16:9, one slide per page ========== */
#hv-deck { display: none; }
@media print {
  html.hv-printing, html.hv-printing body { background: #fff !important; color: #1b2430 !important; color-scheme: light;
    min-height: 0 !important; height: auto !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; }
  html.hv-printing body > *:not(#hv-deck) { display: none !important; }
  html.hv-printing #hv-deck { display: block; }
}
#hv-deck { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: #1b2430; background: #fff;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hv-slide { width: 13.333in; height: 7.5in; box-sizing: border-box; padding: 44px 64px 0; position: relative; overflow: hidden;
  display: flex; flex-direction: column; background: #fff; break-after: page; page-break-after: always; break-inside: avoid; }
.hv-slide:last-child { break-after: auto; page-break-after: auto; }
.hvd-head { flex: 0 0 auto; margin-bottom: 18px; }
.hvd-kicker { font-size: 11pt; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: #2a78d6; }
.hvd-headline { font-size: 25pt; line-height: 1.15; margin: 6px 0 0; font-weight: 700; color: #1b2430; max-width: 1100px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.hvd-subtitle { font-size: 13pt; color: #5b6675; margin: 6px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hvd-body { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.hvd-foot { position: absolute; left: 64px; right: 64px; bottom: 22px; display: flex; justify-content: space-between; gap: 20px;
  font-size: 11pt; color: #5b6675; border-top: 1px solid #e1e5ea; padding-top: 10px; }
.hvd-note { font-size: 11pt; color: #5b6675; margin: 8px 0 0; }
.hvd-h3 { font-size: 13pt; font-weight: 700; margin: 14px 0 8px; color: #1b2430; }
.hvd-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }

/* cover */
.hv-slide.cover { padding: 72px 64px 0; }
.hvd-cover { display: flex; flex-direction: column; height: 100%; padding-bottom: 84px; box-sizing: border-box; }
.hvd-cover-title { font-size: 54pt; line-height: 1.05; margin: 16px 0 6px; font-weight: 800; letter-spacing: -.01em; }
.hvd-cover-period { font-size: 18pt; color: #5b6675; margin: 0 0 26px; }
.hvd-cover-meta { display: flex; gap: 56px; font-size: 13pt; margin-bottom: 40px; }
.hvd-cover-meta span { display: block; font-size: 11pt; color: #5b6675; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.hvd-cover-meta b { font-weight: 600; }
.hvd-big4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: auto; }
.hvd-big { border-top: 3px solid #1b2430; padding-top: 12px; }
.hvd-big b { display: block; font-size: 44pt; font-weight: 700; line-height: 1.1; }
.hvd-big span { font-size: 13pt; color: #5b6675; }
.hvd-cover-foot { margin-top: 26px; font-size: 11pt; color: #5b6675; }

/* findings */
.hvd-finds { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px 22px; height: 100%; padding-bottom: 76px; box-sizing: border-box; }
.hvd-find { border-left: 4px solid #a3acb7; padding: 4px 0 4px 14px; min-height: 0; overflow: hidden; }
.hvd-find.sev-high { border-left-color: #d1242f; }
.hvd-find.sev-medium { border-left-color: #c98500; }
.hvd-find-tags { display: flex; gap: 8px; margin-bottom: 3px; font-size: 11pt; }
.hvd-sev { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hvd-sev.sev-high { color: #b3261e; }
.hvd-sev.sev-medium { color: #8a5a00; }
.hvd-sev.sev-info { color: #5b6675; }
.hvd-cat { color: #5b6675; }
.hvd-find-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5pt; line-height: 1.25; }
.hvd-find-detail, .hvd-find-action { margin: 3px 0 0; font-size: 11pt; line-height: 1.3; color: #3b4656;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hvd-find-action b { color: #1b2430; }

/* tiles */
.hvd-tiles { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 22px 26px; height: 100%; padding-bottom: 92px; box-sizing: border-box; }
.hvd-tile { border-top: 2px solid #e1e5ea; padding-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.hvd-tile-l { font-size: 12pt; color: #5b6675; }
.hvd-tile-v { font-size: 36pt; font-weight: 700; line-height: 1.15; }
.hvd-delta { font-size: 12pt; font-weight: 700; }
.hvd-delta.good { color: #1a7f37; } .hvd-delta.bad { color: #b3261e; } .hvd-delta.flat, .hvd-delta.none { color: #5b6675; font-weight: 500; }
.hvd-tile-n { font-size: 11pt; color: #5b6675; }

/* scorecards */
.hvd-scores { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); }
.hvd-scores.n1 { grid-template-columns: minmax(0, 520px); }
.hvd-scores.n2 { grid-template-columns: repeat(2, 1fr); }
.hvd-score { border: 1px solid #e1e5ea; border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hvd-score-head { display: flex; align-items: center; font-size: 14pt; min-width: 0; overflow-wrap: anywhere; }
.hvd-score-big { margin: 0; font-size: 13pt; color: #5b6675; }
.hvd-score-big b { font-size: 30pt; color: #1b2430; }
.hvd-score-sub, .hvd-score-meta { margin: 0; font-size: 11pt; color: #5b6675; }
.hvd-score-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 11pt; color: #5b6675; }
.hvd-score-kv b { color: #1b2430; font-size: 13pt; }
.hvd-badge { align-self: flex-start; font-size: 11pt; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #f2f4f7; }
.hvd-badge.good { color: #1a7f37; } .hvd-badge.bad { color: #b3261e; } .hvd-badge.flat { color: #5b6675; }

/* charts */
.hvd-chart svg { display: block; }
.hvd-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 12pt; margin-bottom: 8px; }
.hvd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hvd-two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.hvd-two .hvd-h3 { margin-top: 0; }
.hvd-stack { display: flex; flex-direction: column; }
.hvd-stack.gap { gap: 26px; }

/* tables */
.hvd-table { width: 100%; border-collapse: collapse; font-size: 12pt; font-variant-numeric: tabular-nums; }
.hvd-table.small { font-size: 11pt; }
.hvd-table th, .hvd-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid #e1e5ea; white-space: nowrap; }
.hvd-table th:first-child, .hvd-table td:first-child, .hvd-table .t { text-align: left; }
.hvd-table thead th { font-size: 11pt; font-weight: 600; color: #5b6675; border-bottom: 1.5px solid #9aa8b8; white-space: normal; vertical-align: bottom; }
.hvd-table tbody th { font-weight: 600; }
.hvd-table tr.foot > * { font-weight: 700; border-top: 1.5px solid #9aa8b8; border-bottom: 0; }
.hvd-table tr.group > * { border-top: 1.5px solid #9aa8b8; }
.hvd-table td.worse { background: #fff3d6; box-shadow: inset 3px 0 0 #c98500; }

/* method */
.hvd-defs { columns: 2; column-gap: 40px; margin: 0; font-size: 11pt; line-height: 1.3; }
.hvd-defs > div { break-inside: avoid; margin-bottom: 8px; }
.hvd-defs dt { font-weight: 700; }
.hvd-defs dd { margin: 0; color: #3b4656; }
html .hv-method summary h3, html.ios-app .hv-method summary h3 { margin: 0; line-height: 1.2; }

/* empty period */
.hv-empty { padding: 28px 24px; }
.hv-empty-title { margin: 0 0 6px; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.hv-empty-text { margin: 0; color: var(--text-muted); max-width: 70ch; }
.hv-empty-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hv-empty-actions:empty { display: none; }

/* ---- progress per operator, operator profile, video review, who operated ---------------------------- */
.hv-prog-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; margin: 2px 0 10px; }
.hv-prog-controls .ops-chips { flex-wrap: wrap; }
.hv-select { min-height: 36px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2, var(--surface));
  color: var(--text); font: inherit; max-width: 100%; }
.hv-prof-tiles { margin-bottom: 12px; }
.hv-score-review { padding-top: 2px; }
.hv-score-attr { margin: 0; font-size: .74rem; color: var(--text-muted); }
.hv-conf { font-weight: 600; }
.hv-conf.c-confirmed { color: var(--ok); }
.hv-conf.c-likely { color: var(--warn, var(--text)); }
.hv-conf.c-possible { color: var(--err); }
.hv-table td.hv-wrap-cell { white-space: normal; min-width: 260px; max-width: 520px; text-align: left; }
