/* Reach Probability control + chips (theme-aware via --theme-* vars) */
/* width:max-content pins the wrapper to its toggle's size. Without it the
   shared `.toolbar-group { display:flex }` rule makes this a block-level flex
   item whose flex-basis:auto stretches to the full nav-subs width (~472px on
   mobile), overflowing the scroll row so "Snapshot" gets pushed off the left. */
.reach-prob-controls { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; width: max-content; }

.reach-prob-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 10px; border: 1px solid var(--theme-border-primary);
  border-radius: 8px; background: transparent; color: var(--theme-text-secondary);
  cursor: pointer; white-space: nowrap;
}
.reach-prob-toggle svg { width: 16px; height: 16px; stroke-width: 2; }
.reach-prob-label { font-size: 12px; font-weight: 600; line-height: 1; }
.reach-prob-toggle:hover { background: var(--theme-hover-bg); }
.reach-prob-toggle[aria-expanded="true"] {
  background: var(--theme-active-bg); color: var(--theme-text-primary);
  border-color: var(--theme-hover-border);
}

.reach-prob-panel {
  position: fixed; z-index: 1000; width: 300px;
  background: var(--theme-bg-card); border: 1px solid var(--theme-border-primary);
  border-radius: 10px; padding: 14px; color: var(--theme-text-primary);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
.reach-prob-panel[hidden] { display: none; }

.reach-prob-panel .rp-title {
  font-size: 13px; font-weight: 700; color: var(--theme-text-primary); margin-bottom: 4px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.reach-prob-panel .rp-learn-more {
  flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 0;
  border: none; background: transparent; color: #3498db; cursor: pointer;
}
.reach-prob-panel .rp-learn-more:hover { background: transparent; text-decoration: underline; }
.reach-prob-panel .rp-hint { font-size: 11px; line-height: 1.4; color: var(--theme-text-secondary); margin-bottom: 12px; }
.reach-prob-panel .rp-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--theme-text-secondary); margin: 10px 0 5px;
}
.reach-prob-panel .rp-label:first-of-type { margin-top: 0; }

.reach-prob-panel .rp-row { display: flex; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }

.reach-prob-panel button {
  font-size: 12px; padding: 6px 10px; border: 1px solid var(--theme-border-primary);
  border-radius: 6px; background: transparent; color: var(--theme-text-secondary); cursor: pointer;
}
.reach-prob-panel button:hover { background: var(--theme-hover-bg); }
.reach-prob-panel button.active { background: #3498db; color: #fff; border-color: #3498db; }

.reach-prob-panel .rp-compute {
  width: 100%; margin-top: 12px; background: var(--color-success); color: #fff;
  font-weight: 700; border: none; padding: 9px; border-radius: 6px; cursor: pointer;
}
.reach-prob-panel .rp-compute:hover { filter: brightness(1.06); }

.reach-prob-panel.is-stale .rp-status { color: #e0a020; }
.rp-status { font-size: 10px; color: var(--theme-text-muted); margin-top: 8px; text-align: center; }

/* Phones only: bottom sheet + icon-only toggle (label hidden, square hit area).
   Width-based (was also `(pointer: coarse)`, which wrongly caught iPad-touch and
   hid the Reach label there) â€” iPad has room in the second toolbar row, so it
   keeps the labeled toggle + positioned popover (matches gex_reach_probability
   _positionPanel's 767.98px breakpoint). */
@media (max-width: 768px) {
  .reach-prob-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    border-radius: 16px 16px 0 0;
  }
  .reach-prob-label { display: none; }
  .reach-prob-toggle { width: 34px; padding: 0; }
}

.reach-prob-panel .rp-legend {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--theme-border-primary);
  display: flex; flex-direction: column; gap: 3px;
  font-size: 10px; line-height: 1.35; color: var(--theme-text-secondary);
}
.reach-prob-panel .rp-legend b { color: var(--theme-text-primary); font-weight: 700; }

/* Marker-card probability chip â€” shares the badge row (flex space-between) so it
   sits on the same baseline as the badge. bg color is set inline by JS (heat
   scale); white text reads on it in both themes. */
.marker-prob-chip {
  flex-shrink: 0; font-size: 10px; font-weight: 700;
  color: #fff; padding: 1px 5px; border-radius: 7px; line-height: 1.4;
}
.marker-prob-chip[hidden] { display: none; }

.reach-prob-panel .rp-horizon-caption {
  font-size: 10px; color: var(--theme-text-secondary); margin: 0 0 6px; min-height: 13px;
}
.reach-prob-panel .rp-horizon-caption b { color: var(--theme-text-primary); font-weight: 600; }
