/* qc-vision.css — Photo Pipeline triage page
 * Builds on existing tokens from styles.css (--bg-0, --bg-1, --text-*, --accent, etc.)
 */

.qv-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  height: 100%;
}

/* ── TOPBAR ───────────────────────────────────────── */
.qv-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 0;
  flex-wrap: wrap;
}
.qv-title-row { display: flex; flex-direction: column; gap: 2px; }
.qv-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.qv-sub { font-size: 12px; color: var(--text-dim); }

/* ── KPI STRIP ────────────────────────────────────── */
.qv-kpi {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 6px 2px;
}
.qv-kpi-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 68px;
  padding: 6px 12px;
  border-left: 2px solid var(--border);
}
.qv-kpi-n { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.qv-kpi-l { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.qv-kpi-warn { border-left-color: #f59e0b; }
.qv-kpi-warn .qv-kpi-n { color: #fbbf24; }
.qv-kpi-bad { border-left-color: #ef4444; }
.qv-kpi-bad .qv-kpi-n { color: #f87171; }
.qv-kpi-ok { border-left-color: #22c55e66; }
.qv-kpi-ok .qv-kpi-n { color: #86efac; }
.qv-kpi-unresolved {
  border-left-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, transparent);
  border-radius: 0 6px 6px 0;
}
.qv-kpi-spacer { width: 6px; }

/* ── LAYOUT SWITCH ────────────────────────────────── */
.qv-layout-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}
.qv-ls-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-right: 4px;
}
.qv-ls-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.qv-ls-btn:hover { background: var(--bg-2); color: var(--text); }
.qv-ls-btn-on {
  background: color-mix(in oklch, var(--accent) 14%, transparent);
  border-color: color-mix(in oklch, var(--accent) 28%, transparent);
  color: var(--text);
}
.qv-ls-spacer { flex: 1; }
.qv-ls-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.qv-ls-toggle input { accent-color: var(--accent); }
.qv-ls-threshold {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
}
.qv-ls-threshold input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
}
.qv-ls-t-val { color: var(--text); min-width: 34px; text-align: right; }

/* ── WORK AREA ────────────────────────────────────── */
.qv-work {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  gap: 14px;
  min-height: 620px;
  align-items: stretch;
}
.qv-work-grid { grid-template-columns: 280px 1fr; }
.qv-work-comparison { grid-template-columns: 260px 1fr 340px; }

/* ── QUEUE (left) ─────────────────────────────────── */
.qv-queue {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  overflow-y: auto;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qv-q-section { display: flex; flex-direction: column; gap: 4px; }
.qv-q-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px 6px;
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.qv-q-count {
  padding: 1px 7px;
  background: var(--bg-2);
  border-radius: 999px;
  color: var(--text-dim);
}
.qv-q-routine-note {
  padding: 0 8px 4px;
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}
.qv-q-empty {
  padding: 16px 8px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 4px;
}

/* Queue row */
.qv-q-row {
  display: flex;
  gap: 10px;
  padding: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: background 0.12s;
  width: 100%;
}
.qv-q-row:hover { background: var(--bg-2); }
.qv-q-row-sel {
  background: color-mix(in oklch, var(--accent) 10%, transparent);
  border-color: color-mix(in oklch, var(--accent) 34%, transparent);
}
.qv-q-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
}
.qv-q-thumb > * { width: 100%; height: 100%; }
.qv-q-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1.5px solid var(--bg-1);
}
.qv-q-badge-warn { background: #f59e0b; color: #111; }
.qv-q-badge-bad  { background: #ef4444; color: #fff; }
.qv-q-badge-ok   { background: #22c55e; color: #111; }
.qv-q-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qv-q-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qv-q-sub {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 4px;
}
.qv-q-dot { color: var(--text-faint); }
.qv-q-crew { color: var(--text); }
.qv-q-finding {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qv-q-routine {
  font-size: 10.5px;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 2px;
}
.qv-q-dot-sev {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #888;
}
.qv-q-dot-critical { background: #ef4444; box-shadow: 0 0 0 2px #ef444422; }
.qv-q-dot-high { background: #f59e0b; }
.qv-q-dot-med  { background: #eab308; }
.qv-q-dot-info { background: #60a5fa; }

/* ── FOCUS / CANVAS (center) ──────────────────────── */
.qv-focus, .qv-compare, .qv-grid {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.qv-canvas {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  background: #0a0a0a;
}
.qv-canvas > *:first-child {
  flex: 1;
  min-height: 340px;
}
.qv-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}
.qv-overlay > g { pointer-events: auto; }
.qv-canvas-meta {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 11px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.qv-cm-item { color: #e5e7eb; }
.qv-cm-l {
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 9.5px;
  margin-right: 5px;
}
.qv-caption {
  padding: 12px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.85) 30%);
  color: #f3f4f6;
  font-size: 13px;
  line-height: 1.45;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 40%;
  overflow-y: auto;
}
.qv-caption-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #60a5fa;
  margin-bottom: 4px;
  font-weight: 600;
}
.qv-caption-ref .qv-caption-label { color: #86efac; }

/* ── COMPARE MODE ─────────────────────────────────── */
.qv-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: transparent;
  border: none;
}
.qv-compare-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.qv-compare-col:first-child { margin-right: 7px; }
.qv-compare-col:last-child  { margin-left: 7px; }
.qv-compare-label {
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.qv-canvas-ref .qv-caption { border-top: 2px solid #22c55e66; }

/* ── GRID MODE ────────────────────────────────────── */
.qv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  align-content: flex-start;
  overflow-y: auto;
  max-height: 82vh;
}
.qv-grid-cell {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  color: inherit;
  text-align: left;
  transition: transform 0.12s, border-color 0.12s;
}
.qv-grid-cell:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
}
.qv-grid-cell-sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.qv-grid-img {
  position: relative;
  aspect-ratio: 4/3;
  background: #0a0a0a;
  overflow: hidden;
}
.qv-grid-img > *:first-child { width: 100%; height: 100%; }
.qv-grid-meta { padding: 8px 10px 10px; }
.qv-grid-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.qv-grid-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-dim);
}
.qv-grid-tag {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.qv-grid-tag-warn { background: #f59e0b22; color: #fbbf24; }
.qv-grid-tag-bad  { background: #ef444422; color: #f87171; }
.qv-grid-tag-ok   { background: var(--bg-2); color: var(--text-faint); }
.qv-grid-time { color: var(--text-faint); }

/* ── RIGHT RAIL (findings) ────────────────────────── */
.qv-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 82vh;
  overflow-y: auto;
}
.qv-findings {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qv-findings-clean .qv-f-clean-title {
  font-size: 14px;
  font-weight: 500;
  color: #86efac;
}
.qv-findings-clean .qv-f-clean-body {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.qv-f-clean-caption { display: flex; flex-direction: column; gap: 8px; }
.qv-f-caption-actions { display: flex; gap: 6px; }

/* Finding nav tabs */
.qv-f-tabs { display: flex; gap: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.qv-f-tab {
  background: var(--bg-2);
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}
.qv-f-tab-active {
  background: var(--bg-0);
  border-color: var(--border);
  color: var(--text);
}

/* Finding header */
.qv-f-head { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.qv-f-sev-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.qv-f-sev-pill {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.qv-f-sev-critical { background: #ef4444; color: #fff; }
.qv-f-sev-high { background: #f59e0b22; color: #fbbf24; border: 1px solid #f59e0b55; }
.qv-f-sev-med  { background: #eab30822; color: #facc15; border: 1px solid #eab30855; }
.qv-f-sev-info { background: #60a5fa22; color: #93c5fd; border: 1px solid #60a5fa55; }
.qv-f-conf { font-size: 12px; color: var(--text-dim); }
.qv-f-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.qv-f-desc { font-size: 12px; color: var(--text-dim); }

/* Obsidian rule citation */
.qv-f-rule {
  background: color-mix(in oklch, var(--accent) 6%, var(--bg-2));
  border: 1px solid color-mix(in oklch, var(--accent) 22%, var(--border));
  border-radius: 8px;
  padding: 9px 11px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: inherit;
  width: 100%;
}
.qv-f-rule:hover { background: color-mix(in oklch, var(--accent) 10%, var(--bg-2)); }
.qv-f-rule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.qv-f-rule-code {
  font-size: 11.5px;
  font-weight: 600;
  color: color-mix(in oklch, var(--accent) 85%, white);
}
.qv-f-rule-more { font-size: 10.5px; color: var(--text-faint); }
.qv-f-rule-path {
  font-size: 10.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qv-f-rule-excerpt {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--bg-0);
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
  border-left: 2px solid color-mix(in oklch, var(--accent) 50%, transparent);
}
.qv-f-rule-excerpt-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-style: normal;
  font-weight: 600;
}

/* Evidence + suggestion */
.qv-f-section-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 5px;
  font-weight: 600;
}
.qv-f-evidence-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.55;
}
.qv-f-evidence-list li { margin-bottom: 3px; }
.qv-f-suggestion {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 9px 11px;
}
.qv-f-suggestion-text {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.qv-f-caption {
  padding: 9px 11px;
  background: var(--bg-2);
  border-radius: 8px;
  border: 1px dashed var(--border);
}
.qv-f-caption-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-weight: 600;
}
.qv-f-caption-text {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  font-style: italic;
}

/* Action buttons */
.qv-f-actions {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.qv-btn {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  transition: background 0.12s;
}
.qv-btn:hover { background: var(--bg-0); }
.qv-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
}
.qv-btn-primary:hover { filter: brightness(1.1); }
.qv-btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.qv-btn-ghost { background: transparent; }
.qv-btn-text {
  background: transparent;
  border: none;
  color: var(--text-faint);
  text-decoration: underline;
  padding: 3px;
  font-size: 11px;
}

/* Skip flow */
.qv-f-skip {
  padding: 10px;
  background: var(--bg-2);
  border-radius: 8px;
  border: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qv-f-skip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.qv-chip {
  padding: 4px 9px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-dim);
  transition: all 0.12s;
}
.qv-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: color-mix(in oklch, var(--accent) 8%, var(--bg-0));
}

/* Correct flow */
.qv-f-correct {
  padding: 10px;
  background: color-mix(in oklch, #a855f7 7%, var(--bg-2));
  border-radius: 8px;
  border: 1px solid color-mix(in oklch, #a855f7 25%, var(--border));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qv-f-correct-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}
.qv-f-correct-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  resize: vertical;
  min-height: 60px;
}
.qv-f-correct-input:focus {
  outline: none;
  border-color: #a855f7;
}
.qv-f-correct-actions { display: flex; gap: 6px; }

/* Resolution indicator */
.qv-resolved {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: color-mix(in oklch, #22c55e 10%, var(--bg-1));
  border: 1px solid color-mix(in oklch, #22c55e 30%, var(--border));
  border-radius: 8px;
  font-size: 12px;
  color: #86efac;
}
.qv-resolved-dot { color: #22c55e; }

/* Learning note */
.qv-learning-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg-1);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.qv-ln-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 0 3px #60a5fa22;
  animation: qv-pulse 2.4s ease-in-out infinite;
}
@keyframes qv-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* Toast */
.qv-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: qv-toast-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes qv-toast-in {
  from { transform: translate(-50%, 8px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.qv-toast-ok {
  border-color: #22c55e55;
  background: color-mix(in oklch, #22c55e 12%, #1a1a1a);
}

/* Responsive */
@media (max-width: 1200px) {
  .qv-work { grid-template-columns: 240px 1fr; }
  .qv-right { grid-column: 1 / -1; }
}
