/* ── Variables ───────────────────────────────────────────────── */
/* Palette inspired by flawless.ts.app — deep navy with layered radial
   gradients for atmospheric depth, shadcn-style 8px controls, Inter font. */
:root {
  --bg:           hsl(220, 47%, 7%);       /* deep navy base */
  --surface:      hsl(222, 35%, 11%);      /* card */
  --surface-2:    hsl(220, 30%, 15%);      /* hover/elevated */
  --border:       hsl(220, 27%, 22%);
  --border-light: hsl(220, 27%, 30%);
  --accent:       #6366f1;
  --accent-dim:   rgba(99,102,241,.15);
  --accent-light: #818cf8;
  --text:         hsl(210, 40%, 98%);
  --text-2:       hsl(214, 32%, 85%);
  --text-3:       hsl(215, 20%, 65%);
  --green:        #22c55e;
  --amber:        #f59e0b;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --radius:       8px;
  --radius-sm:    6px;
  /* Atmospheric radial gradient overlay layers applied to <body> */
  --bg-gradient-1: radial-gradient(ellipse 60% 40% at 20% 80%, hsla(220, 70%, 20%, .6) 0%, transparent 70%);
  --bg-gradient-2: radial-gradient(ellipse 50% 60% at 80% 20%, hsla(240, 60%, 18%, .7) 0%, transparent 60%);
  --bg-gradient-3: radial-gradient(ellipse 40% 50% at 40% 40%, hsla(200, 80%, 15%, .5) 0%, transparent 65%);
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background-color: var(--bg);
  background-image: var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font: inherit; }
a      { color: var(--accent-light); }
kbd    { font-family: monospace; background: var(--surface-2); border: 1px solid var(--border);
         border-radius: 3px; padding: 1px 5px; font-size: .85em; }

/* ── Header ──────────────────────────────────────────────────── */
.header {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}
.header-inner { display: flex; align-items: center; gap: 10px; width: 100%; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.logo-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  flex-shrink: 0;
}
.header-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-link {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  text-decoration: none; padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: color .12s, background .12s;
}
.nav-link:hover  { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--surface-2); }
.header-user {
  display: flex; align-items: center; gap: 8px;
  margin-left: 12px; padding-left: 12px;
  border-left: 1px solid var(--border);
  position: relative;
}
.user-email { font-size: 11px; color: var(--text-3); display: none; }  /* legacy — hidden, avatar shows initials */
.sign-out-btn {
  font-size: 11px; font-weight: 500; color: var(--text-2);
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px 8px;
  transition: color .12s, border-color .12s;
}
.sign-out-btn:hover { color: var(--text); border-color: var(--border-light); }

/* Circular user avatar (Flawless-style) */
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 50%, #a78bfa 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  cursor: pointer;
  border: 1px solid hsla(220, 30%, 80%, .15);
  transition: transform .12s, box-shadow .12s;
  flex-shrink: 0;
  user-select: none;
}
.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px hsla(240, 50%, 70%, .25);
}

/* ── Main ────────────────────────────────────────────────────── */
/* The two trays are position:fixed on the screen edges. .main pads to leave
   room for them — widths are CSS vars that flip when a tray collapses. */
body {
  --tray-left-w-user: 240px;             /* user-dragged width (JS persists to localStorage) */
  --tray-left-w:  var(--tray-left-w-user);
  --tray-right-w: 300px;
  --tray-rail-w:   32px;  /* width when collapsed */
}
body.tray-left-collapsed  { --tray-left-w:  var(--tray-rail-w); }
body.tray-right-collapsed { --tray-right-w: var(--tray-rail-w); }
.main {
  max-width: none;
  margin: 0;
  padding: 0 0 40px;
  padding-left:  var(--tray-left-w);
  padding-right: var(--tray-right-w);
  transition: padding .18s ease;
}
/* When the right tray is hidden (Mixpeek mode), don't reserve space for it */
/* Mixpeek mode reuses the right tray to show the live Mixpeek API call
   log, so we KEEP --tray-right-w at its default 300px (not 0). */

/* ── Search section ──────────────────────────────────────────── */
.search-section {
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 14px;
  margin: 0;
}
textarea {
  width: 100%;
  min-height: 60px;            /* fits two lines of placeholder */
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
  resize: none;
  line-height: 1.5;
  transition: border-color .15s;
  display: block;
  white-space: pre-wrap;
}
textarea:focus           { outline: none; border-color: var(--accent); }
textarea::placeholder    { color: var(--text-3); }
.search-row {
  display: flex; align-items: center; gap: 8px;
}
/* Ads-analytics Browse dropdown — sits in the search row, so it must be
   auto-width (NOT .filter-select's width:100%, which blew out the layout). */
.browse-select {
  flex: none; width: auto; max-width: 200px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; padding: 8px 10px; cursor: pointer;
}
.search-input-wrap { flex: 1; min-width: 0; }
.input-hint { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.search-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  padding: 8px 20px;
  transition: background .12s, transform .08s;
}
.search-btn:hover    { background: #5153d4; }
.search-btn:active   { transform: scale(.97); }
.search-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Results layout ──────────────────────────────────────────── */
.results-layout { display: flex; align-items: flex-start; gap: 16px; }
.results-section { flex: 1; min-width: 0; padding: 0 14px; }

/* ── Filter sidebar (fixed to LEFT edge, full viewport height) ── */
.filters-sidebar {
  position: fixed;
  left: 0; top: 52px; bottom: 0;
  width: var(--tray-left-w);
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 14px 10px;
  overflow-y: auto;
  z-index: 5;
  transition: width .18s ease;
}
/* Drag handle on the left tray's right edge — widen to read full collection
   names. Fixed to the border so it doesn't scroll with the tray content. */
.tray-resizer {
  position: fixed; top: 52px; bottom: 0;
  left: var(--tray-left-w);
  width: 7px; margin-left: -3px;     /* straddle the 1px border */
  cursor: ew-resize; z-index: 6;
  background: transparent;
  transition: background .12s ease;
}
.tray-resizer::after {            /* thin visible hint line on hover */
  content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px;
  background: transparent;
}
.tray-resizer:hover::after, .tray-resizer.dragging::after { background: var(--accent); }
.tray-resizer:hover, .tray-resizer.dragging { background: color-mix(in srgb, var(--accent) 18%, transparent); }
body.tray-left-collapsed .tray-resizer { display: none; }   /* nothing to resize when collapsed */
/* Kill the width/padding easing while actively dragging so it tracks 1:1. */
body.tray-resizing .filters-sidebar,
body.tray-resizing .main { transition: none !important; }

/* ── Filters button (search row) + Filters modal ───────────────── */
.filters-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; padding: 8px 16px;
  cursor: pointer; position: relative;
  transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.filters-btn:hover { color: var(--text); border-color: var(--text-3); }
.filters-btn.active {                       /* glow when filters differ from defaults */
  border-color: var(--accent); color: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 0 8px rgba(99,102,241,.35);
}
.filters-badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.filters-badge[hidden] { display: none; }

.fmodal-overlay {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 24px 24px;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.fmodal-overlay[hidden] { display: none; }
.fmodal-dialog {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 14px; width: 100%; max-width: 420px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.fmodal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600;
}
.fmodal-close {
  background: transparent; border: none; color: var(--text-3);
  font-size: 15px; cursor: pointer; padding: 4px 7px; border-radius: 5px;
  transition: background .12s, color .12s;
}
.fmodal-close:hover { background: var(--bg); color: var(--text); }
.fmodal-body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.fmodal-body .filter-group { margin: 0; }
.fmodal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.fmodal-done {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  padding: 8px 22px; cursor: pointer; transition: background .12s;
}
.fmodal-done:hover { background: var(--accent-light); }

/* ── Supervising-producer multi-select (Filters modal) ─────────── */
.producer-filter { position: relative; }
.producer-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; box-sizing: border-box; padding: 7px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; text-align: left;
}
.producer-trigger:hover { border-color: var(--text-3); }
.producer-trigger .producer-caret { color: var(--text-3); font-size: 10px; flex-shrink: 0; }
.producer-trigger[aria-expanded="true"] { border-color: var(--accent); }
#producer-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#producer-trigger-label.is-all { color: var(--text-3); }
.producer-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  overflow: hidden;
}
.producer-panel[hidden] { display: none; }
.producer-search {
  width: 100%; box-sizing: border-box; padding: 7px 10px;
  background: var(--bg); color: var(--text); border: none;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.producer-search:focus { outline: none; }
.producer-list { max-height: 220px; overflow-y: auto; padding: 4px; }
.producer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 4px; cursor: pointer;
  font-size: 13px; color: var(--text-2); user-select: none;
}
.producer-item:hover { background: var(--surface-2); }
.producer-item.selected { color: var(--text); font-weight: 600; }
.producer-item input[type=checkbox] { margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.producer-item .producer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.producer-empty { padding: 12px 10px; color: var(--text-3); font-size: 12px; text-align: center; }
.filters-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.filters-header > span {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-2);
}
.clear-filters-btn {
  font-size: 11px; color: var(--text-3); background: transparent; border: none;
  padding: 2px 5px; border-radius: 4px; transition: color .12s, background .12s;
}
.clear-filters-btn:hover { color: var(--text); background: var(--bg); }
.filter-group { margin-bottom: 14px; }
.filter-label {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); margin-bottom: 6px;
}
.filter-label-value { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-3); }
.filter-select,
.filter-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 6px 8px;
  transition: border-color .15s;
}
.filter-select:focus,
.filter-input:focus     { outline: none; border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-3); }
.filter-select option   { background: var(--surface); }
#mixpeek-config .filter-select {
  font-size: 11px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.filter-range { width: 100%; accent-color: var(--accent); cursor: pointer; display: block; }

/* Duration range — two number inputs */
.range-inputs { display: flex; align-items: center; gap: 6px; }
.num-input { width: 0; flex: 1; text-align: center; -moz-appearance: textfield; }
.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.range-sep { color: var(--text-3); font-size: 12px; flex-shrink: 0; }

/* Toggle switches */
.toggles-group { display: flex; flex-direction: column; gap: 8px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
}
.toggle-label { font-size: 12px; color: var(--text-2); user-select: none; }
.toggle { position: relative; display: inline-flex; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  width: 30px; height: 17px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  transition: background .15s, border-color .15s;
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 11px; height: 11px;
  background: var(--text-3);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.toggle input:checked + .toggle-track             { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after      { transform: translateX(13px); background: #fff; }
.toggle input:not(:checked) + .toggle-track::after { background: var(--text-3); }

/* ── Results meta ────────────────────────────────────────────── */
.results-meta { font-size: 12px; color: var(--text-3); margin-bottom: 12px; min-height: 18px; padding-left: 14px; }

/* ── Results grid ────────────────────────────────────────────── */
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ── Video card ──────────────────────────────────────────────── */
/* Editor warning from Iconik metadata ('warning'/'TESTWARNING') —
   red banner pinned to the TOP of the result card so "AVOID USING"
   style notes are impossible to miss. Full text in the title attr. */
.card-warning {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  padding: 5px 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Test-field warnings (TESTWARNING — softer notes like "Old
   Packaging") — yellow-orange so they read as caution, not alarm. */
.card-warning-test {
  background: var(--amber);
  color: #1c1207;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  outline-offset: 2px;
}
.video-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
.video-card:focus-visible { outline: 2px solid var(--accent); }

/* 16:9 video/thumb area */
.video-wrapper {
  position: relative;
  width: 100%;          /* required for aspect-ratio to compute height */
  aspect-ratio: 1/1;    /* square cards — consistent height across landscape/portrait */
  background: #000;
  overflow: hidden;
}
.video-wrapper video,
.video-wrapper .thumb-img {
  width: 100%; height: 100%;
  object-fit: contain; display: block; background: #000;
}
.thumb-placeholder {
  width: 100%; aspect-ratio: 1/1; background: var(--surface-2);
  position: relative;
}
/* While the placeholder is showing, the asset's proxy URL is either
   still being fetched OR the async verifier hasn't decided yet — show
   a soft spinner so the user knows we're working, not failing. A
   stalled verifier eventually swaps the placeholder for the real media
   OR escalates to .video-error-state via _markPreviewUnavailable. */
.thumb-placeholder::after {
  content: ""; position: absolute;
  top: 50%; left: 50%; width: 22px; height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: thumbSpin .9s linear infinite;
  pointer-events: none;
}
@keyframes thumbSpin { to { transform: rotate(360deg); } }

/* Error state */
.video-error-state {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; background: #111;
  color: var(--text-3); font-size: 12px;
}
.video-wrapper.errored .video-error-state { display: flex; }
.video-wrapper.errored video              { opacity: 0; }

/* Mouse-enter retry state — wrapper is in mid-refetch after an
   initial "Preview unavailable". Show a subtle pulsing placeholder
   so the editor knows something is happening; loadCardMedia will
   swap it for the real media on success or re-mark errored on fail. */
.video-wrapper.retrying::after {
  content: "Retrying…"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11px; font-style: italic;
  background: #111;
  animation: previewRetryPulse 1.2s ease-in-out infinite;
}
@keyframes previewRetryPulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}

/* Play overlay */
.play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s; pointer-events: none;
}
.play-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.video-card:hover .play-icon { background: rgba(99,102,241,.5); }
.video-wrapper.playing .play-overlay { opacity: 0; }

/* Badges */
.score-badge {
  position: absolute; top: 7px; right: 7px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border-radius: 20px; padding: 2px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.score-badge.high { color: var(--green); }
.score-badge.mid  { color: var(--amber); }
.score-badge.low  { color: var(--red); }   /* unreliable: below the calibrated floor */

/* Per-channel relevance breakdown row (under the thumbnail). Each chip is one
   channel's weighted contribution to the total; they sum to the headline %. */
.score-breakdown {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px 10px 0;
}
.bd-chip {
  font-size: 10px; font-weight: 600; letter-spacing: .01em;
  color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1px 7px;
  white-space: nowrap;
}
.bd-chip:first-child { color: var(--text); border-color: var(--border-light); }  /* visual */
/* Modal breakdown pills sit beside the total pill */
.score-pill.bd-pill {
  background: var(--surface-2); color: var(--text-2);
  margin-left: 6px; font-weight: 600;
}

.dur-badge {
  position: absolute; bottom: 28px; left: 7px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  border-radius: 4px; padding: 2px 6px;
  font-size: 11px; color: var(--text-2);
  font-family: 'SF Mono', Menlo, monospace;
}

/* No video proxy: dur badge at bottom-left directly */
.video-wrapper:not(:has(.video-progress-wrap)) .dur-badge { bottom: 7px; }

/* ★ Opener tag — top-left of the preview when this footage opens an ad. */
.opener-tag {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  background: rgba(251, 191, 36, .92); color: #1a1206;
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 800; letter-spacing: .02em;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

/* NEW tag — fresh footage inside its client's freshness horizon (mig 038).
   Sits below ★ Opener when both render (an opener can also be new). */
.new-tag {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  background: rgba(34, 197, 94, .92); color: #04170a;
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.opener-tag + .new-tag { top: 28px; }

/* Project-file card — the .prproj heading a "Footage used" list. */
.project-card { cursor: pointer; }
.project-card .project-tile {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(160deg, #1c2030, #14192b);
  font-size: 42px;
}
.project-card .project-tile span {
  font-size: 12px; color: var(--accent-light, #818cf8);
  font-family: 'SF Mono', Menlo, monospace; letter-spacing: .06em;
}
/* Poster frame (when Iconik has one): NATIVE aspect ratio, always —
   contain letterboxes inside the square tile; never cover/stretch. */
.project-card .project-tile img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #0d0f17;
}
/* Keep the .prproj label readable above a poster. */
.project-card .project-tile span {
  position: relative; z-index: 1;
  background: rgba(0,0,0,.55); border-radius: 4px; padding: 1px 6px;
}

/* APPROVED AD tag — this asset is an approved ad (name/J-code lookups make
   this non-obvious: the grid looks like footage). Sits under the score badge. */
.ad-tag {
  position: absolute; top: 34px; right: 7px; z-index: 2;
  background: rgba(99, 102, 241, .92); color: #eef;
  border-radius: 4px; padding: 2px 7px;
  font-size: 9px; font-weight: 800; letter-spacing: .05em;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}

/* Progress bar */
.video-progress-wrap {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 5px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  pointer-events: none;
}
.video-progress {
  flex: 1; height: 3px;
  background: rgba(255,255,255,.18);
  border-radius: 2px; overflow: visible; position: relative;
}
.video-progress-bar { height: 100%; width: 0%; background: var(--accent); transition: width .15s linear; }

/* Audio cards: the transcript replaces the (useless) waveform/black video and
   karaoke-highlights words as the muted hover-play advances. Fills the square
   media box; the hidden <audio> drives it. */
.audio-transcript {
  position: absolute; inset: 0;
  overflow-y: auto; padding: 10px 11px 26px;
  background: var(--surface-2); text-align: left;
  font-size: 12px; line-height: 1.7; color: var(--text-2);
}
.audio-transcript .at-hint { color: var(--text-3); font-size: 11px; }
.audio-transcript .ts-line { padding: 1px 3px; border-radius: 4px; transition: background .15s ease; }
.audio-transcript .ts-line--active { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.audio-transcript .ts-word { cursor: pointer; border-radius: 3px; padding: 0 1px; transition: background .1s ease, color .1s ease; }
.audio-transcript .ts-word:hover { background: var(--surface); }
.audio-transcript .ts-word--spoken { color: var(--text); }
.audio-transcript .ts-word--active { background: var(--accent); color: #fff; }
.video-wrapper audio { display: none; }

/* Video cards: karaoke spoken-text caption — current cue over the bottom of the
   clip with the active word highlighted (replaces the native subtitle track). */
.karaoke-cap {
  position: absolute; left: 0; right: 0; bottom: 26px; z-index: 3;
  padding: 0 10px; text-align: center; pointer-events: none;
  font-size: 12px; line-height: 1.35; font-weight: 600; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.95);
}
.karaoke-cap .kw-active { background: var(--accent); color: #fff; border-radius: 3px; padding: 0 2px; }
.karaoke-cap .kw-spoken { opacity: .65; }
.scene-mark {
  position: absolute; top: -1px; bottom: -1px; width: 2px;
  background: var(--red); opacity: .85; pointer-events: none; border-radius: 1px;
}
/* V2 mode: scenes that matched the query are drawn as a GREEN band
   spanning the scene's full start→end range, so editors see both
   where the hit lands and how long it runs. Sits under the boundary
   ticks (appended first ⇒ painted behind later siblings is not
   guaranteed, so keep it translucent instead). No glow — crisp
   edges read better on the 3px bar. */
.scene-range-matched {
  position: absolute; top: -3px; bottom: -3px;
  background: var(--green);
  opacity: .55;
  border-radius: 2px;
  pointer-events: none;
}

/* V2 mode: per-scene chip below each asset card. The "active" state
   moves with the click so the currently-playing scene is visually
   linked to its chip — the editor scrubs around scenes and always
   knows which one's on screen. */
.v2-scene-chip-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}
.video-duration { font-size: 10px; font-family: 'SF Mono', Menlo, monospace; color: rgba(255,255,255,.6); flex-shrink: 0; }

/* Card text */
.card-meta { padding: 8px 12px 10px; }
.card-title {
  font-size: 12px; font-weight: 500; color: var(--text);
  overflow-wrap: break-word; word-break: break-word;
  margin-bottom: 3px;
}
.card-sub { font-size: 11px; color: var(--text-3); }

/* Matched-fragment snippet — sits between the timing line and the
   action row. Italic + accent-tinted so the eye treats it as a
   QUOTE from the transcript rather than another metadata field.
   line-clamp keeps cards uniform-height even for chatty podcast
   hits with multi-sentence fragments. */
.card-fragment {
  font-size: 11px;
  font-style: italic;
  color: var(--accent-light);
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 30px;
}

/* ── Skeleton loader ─────────────────────────────────────────── */
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.skeleton-card, .skeleton-card * { animation: pulse 1.6s ease-in-out infinite; }
.skeleton-video { aspect-ratio: 1/1; background: var(--surface-2); }
.skeleton-footer { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 5px; }
.skeleton-line { height: 10px; background: var(--surface-2); border-radius: 4px; }
.skeleton-line.short { width: 55%; }
.skeleton-line.tiny  { width: 35%; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .55; }
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1; text-align: center;
  color: var(--text-3); padding: 60px 20px; font-size: 14px;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.modal.open { pointer-events: auto; opacity: 1; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.modal-panel {
  position: relative; background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px; width: 100%; max-width: 820px; max-height: 85vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  transform: translateY(8px); transition: transform .2s;
}
.modal.open .modal-panel { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  gap: 12px; flex-shrink: 0;
}
.modal-title {
  flex: 1; font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal-close-btn {
  background: transparent; border: none; color: var(--text-3);
  display: flex; align-items: center; padding: 5px; border-radius: 5px;
  transition: background .12s, color .12s;
}
.modal-close-btn:hover { background: var(--bg); color: var(--text); }
.modal-body { display: flex; gap: 20px; padding: 18px; overflow-y: auto; flex: 1; }
.modal-media-section { flex-shrink: 0; width: 300px; }
.modal-meta-section  { flex: 1; min-width: 0; }
.meta-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table tr:last-child { border-bottom: none; }
.meta-table td { padding: 7px 0; vertical-align: top; line-height: 1.5; }
.meta-table td:first-child {
  color: var(--text-2); width: 120px; font-weight: 500;
  padding-right: 12px; white-space: nowrap; flex-shrink: 0;
}
.meta-value      { color: var(--text); word-break: break-word; }
.meta-value a    { color: var(--accent-light); text-decoration: none; }
.meta-value a:hover { text-decoration: underline; }
/* Collapsed/expandable JSON & long-string metadata values */
.meta-json > summary {
  cursor: pointer; color: var(--accent-light); font-size: 11px;
  list-style: none; user-select: none;
}
.meta-json > summary::before { content: '▸ '; color: var(--text-3); }
.meta-json[open] > summary::before { content: '▾ '; }
.meta-json > pre {
  margin: 6px 0 0; max-height: 240px; overflow: auto; white-space: pre;
  font-size: 11px; line-height: 1.5; color: var(--text-2);
  font-family: 'SF Mono', Menlo, monospace;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px;
}
.score-pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-weight: 700; font-size: 12px;
}
.score-pill.high { background: rgba(34,197,94,.15);   color: var(--green); }
.score-pill.mid  { background: rgba(245,158,11,.15);   color: var(--amber); }
.score-pill.low  { background: rgba(239,68,68,.15);    color: var(--red); }   /* unreliable */

/* ── Search tabs ─────────────────────────────────────────────── */
.search-tabs {
  display: flex; gap: 4px; flex-shrink: 0;
}
.search-tab {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12px; font-weight: 600;
  padding: 5px 13px;
  transition: color .12s, border-color .12s, background .12s;
}
.search-tab:hover  { color: var(--text); border-color: var(--border-light); }
.search-tab.active {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Drop zone ───────────────────────────────────────────────── */
.drop-zone {
  width: 100%;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-zone.has-file { border-style: solid; border-color: var(--accent); }
.drop-zone-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  color: var(--text-3); font-size: 13px;
  pointer-events: none;
}
.drop-zone-inner svg  { flex-shrink: 0; color: var(--text-3); }
.drop-zone-inner strong { color: var(--text); }
.drop-browse {
  color: var(--accent-light); cursor: pointer; pointer-events: auto;
}
.drop-browse:hover { text-decoration: underline; }

/* ── Asset detail button (card) ──────────────────────────────── */
.asset-detail-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.asset-detail-btn:hover {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* "More like this" — sibling of .asset-detail-btn on hier cards.
   Same shape but a slightly different hover hue so the two buttons
   are visually distinct in the card-actions row. */
.more-like-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.more-like-btn:hover {
  color: #4ade80; border-color: #4ade80;
  background: rgba(74, 222, 128, .08);
}

/* Query-intent pill bar — sits between results-meta and the grid.
   Compact horizontal row of colour-coded weight pills so the user
   can see at a glance which signal channels are dominating ranking
   for the current query. Hidden when no intent classification was
   available (image search, asset seed, empty query). */
.query-intent-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px; margin: 4px 0 8px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-2);
}
.query-intent-bar .intent-label {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text);
  padding-right: 8px;
  border-right: 1px solid var(--border);
  margin-right: 2px;
}
.query-intent-bar .intent-label strong {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--accent-light);
}
.query-intent-bar .intent-confidence {
  font-size: 10px;
  color: var(--text-3);
}
.intent-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.intent-pill strong { color: var(--text); font-weight: 600; }
.intent-pill--vector     { border-color: rgba(99, 102, 241, .5);  color: #a5b4fc; }
.intent-pill--transcript { border-color: rgba(74, 222, 128, .5);  color: #86efac; }
.intent-pill--ocr        { border-color: rgba(0, 255, 102, .5);   color: #4ade80; }
.intent-pill--objects    { border-color: rgba(251, 146, 60, .5);  color: #fdba74; }
.intent-pill--scene      { border-color: rgba(168, 85, 247, .5);  color: #c4b5fd; }
.intent-explain {
  margin-left: 6px;
  font-size: 13px; line-height: 1.4; font-style: italic;
  color: var(--text-2);
  /* No truncation — the classifier's explanation is short by
     construction (≤200 chars) and helps the editor understand why
     the chosen weights make sense. Let it wrap onto a second line
     in the bar if needed. flex-basis 100% pushes it to its own line
     when it would otherwise crowd the pills. 13px, not the pills'
     10px: this is the one line of explanatory text the search page
     keeps (2026-10-07), and it is kept to be read. */
  flex-basis: 100%;
  margin-top: 4px;
}

/* Bad-result thumbs-down — sits next to "More like this".
   Default: subdued grey so it doesn't visually compete with the
   primary actions. Hover red (#f87171) to signal a destructive-
   ish action. Reported state: filled red + the label flips to
   "Reported" so re-render persists the visual after a successful
   POST. */
.bad-result-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.bad-result-btn:hover {
  color: #f87171; border-color: #f87171;
  background: rgba(248, 113, 113, .08);
}
.bad-result-btn.is-reported {
  color: #fca5a5; border-color: #ef4444;
  background: rgba(239, 68, 68, .15);
  cursor: default;
}
.bad-result-btn.is-reported:hover {
  background: rgba(239, 68, 68, .15);
}

/* Thumbs up / down on a result card (the instant feedback loop) — two
   icon-only buttons in the card-actions row, same shape as the other card
   buttons, pushed to the row's right edge. Selected: filled green (good) /
   red (bad); a second click withdraws. A failed post flashes the pair. */
.judge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.judge-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px; min-height: 18px;
  color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.judge-good:hover { color: #4ade80; border-color: #4ade80; background: rgba(74, 222, 128, .08); }
.judge-bad:hover  { color: #f87171; border-color: #f87171; background: rgba(248, 113, 113, .08); }
.judge-good.is-on { color: #86efac; border-color: #22c55e; background: rgba(34, 197, 94, .18); }
.judge-bad.is-on  { color: #fca5a5; border-color: #ef4444; background: rgba(239, 68, 68, .18); }
.judge-good.is-on svg, .judge-bad.is-on svg { fill: currentColor; fill-opacity: .25; }
.judge.judge-error .judge-btn { border-color: #f59e0b; }

/* Suggestion-level thumbs-down — small icon button glued to the
   right edge of an AI chip. Same shape as the card's bad-result
   button but compressed so it doesn't dominate the chip row. */
.suggestion-thumbs-down {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  padding: 0; margin-left: -4px;       /* hug the chip's right edge */
  background: transparent; border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-3); cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.suggestion-thumbs-down:hover {
  color: #f87171; border-color: rgba(248, 113, 113, .35);
  background: rgba(248, 113, 113, .08);
}
.suggestion-thumbs-down.is-reported {
  color: #ef4444; border-color: rgba(239, 68, 68, .6);
  background: rgba(239, 68, 68, .15);
  cursor: default;
}

/* Feedback popover — anchored under the thumbs-down button.
   Dark surface, accent border, rendered at the body level so it
   isn't clipped by the card's overflow:hidden. */
.feedback-popover {
  position: fixed;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 11px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  z-index: 200;
  font-size: 12px;
  color: var(--text);
}
.feedback-pop-title {
  font-weight: 600; font-size: 12px; color: var(--text);
  margin-bottom: 6px;
}
.feedback-pop-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 6px; font-size: 11px; font-family: inherit;
  resize: vertical; min-height: 56px;
}
.feedback-pop-input:focus {
  outline: none; border-color: var(--accent);
}
.feedback-pop-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  margin-top: 8px;
}
.feedback-pop-cancel, .feedback-pop-submit {
  font-size: 11px; padding: 3px 9px; border-radius: 4px;
  cursor: pointer; border: 1px solid var(--border);
  background: transparent; color: var(--text-2);
}
.feedback-pop-submit {
  background: var(--accent); border-color: var(--accent); color: white;
}
.feedback-pop-submit:hover { filter: brightness(1.1); }
.feedback-pop-cancel:hover { color: var(--text); border-color: var(--text-3); }
.feedback-pop-status {
  margin-top: 6px; font-size: 10px; color: var(--text-3);
}

/* ── Group similar display ───────────────────────────────────── */
.group-assets {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 4px;
}
.group-row { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.asset-detail-btn--sm {
  display: inline-flex; align-items: center; gap: 3px;
  height: 22px; padding: 0 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-2); flex-shrink: 0;
  transition: color .12s, border-color .12s;
}
.asset-detail-btn--sm:hover { color: var(--text); border-color: var(--border-light); }
.asset-btn-date { font-size: 9px; font-family: 'SF Mono', Menlo, monospace; white-space: nowrap; }
.group-count {
  font-size: 10px; color: var(--text-3); white-space: nowrap;
}

/* ── Reference banner (asset search) ────────────────────────── */
.reference-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 4px;
}
.reference-thumb {
  width: 56px; height: 32px; flex-shrink: 0;
  border-radius: 4px; overflow: hidden; background: var(--bg);
}
.reference-thumb img { width: 100%; height: auto; display: block; background: #000; }
.reference-thumb-placeholder { width: 100%; height: 100%; background: var(--surface); }
.reference-info {
  display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
}
.reference-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent-light);
}
.reference-id {
  font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'SF Mono', Menlo, monospace;
}
.reference-meta-sep { height: 8px; }

/* ── Asset detail modal layout ───────────────────────────────── */
.asset-detail-body {
  display: flex; gap: 20px; width: 100%;
}
.asset-detail-media {
  flex-shrink: 0; width: 300px; display: flex; flex-direction: column; gap: 14px;
}
.asset-detail-meta { flex: 1; min-width: 0; }

/* Scenes timeline */
.scenes-timeline { display: flex; flex-direction: column; gap: 8px; }
.scenes-timeline-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-2);
}
.scenes-chips { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.scene-chip {
  display: block; width: 100%; text-align: left;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 8px;
  font-size: 11px; font-family: 'SF Mono', Menlo, monospace; color: var(--text-2);
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.scene-chip:hover {
  color: var(--accent-light); border-color: var(--accent); background: var(--accent-dim);
}

@media (max-width: 640px) {
  .asset-detail-body { flex-direction: column; }
  .asset-detail-media { width: 100%; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) { .results-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 780px) {
  .results-layout  { flex-direction: column; }
  .filters-sidebar { width: 100%; position: static; display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; }
  .filters-header  { width: 100%; margin-bottom: 0; }
  .filter-group    { margin-bottom: 0; min-width: 140px; flex: 1; }
  .toggles-group   { flex-direction: row; flex-wrap: wrap; gap: 12px; }
}

@media (max-width: 640px) {
  .results-grid     { grid-template-columns: 1fr; }
  .modal-body       { flex-direction: column; }
  .modal-media-section { width: 100%; }
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0 20px;
  font-size: 10px;
  color: var(--text-3);
  display: flex;
  gap: 6px;
  align-items: center;
  letter-spacing: .02em;
  z-index: 5;
}
/* prevent content from hiding behind fixed footer */
.app { padding-bottom: 30px; }

/* ── Backend selector ──────────────────────────────────────────── */
.backend-selector {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px; flex-shrink: 0;
}
.backend-btn {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 4px; border: none; cursor: pointer;
  background: none; color: var(--text-3);
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.backend-btn:hover  { color: var(--text); }
.backend-btn.active { background: var(--accent); color: #fff; }

/* ── Mixpeek mode overrides ────────────────────────────────────── */
/* Mixpeek is flat-only — there's no Mixpeek equivalent of the v2 or
   hierarchical engines, so hide the entire Mode toggle. JS also forces
   _searchMode='flat' in Mixpeek (see onBackendChange + init), so the
   search always routes to /v1/mixpeek/search. */
body.mixpeek-mode .results-mode-buttons { display: none !important; }
body.mixpeek-mode .ctree-actions  { display: none !important; }
body.mixpeek-mode #new-coll-btn   { display: none !important; }
body.mixpeek-mode #new-coll-form  { display: none !important; }

/* ── Iconik collection tree (filter sidebar) ───────────────────── */
.anc-search {
  width: 100%; box-sizing: border-box; margin-bottom: 6px;
  padding: 5px 8px; font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.anc-search:focus { outline: none; border-color: var(--accent); }
.anc-search::placeholder { color: var(--text-3); }
.anc-tree {
  max-height: 280px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 4px;
  font-size: 12px;
}
.anc-empty { color: var(--text-3); padding: 4px 8px; }
/* Parent path shown next to a match in search-filtered mode (disambiguates
   duplicate folder names like "CLIP" / "A001"). */
.anc-path {
  font-size: 10px; color: var(--text-3); flex-shrink: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 45%; padding-left: 4px; opacity: .8;
}
.anc-row {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 2px; cursor: pointer; user-select: none;
  border-radius: 3px;
}
.anc-row:hover { background: var(--surface-2); }
.anc-toggle {
  width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 9px; transition: transform .12s; flex-shrink: 0;
}
.anc-toggle.empty { visibility: hidden; }
.anc-toggle.open { transform: rotate(90deg); }
.anc-row input[type=checkbox] {
  margin: 0; accent-color: var(--accent); flex-shrink: 0;
}
.anc-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2);
}
.anc-row.checked > .anc-label { color: var(--text); font-weight: 600; }
.anc-count {
  font-family: 'SF Mono', Menlo, monospace; font-size: 10px;
  color: var(--text-3); flex-shrink: 0; padding-left: 4px;
}
.anc-children { display: none; }
.anc-children.open { display: block; }

/* ── Collection tray (fixed to RIGHT edge, full viewport height) ── */
.collection-tray {
  position: fixed;
  right: 0; top: 52px; bottom: 0;
  width: var(--tray-right-w);
  background: var(--surface);
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 5;
  transition: width .18s ease;
}
/* Right tray contents switch per backend. The collection-tray (drag-and-drop
   user collections) is Supabase-only; in Mixpeek mode it's replaced by the
   mp-api-tray which logs every /v1/mixpeek/* request. */
body.mixpeek-mode .collection-tray:not(.mp-api-tray) { display: none !important; }
.mp-api-tray { display: none; }
body.mixpeek-mode .mp-api-tray       { display: flex; }

/* API log entries */
.mp-api-entry {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 6px; font-size: 11px;
  background: var(--bg); cursor: pointer; transition: background .12s;
}
.mp-api-entry:hover { background: var(--surface, var(--bg)); }
.mp-api-entry .mp-head { display: flex; gap: 6px; align-items: center;
  font-family: 'SF Mono', Menlo, monospace; }
.mp-api-entry .mp-method { font-weight: 700; color: #818cf8; min-width: 30px; }
.mp-api-entry .mp-path   { color: var(--text-2); flex: 1; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.mp-api-entry .mp-status { font-weight: 600; padding: 1px 6px; border-radius: 8px; font-size: 10px; }
.mp-api-entry .mp-status.ok  { background: rgba(34,197,94,.15); color: #22c55e; }
.mp-api-entry .mp-status.err { background: rgba(239,68,68,.15); color: #ef4444; }
.mp-api-entry .mp-time   { color: var(--text-3); font-size: 10px; }
.mp-api-entry .mp-detail { display: none; margin-top: 6px; }
.mp-api-entry.open .mp-detail { display: block; }
.mp-api-entry .mp-detail h6 { margin: 6px 0 2px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; }
.mp-api-entry .mp-detail pre { margin: 0; padding: 6px 8px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: 'SF Mono', Menlo, monospace; font-size: 10.5px; line-height: 1.4;
  color: var(--text-2); white-space: pre-wrap; word-break: break-all;
  max-height: 280px; overflow: auto; }

.ctray-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-2);
}
.ctray-refresh-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-3); border-radius: 4px;
  padding: 1px 6px; cursor: pointer;
  font-size: 12px; line-height: 1.1;
  transition: color .12s, border-color .12s;
}
.ctray-refresh-btn:hover { color: var(--text); border-color: var(--accent); }

.ctray-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px 4px;
  font-size: 12px;
}
.ctray-empty {
  color: var(--text-3); padding: 10px 12px;
  font-style: italic;
}
/* Tree node row */
.ctree-row {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 6px 3px 2px;
  border-radius: 3px;
  cursor: pointer; user-select: none;
  position: relative;
  color: var(--text-2);
}
.ctree-row:hover { background: var(--surface-2); color: var(--text); }
.ctree-row.dragover {
  background: var(--accent-dim);
  outline: 1px dashed var(--accent);
}
.ctree-row.drop-success {
  background: var(--green) !important;
  color: #fff !important;
  transition: background .35s, color .35s;
}
.ctree-toggle {
  width: 14px; height: 14px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--text-3); font-size: 9px;
  transition: transform .12s; flex-shrink: 0;
}
.ctree-toggle.empty { visibility: hidden; }
.ctree-toggle.open  { transform: rotate(90deg); }
.ctree-icon {
  flex-shrink: 0; width: 14px; font-size: 12px;
  text-align: center; color: var(--text-3);
}
.ctree-row.is-system .ctree-icon { color: var(--accent-light); }
.ctree-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctree-count {
  font-family: 'SF Mono', Menlo, monospace; font-size: 10px;
  color: var(--text-3); flex-shrink: 0; padding: 0 4px;
}
.ctree-actions {
  display: none; flex-shrink: 0; gap: 2px;
}
.ctree-row:hover .ctree-actions { display: inline-flex; }
.ctree-action-btn {
  background: transparent; border: none; color: var(--text-3);
  font-size: 12px; line-height: 1;
  padding: 1px 4px; border-radius: 3px; cursor: pointer;
  transition: color .12s, background .12s;
}
.ctree-action-btn:hover { color: var(--text); background: var(--bg); }
.ctree-action-btn.danger:hover { color: var(--red); }
.ctree-children { display: none; }
.ctree-children.open { display: block; }

/* Cards become draggable; show a grab cursor */
.video-card[draggable="true"] { cursor: grab; }
.video-card[draggable="true"]:active { cursor: grabbing; }

/* Collection items modal */
.coll-items-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; padding: 8px 0;
}
.coll-item-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; position: relative;
}
.coll-item-thumb {
  width: 100%; aspect-ratio: 1/1; background: #000;
  display: block; object-fit: contain;
}
.coll-item-thumb-placeholder {
  width: 100%; aspect-ratio: 1/1; background: var(--surface);
}
.coll-item-title {
  font-size: 11px; padding: 6px 8px;
  color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coll-item-remove {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.65); color: #fff; border: none;
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.coll-item-remove:hover { background: var(--red); }

.coll-item-badge {
  position: absolute; left: 4px; top: 4px;
  background: rgba(99,102,241,.85); color: #fff;
  padding: 1px 6px; border-radius: 3px; font-size: 10px;
  font-weight: 600; letter-spacing: .02em;
}
.coll-item-download {
  position: absolute; bottom: 4px; right: 4px;
  background: rgba(99,102,241,.85); color: #fff; border: none;
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.coll-item-download:hover { background: var(--accent); }
.coll-item-download:disabled { opacity: .5; cursor: wait; }

/* ── Collapsible trays (filters left, collections right) ───────── */
/* Default open width; collapse via .tray-collapsed → 32px rail with expand button */
/* Collapsed state — width is driven by body CSS vars (--tray-rail-w 32px).
   Everything inside is hidden except the toggle button. */
.filters-sidebar.tray-collapsed { padding: 8px 0 !important; overflow: visible; }
.filters-sidebar.tray-collapsed > *:not(.tray-toggle) { display: none !important; }
.collection-tray.tray-collapsed   { overflow: visible; }
.collection-tray.tray-collapsed > *:not(.tray-toggle) { display: none !important; }

/* The toggle button — a small circular control on the inner edge */
.tray-toggle {
  position: absolute; top: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-light);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 5;
  transition: background .12s, color .12s, transform .12s;
  font-size: 11px; line-height: 1;
}
.tray-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Toggle sits at the inner edge — half outside the tray for easy reach */
.filters-sidebar .tray-toggle  { right: -11px; }
.collection-tray .tray-toggle  { left:  -11px; }
/* When collapsed, the toggle is still visible at the rail's inner edge */
.filters-sidebar.tray-collapsed .tray-toggle { right: 5px; left: auto;  top: 14px; transform: rotate(180deg); display: flex !important; }
.collection-tray.tray-collapsed .tray-toggle { left:  5px; right: auto; top: 14px; transform: rotate(180deg); display: flex !important; }

/* Search header — keeps the hint and the refining-breadcrumb on the
   same line so they share a single horizontal strip. The breadcrumb
   slot is empty until _renderFlatDiscoveryBar / _renderHierDiscoveryBar
   populate it; when empty it collapses to zero width so the hint
   stays left-aligned. */
.search-aux {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 4px 14px 0;
}
.search-aux .input-hint { margin: 0; }
.breadcrumb-slot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  /* Push the breadcrumb away from the keyboard hint so 'Press ⌘ Enter'
     and 'Refining:' don't read as one crowded line. */
  margin-left: 24px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.breadcrumb-slot:empty { display: none; }

/* AI chip row + Related row. Sits on its own line just below the
   search-aux so the breadcrumb stays close to the textbox while the
   chips have room to wrap. */
.suggestions-slot {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 14px 4px;
}
.suggestions-slot:empty { display: none; }

/* Results toolbar — sits directly above the results-grid. Hosts the
   Mode toggle on the left, the result-count + timing text in the
   middle (flex:1), and the top pagination bar on the right. Saves
   the vertical space the old standalone Mode row used. */
.results-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.results-mode-buttons {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.results-mode-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
}
.results-mode-buttons .search-tab { font-size: 11px; padding: 3px 12px; }
/* ✨ Gen impersonation dropdown (admin): sits right of the Gen pill */
.gen-user-sel {
  font-size: 11px; max-width: 220px; padding: 3px 6px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 6px;
}
.gen-user-sel:focus { outline: none; border-color: var(--accent); }
/* ✨ Gen tokenized-query bar — the query string, word by word, each word
   tagged with its identified kind — shown ABOVE the results grid. */
.gen-tokens-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin: 2px 0 8px; font-size: 12px; color: var(--text-3);
}
.gen-tokens-bar .qtok {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-family: 'SF Mono', Menlo, monospace;
}
.gen-tokens-bar .qtok i {
  font-style: normal; font-size: 9px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-3);
}
.gen-tokens-bar .qtok-plain { border-style: dashed; opacity: .65; }
.gen-tokens-bar .qtok-objects  { border-color: var(--accent); }
.gen-tokens-bar .qtok-objects i  { color: var(--accent-light); }
.gen-tokens-bar .qtok-actions  { border-color: #34d399; }
.gen-tokens-bar .qtok-actions i  { color: #34d399; }
.gen-tokens-bar .qtok-subjects { border-color: #fbbf24; }
.gen-tokens-bar .qtok-subjects i { color: #fbbf24; }
.gen-tokens-bar .qtok-setting  { border-color: #38bdf8; }
.gen-tokens-bar .qtok-setting i  { color: #38bdf8; }
.results-toolbar .results-meta { flex: 1; margin: 0; padding: 0; }
.results-pagination-slot { display: flex; align-items: center; gap: 10px; }
.results-pagination-slot:empty { display: none; }

/* Media-type pills — multi-select chip row that replaced the old
   single <select>. Nothing checked == no filter (all types). */
.media-type-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.media-pill {
  display: inline-flex; align-items: center; gap: 0;
  font-size: 12px; line-height: 1; cursor: pointer; user-select: none;
}
.media-pill input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.media-pill span {
  display: inline-block; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); color: var(--text-3);
  transition: background .12s, color .12s, border-color .12s;
}
.media-pill:hover span {
  color: var(--text-2);
  border-color: var(--border-light);
}
.media-pill input[type="checkbox"]:checked + span {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* WebVTT cue text on the scene-preview <video> elements. Browser default
   font-size is ~22-25px which overwhelms the small card thumbnails —
   halve it to roughly track the card scale. Only the size is overridden;
   color / outline / background stay at the browser default so cues
   remain legible across whatever scene is playing behind them. */
video::cue {
  font-size: 50%;
}

/* ── "More from this production" ──────────────────────────────── */
/* Card button — mirrors .more-like-btn, indigo accent to distinguish. */
.more-prod-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.more-prod-btn:hover {
  color: #818cf8; border-color: #818cf8;
  background: rgba(129, 140, 248, .08);
}
/* Bidirectional footage<->ad lookup buttons — same shape as the other
   card-action buttons, each its own hover hue so the row stays scannable.
   "Ads using this" (raw footage -> ads): amber. "Footage used" (ad -> footage): cyan. */
.ads-using-btn, .footage-used-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 7px;
  font-size: 10px; font-weight: 500; color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
  cursor: pointer;
}
.ads-using-btn:hover {
  color: #fbbf24; border-color: #fbbf24;
  background: rgba(251, 191, 36, .08);
}
.footage-used-btn:hover {
  color: #22d3ee; border-color: #22d3ee;
  background: rgba(34, 211, 238, .08);
}
/* Scene-position badge on "Footage used" cards — which ad scene this footage
   sources (opener = scene 0), with the embedding match confidence. */
.scene-badge {
  display: inline-block; margin-top: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px;
}
.scene-badge.is-opener {
  color: #fbbf24; border-color: rgba(251, 191, 36, .5);
  background: rgba(251, 191, 36, .10);
}
/* Ads-analytics perf badges on cards — $ spend (green) + thumb-stop % (cyan). */
.perf-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.perf-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  border-radius: 4px; padding: 1px 6px; border: 1px solid var(--border);
}
.perf-badge.spend { color: #4ade80; border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .10); }
.perf-badge.thumb { color: #22d3ee; border-color: rgba(34, 211, 238, .45); background: rgba(34, 211, 238, .10); }
/* 📝 script — link to the ad's strategy brief (Google Doc). */
.perf-badge.brief { color: #fbbf24; border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .10); text-decoration: none; }
.perf-badge.brief:hover { background: rgba(251, 191, 36, .22); }
/* Wide modal panel so the result grid breathes. */
.modal-panel-wide { max-width: min(1120px, 94vw); }
/* Header facts row. */
.production-sub {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 18px 0; font-size: 12px; color: var(--text-3);
}
.production-sub .prod-fact {
  background: var(--surface-2, rgba(255,255,255,.04));
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
}
.production-sub .prod-fact b { color: var(--text); font-weight: 600; }
#production-grid { padding: 14px 18px; overflow-y: auto; }
/* Pager. */
.production-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 18px 16px; flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.prod-page-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-2); cursor: pointer; transition: all .12s;
}
.prod-page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-3); }
.prod-page-btn:disabled { opacity: .4; cursor: not-allowed; }
.prod-page-info { font-size: 12px; color: var(--text-3); }

/* "← Back" in the footage↔ads lookup header — restores the previous view. */
.back-link {
  color: var(--accent-light); font-weight: 600; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.back-link:hover { text-decoration: underline; }

/* Vocabulary-grounding note on the intent pill row — objects channel was
   downweighted because the query's terms aren't in the filtered footage. */
.intent-grounding {
  font-size: 11px; color: #fbbf24; border: 1px solid #4a3f1d;
  background: #2a2410; border-radius: 10px; padding: 2px 8px;
  white-space: nowrap;
}

/* Top Openers: the top-grossing ad this clip opened (under the perf badges). */
.winning-ad-title {
  font-size: 10.5px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* ── "Did you mean…?" disambiguation dialog (index.html #dym-modal) ── */
.dym-dialog { max-width: 460px; }
.dym-sub { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.dym-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
           padding: 10px 14px; margin-bottom: 8px; border-radius: 9px; cursor: pointer;
           border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
           font-size: 14px; font-weight: 600; }
.dym-opt:hover { border-color: var(--accent); background: rgba(99,102,241,.10); }
.dym-opt .dym-kind { font-size: 10px; font-weight: 700; text-transform: uppercase;
                     letter-spacing: .06em; color: var(--accent-light);
                     border: 1px solid var(--accent); border-radius: 5px;
                     padding: 2px 7px; flex: none; }
.dym-as-typed { display: block; width: 100%; margin-top: 4px; padding: 9px 14px;
                border-radius: 9px; border: 1px dashed var(--border); background: transparent;
                color: var(--text-3); font-size: 13px; cursor: pointer; }
.dym-as-typed:hover { color: var(--text); border-color: var(--text-3); }

/* ── Contextual autocomplete (GET /v1/suggest) ─────────────────────── */
.suggest-box { position: absolute; top: calc(100% + 4px); left: 0; right: 0;
               z-index: 60; background: var(--surface); border: 1px solid var(--border);
               border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.45);
               max-height: 320px; overflow-y: auto; padding: 4px; }
.suggest-item { display: flex; align-items: center; gap: 8px; width: 100%;
                padding: 7px 10px; border: 0; border-radius: 7px; background: transparent;
                color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.suggest-item:hover, .suggest-item.active { background: var(--surface-2); }
.suggest-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis;
                 white-space: nowrap; }
.suggest-label b { color: var(--accent-light); font-weight: 600; }
.suggest-kind { flex: none; font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
                color: var(--text-3); border: 1px solid var(--border); border-radius: 999px;
                padding: 1px 7px; }
.suggest-detail { flex: none; font-size: 11px; color: var(--text-3); }

/* ── Generative mode: prompt expander under the search bar ─────────── */
#search-mode-hint .gen-prompt { display: inline-block; margin-left: 8px; }
#search-mode-hint .gen-prompt summary { cursor: pointer; color: var(--accent-light);
  display: inline; font-size: 11px; }
#search-mode-hint .gen-prompt pre { margin: 6px 0 2px; padding: 10px 12px;
  max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 11px;
  line-height: 1.5; color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: 'SF Mono', Menlo, monospace; }

/* ── Client row — top-level client selection above the search bar ──── */
.client-row { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.client-row-label { font-size: 12px; color: var(--text-3); letter-spacing: .03em;
  text-transform: uppercase; }
.client-row .filter-select { min-width: 240px; }

/* ── Compare-pane: this page embedded as one pane of /compare.html ── */
.compare-pane .header,
.compare-pane .client-row,
.compare-pane .search-row,
.compare-pane .filters-sidebar,
.compare-pane .tray-resizer,
.compare-pane .results-mode-buttons,
.compare-pane .collection-tray,
.compare-pane .tray-toggle,
.compare-pane footer.footer,
.compare-pane .suggestions-slot { display: none !important; }
.compare-pane .main { padding: 4px 8px; max-width: none; }
.compare-pane .results-grid { grid-template-columns: repeat(3, 1fr) !important; }
/* No empty chrome strips in panes: the toolbar keeps its meta line (result
   counts, token note, ✨ searched-as) but loses the bordered-bar look, and
   the results section loses its structural padding. */
.compare-pane .results-toolbar { border: none !important; background: transparent !important;
  padding: 2px 4px !important; margin-bottom: 2px !important; min-height: 0 !important; }
.compare-pane .results-section { padding: 0 4px !important; border: none !important; }

/* ── Agentic search UI (static/agentic_pane.js): Compare pane + Dig deeper ── */
/* Status strip above the grid: status · scanned · matches · verified · rounds · calls · spend · elapsed · stop,
   then one line of per-round counts (R1 60 scanned · 3 matches …). */
.ag-strip { margin: 2px 4px 8px; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); font-size: 12px; color: var(--text-2); }
.ag-strip-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ag-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.ag-dot-live { background: var(--accent-light); animation: ag-pulse 1.2s ease-in-out infinite; }
@keyframes ag-pulse { 50% { opacity: .25; } }
.ag-status { font-weight: 700; color: var(--text); }
.ag-st-done { color: var(--green); }
.ag-st-stopped, .ag-st-needs_clarification { color: var(--amber); }
.ag-st-failed { color: var(--red); }
.ag-nums { font-family: 'SF Mono', Menlo, monospace; font-size: 11px; }
.ag-part { color: var(--text-3); }
/* Run stats (Scanned N assets · M matches · K verified), separators, a Compare
   pane's "Dig even deeper" (.ag-continue; the main page's is the Dig deeper button). */
.ag-stat { color: var(--text-2); }
.ag-sep { color: var(--text-3); }
.ag-limit { color: var(--amber); }
.ag-continue { font: inherit; font-size: 11px; font-weight: 600; color: var(--accent-light);
  background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 14px;
  padding: 2px 11px; cursor: pointer; white-space: nowrap; margin-left: 4px; }
.ag-continue:hover:not(:disabled) { background: var(--accent); color: #fff; }
.ag-continue:disabled { opacity: .5; cursor: default; }
/* A Compare pane's "Stop scanning" while its run scans (inverted, as on the main page). */
button.ag-stop { font: inherit; font-size: 11px; font-weight: 600; color: #fff;
  background: var(--accent); border: 1px solid var(--accent); border-radius: 14px;
  padding: 2px 11px; cursor: pointer; white-space: nowrap; margin-left: 4px; }
button.ag-stop:hover:not(:disabled) { background: var(--accent-dim); color: var(--accent-light); }
button.ag-stop:disabled { opacity: .5; cursor: default; }
.ag-exhausted { color: var(--text-2); }
/* The stop (time / spend limit) and a poll that keeps failing. */
.ag-stop { color: var(--text-2); }
.ag-lost { color: var(--amber); }
/* Per-round readout: one compact line under the status line. */
.ag-rounds { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 2px; margin-top: 4px;
  padding-left: 13px; font-family: 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--text-3); }
.ag-round { white-space: nowrap; }
.ag-round-hit { color: var(--text-2); }
.ag-need { margin-top: 5px; color: var(--text-3); line-height: 1.6; }
.ag-need-lbl { color: var(--text-2); font-weight: 600; }
.ag-must, .ag-nice { display: inline-block; font-size: 10px; border-radius: 10px; padding: 0 7px;
  border: 1px solid var(--border); white-space: nowrap; }
.ag-must { color: var(--text); border-color: var(--border-light); }
.ag-nice { color: var(--text-3); border-style: dashed; }
/* Clarifying questions (needs_clarification) — option buttons. */
.ag-questions { margin: 0 4px 10px; padding: 9px 10px; border: 1px solid var(--amber);
  border-radius: var(--radius); background: color-mix(in srgb, var(--amber) 7%, transparent); }
.ag-q + .ag-q { margin-top: 8px; }
.ag-q-text { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.ag-q-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ag-q-opt { font: inherit; font-size: 12px; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: 14px; padding: 3px 12px; cursor: pointer; }
.ag-q-opt:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.ag-q-opt:disabled { cursor: default; opacity: .55; }
.ag-q-opt.ag-q-chosen { opacity: 1; border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.ag-q-note { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.ag-q-note:empty { display: none; }
/* Per-card verdict: score chip, rank movement, one-line reason (click = expand). */
.ag-verdict { display: flex; align-items: baseline; gap: 6px; padding: 6px 10px 0;
  font-size: 11px; color: var(--text-3); cursor: pointer; min-width: 0; }
.ag-chip { flex-shrink: 0; font-weight: 800; font-size: 11px; border-radius: 10px; padding: 1px 7px;
  font-family: 'SF Mono', Menlo, monospace; border: 1px solid transparent; }
.ag-chip.ag-hi  { color: var(--green); background: rgba(34,197,94,.13);  border-color: rgba(34,197,94,.35); }
.ag-chip.ag-mid { color: var(--amber); background: rgba(245,158,11,.13); border-color: rgba(245,158,11,.35); }
.ag-chip.ag-lo  { color: var(--red);   background: rgba(239,68,68,.13);  border-color: rgba(239,68,68,.35); }
.ag-chip.ag-na  { color: var(--text-3); background: var(--surface-2); border-color: var(--border); font-weight: 600; }
.ag-move { flex-shrink: 0; font-family: 'SF Mono', Menlo, monospace; font-size: 10px; }
.ag-reason { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ag-verdict.ag-open .ag-reason { white-space: normal; }
.ag-missing { color: var(--amber); }
/* Expanded verdict of a frame-checked card: how its score was built. */
.ag-explain { display: none; padding: 4px 10px 0 12px; font-size: 11px;
  color: var(--text-2); line-height: 1.45; cursor: default; }
.ag-verdict.ag-open + .ag-explain { display: block; }
.ag-x-score { font-family: 'SF Mono', Menlo, monospace; font-size: 10px; color: var(--text-3); }
.ag-x-missing { color: var(--amber); }
/* the frame check's per-must-have lines: ✓ seen, ✗ contradicted, ? unclear */
.ag-x-check { color: var(--text-2); padding-left: 6px; }
.ag-x-check-yes { color: var(--green); }
.ag-x-check-no { color: var(--red); }
.ag-x-check-unclear { color: var(--amber); }
.empty-state.ag-off { color: var(--text-3); font-size: 13px; }
.ag-q-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.ag-q-foot .ag-q-note { margin-top: 0; }
.ag-q-skip { font: inherit; font-size: 11px; color: var(--text-3); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: underline; }
.ag-q-skip:hover:not(:disabled) { color: var(--text); }
.ag-q-skip:disabled { cursor: default; opacity: .55; }
/* The intent review (awaiting_confirmation): editable need + Start / Cancel. */
.ag-confirm { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ag-c-head { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.ag-c-restated { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 8px; padding: 5px 9px; }
.ag-c-list { margin-top: 8px; }
.ag-c-label { font-size: 11px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.ag-c-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 18px; }
.ag-c-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: 14px; padding: 2px 6px 2px 10px; }
.ag-c-list[data-k="avoid"] .ag-c-chip { border-color: color-mix(in srgb, var(--red) 55%, var(--border-light)); }
.ag-c-del { font: inherit; font-size: 13px; line-height: 1; color: var(--text-3); background: none; border: none;
  padding: 0 2px; cursor: pointer; }
.ag-c-del:hover:not(:disabled) { color: var(--red); }
.ag-c-add { display: flex; gap: 6px; margin-top: 5px; }
.ag-c-input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 12px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 8px; }
.ag-c-addbtn { font: inherit; font-size: 11px; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-light); border-radius: 8px; padding: 3px 10px; cursor: pointer; }
.ag-c-addbtn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.ag-c-start { font: inherit; font-size: 12px; font-weight: 600; color: #fff; background: var(--accent);
  border: 1px solid var(--accent); border-radius: 14px; padding: 4px 14px; cursor: pointer; }
.ag-c-start:hover:not(:disabled) { background: var(--accent-dim); color: var(--accent-light); }
.ag-c-start:disabled, .ag-c-cancel:disabled { opacity: .5; cursor: default; }
.ag-c-cancel, button.ag-cancel { font: inherit; font-size: 11px; color: var(--text-3); background: none;
  border: 1px solid var(--border); border-radius: 14px; padding: 2px 11px; cursor: pointer; white-space: nowrap; }
.ag-c-cancel:hover:not(:disabled), button.ag-cancel:hover:not(:disabled) { color: var(--red); border-color: var(--red); }
button.ag-cancel { margin-left: 4px; }
.ag-st-awaiting_confirmation, .ag-st-cancelling { color: var(--amber); }

/* ── Main page: "Dig deeper" (static/agentic_pane.js, host 'dig') ──── */
/* The button sits right after the result count; the pager stays right. */
.results-meta-row { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.results-toolbar .results-meta-row .results-meta { flex: 0 1 auto; }
.dig-btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 11px;
  font-weight: 600; color: var(--accent-light); background: var(--accent-dim);
  border: 1px solid var(--accent); border-radius: 16px; padding: 4px 13px 4px 10px; cursor: pointer;
  white-space: nowrap; }  /* 22px icon ⇒ ~32px tall, a little taller than the pills by design */
.dig-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.dig-btn:disabled { opacity: .5; cursor: default; }
.dig-btn[hidden] { display: none; }
.dig-icon { flex-shrink: 0; }
/* "It's deep enough" / "Stopping…": the same button while its run scans — Dig
   deeper's hover colours, inverted. "Dig even deeper" keeps Dig deeper's own. */
.dig-btn.dig-btn--stop { background: var(--accent); color: #fff; }
.dig-btn.dig-btn--stop:hover:not(:disabled) { background: var(--accent-dim); color: var(--accent-light); }
/* Strip extras: "← Back to results" at the right end, a refused run's notice. */
.ag-strip .ag-back { margin-left: auto; font-size: 12px; }
.ag-notice { color: var(--text-2); }

/* ── Compare-bar: the search page embedded as compare.html's control bar ── */
.compare-bar .header,
.compare-bar .filters-sidebar,
.compare-bar .tray-resizer,
.compare-bar .results-section,
.compare-bar .suggestions-slot,
.compare-bar .collection-tray,
.compare-bar .tray-toggle,
.compare-bar footer.footer,
.compare-bar #search-mode-hint { display: none !important; }
.compare-bar .main { padding: 8px 12px 0; max-width: none; }
.compare-bar body, .compare-bar { overflow: hidden; }

/* Shoot-time (created) date-range inputs in the Filters dialog */
.created-range-row { display: flex; align-items: center; gap: 8px; }
.created-range-row input[type="date"] {
  flex: 1; padding: 6px 8px; font-size: 12px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 6px;
  color-scheme: dark;
}
.created-range-row input[type="date"]:focus { outline: none; border-color: var(--accent); }
.created-range-sep { color: var(--text-3); }


/* ── Client Collection cards (migration 056) ─────────────────────────────
   A collection is many clips, so its preview is a DECK — the first few members
   stacked and fanned. That reads as "a folder of footage" at a glance, where a
   single frame would read as one clip (and where the old path read as
   "Preview unavailable", because a collection has no proxy of its own). */
.card--collection { border: 1px solid var(--accent, #6366f1); }
.coll-deck-wrap {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--surface-2, #1c2030);
  display: flex; align-items: center; justify-content: center;
}
.coll-deck { position: relative; width: 74%; height: 74%; }
/* Every card shares one stacking origin; the transforms below fan them out.
   Later cards sit ON TOP (z-index rises with the index), so slot 0 is the
   back of the deck and the last slot is the face. */
.coll-deck .deck-card {
  position: absolute; inset: 0; border-radius: 5px; overflow: hidden;
  background: var(--surface, #161922);
  border: 1px solid var(--border, #252a3a);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease;
}
.coll-deck .deck-card--0 { transform: translate(-11%, -9%) rotate(-6deg); z-index: 1; }
.coll-deck .deck-card--1 { transform: translate(-4%, -3%) rotate(-2.5deg); z-index: 2; }
.coll-deck .deck-card--2 { transform: translate(4%,  3%) rotate(2.5deg);  z-index: 3; }
.coll-deck .deck-card--3 { transform: translate(11%,  9%) rotate(6deg);   z-index: 4; }
/* Hover spreads the deck — a cheap, obvious signal that it holds several
   things, and the only motion on the card (there is no video to play). */
.card--collection:hover .coll-deck .deck-card--0 { transform: translate(-17%, -13%) rotate(-9deg); }
.card--collection:hover .coll-deck .deck-card--1 { transform: translate(-6%,  -5%) rotate(-3.5deg); }
.card--collection:hover .coll-deck .deck-card--2 { transform: translate(6%,   5%) rotate(3.5deg); }
.card--collection:hover .coll-deck .deck-card--3 { transform: translate(17%,  13%) rotate(9deg); }
.coll-deck .deck-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The video shares .deck-img's geometry so swapping the still for the clip
   cannot change the deck's shape mid-hover. */
.coll-deck .deck-video { background: #000; }
.coll-deck .deck-fallback { font-size: 20px; opacity: .45; }
.coll-deck-count {
  position: absolute; right: 8px; bottom: 8px; z-index: 9;
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  background: rgba(0, 0, 0, .68); color: #f1f5f9; white-space: nowrap;
}
.coll-card-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  color: var(--accent-light, #818cf8);
  border: 1px solid var(--accent, #6366f1);
  border-radius: 3px; padding: 1px 5px;
}
.view-coll-btn {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 11px; padding: 4px 9px; border-radius: 5px;
  color: var(--accent-light, #818cf8); background: transparent;
  border: 1px solid var(--accent, #6366f1);
}
.view-coll-btn:hover { background: rgba(99, 102, 241, .18); }
