/*
 * v2 DetectionCandidate registry (B8 phase 2).
 *
 * Replaces the legacy candidate-grid contents with a unified list
 * of swarm-shared candidates. Per-candidate expansion reveals its
 * sightings with self / remote markers.
 */

.candidate-registry-view {
  font-family: monospace;
  font-size: 12px;
  color: #d8e7d9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Fill the candidate-panel slot rather than leak past the
   * panel-header. Operator-resizable splits depend on this
   * chain to actually re-flow the inner list when the panel
   * shrinks. */
  flex: 1 1 0;
  min-height: 0;
  /* Vertical padding stays for visual breathing room from the
   * panel-header border; horizontal padding goes to zero so the
   * cards span the panel's full inner width. */
  padding: 6px 0;
  /* In theory the parent flex column's default `align-items:
   * stretch` would already pin width. In practice, removing
   * these explicit declarations regressed the layout the
   * operator was testing — keep them as defensive overrides
   * against whatever the actual interaction is. */
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
}

/* Only the list scrolls — the header stays pinned so the
 * EtiCandidate / Suspicious tallies are always visible. */
.candidate-registry-view .cr-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.candidate-registry-view .cr-header {
  flex: 0 0 auto;
}

.cr-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1a261a;
}

.cr-promoted {
  color: #ffe069;
}
.cr-suspicious {
  color: #8fa193;
}

/* In-card detail block (consolidated EVENT DETAIL).
 * Lives below the sightings list, only meaningful when an
 * Observation has been fetched for one of the sightings. */
.cr-card-detail {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #1a261a;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cr-detail-hint {
  color: #6fe3a3;
  opacity: 0.45;
  font-style: italic;
  font-size: 11px;
}
.cr-detail-row {
  display: flex;
  gap: 8px;
  font-size: 11px;
}
.cr-detail-label {
  color: #7f8b99;
  flex: 0 0 70px;
}
.cr-detail-value {
  color: #d8e7d9;
  flex: 1;
}

.cr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cr-card {
  background: #0a0a10;
  border: 1px solid #1a261a;
  border-radius: 4px;
  padding: 6px 8px;
  /* The card itself isn't clickable as a whole — only the head
     toggles. cursor: default here, head overrides to pointer. */
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* `align-self: stretch` pins the cross-axis size to the parent
     (= full list width) so a collapsed card occupies the same
     horizontal footprint as an expanded one. Removing it
     regressed the layout in operator testing. box-sizing keeps
     padding inside; min-width:0 lets the body's wide-content
     children (the waterfall PNG) shrink instead of pushing the
     card wider. */
  align-self: stretch;
  box-sizing: border-box;
  min-width: 0;
}

.cr-card:hover {
  background: #0d141a;
}

.cr-card--eti {
  border-color: #6b5a1c;
}

.cr-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 0;
}

.cr-card--open .cr-card-head {
  border-bottom: 1px solid #2c3a3c;
  padding-bottom: 5px;
  margin-bottom: 5px;
}

.cr-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 2px;
  background: #1a261a;
  color: #8fa193;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.04em;
}

.cr-badge--eti {
  background: #6b5a1c;
  color: #ffe069;
}

.cr-badge--suspicious {
  background: #25341d;
  color: #d8e7d9;
}

/* Class badge — SETI (default, cool blue) vs MeteorEcho (warm
   orange). Distinguishing the class at a glance matters when both
   observation regimes share one registry, so the operator doesn't
   confuse "signal-agnostic MSPC hit at 1420 MHz" with "meteor
   forward-scatter echo at 143 MHz". */
.cr-badge--class-seti {
  background: #1c3a55;
  color: #8fbfe0;
}

.cr-badge--class-meteor {
  background: #4a2d18;
  color: #e0a674;
}

/* Ephemeral badge — surfaces on Suspicious cards whose originating
   OBS was Test mode or landed outside the class-appropriate protected
   band (see is_permanent in observation-model). Signals to the
   operator that this row will age out in 72 h and never promote, so
   they don't waste attention chasing a candidate the network has
   already decided not to memorialise. */
.cr-badge--ephemeral {
  background: #3a2a10;
  color: #c9a06a;
  opacity: 0.85;
}

.cr-id {
  color: #d8e7d9;
}

.cr-freq {
  color: #6fe3a3;
}

.cr-spacer {
  flex: 1;
}

.cr-chevron {
  color: #7f8b99;
  font-size: 10px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.cr-card--open .cr-chevron {
  transform: rotate(180deg);
}

.cr-card-meta {
  display: flex;
  gap: 16px;
  color: #7f8b99;
  font-size: 11px;
}

.cr-card-body {
  display: none;
  padding: 6px 0 4px 12px;
  margin-left: 4px;
  border-left: 2px solid #1a261a;
  flex-direction: column;
  gap: 2px;
  /* Body is the "drawer" — clicking here selects sightings or
     interacts with the waterfall, never toggles the card. The
     default cursor signals that to the operator (the head's
     `cursor: pointer` is the toggle-affordance). */
  cursor: default;
  /* Cap the drawer at the card width so a wide waterfall img
     can't push the card horizontally. align-self pins the
     stretch in the parent column flex; overflow:hidden plus
     min-width:0 keep wide content inside the allotment;
     box-sizing makes the indent padding count against the cap. */
  align-self: stretch;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
}

.cr-card--open .cr-card-body {
  display: flex;
}

.cr-sighting {
  display: grid;
  grid-template-columns: 20px 140px 90px 80px 60px 1fr;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
}

.cr-sighting-marker {
  font-size: 12px;
}

.cr-sighting-time {
  color: #d8e7d9;
}

.cr-sighting-who {
  color: #6fe3a3;
}

.cr-sighting-metric {
  color: #7f8b99;
}

.cr-empty {
  color: #7f8b99;
  font-style: italic;
}

/* Per-event waterfall PNG embedded inside the candidate detail
   block. <img> starts hidden via display:none from the error
   handler if the endpoint 404s (peer sighting / not yet archived);
   the sibling status div carries the user-visible explanation in
   that case. */
.cr-detail-row--waterfall .cr-detail-value {
  display: block;
}

.cr-detail-waterfall {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin-top: 4px;
  border: 1px solid #2c3a3c;
}

.cr-detail-waterfall-status {
  font-size: 11px;
  color: #7f8b99;
}
