/* Filter ? tooltips */
.filter-help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.2rem;
}

.filter-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  border: 1px solid #45475a;
  background: #313244;
  color: #9ca3af;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  padding: 0;
  flex-shrink: 0;
}

.filter-help-btn:hover,
.filter-help-wrap.is-open .filter-help-btn {
  color: #e5e7eb;
  border-color: #6b7280;
  background: #45475a;
}

.filter-help-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(280px, 85vw);
  padding: 0.5rem 0.65rem;
  font-size: 0.75rem;
  font-weight: normal;
  line-height: 1.45;
  color: #e5e7eb;
  text-align: left;
  background: #1e1e2e;
  border: 1px solid #45475a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
}

.filter-help-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #45475a;
}

@media (hover: hover) and (pointer: fine) {
  .filter-help-wrap:hover .filter-help-tip {
    opacity: 1;
    visibility: visible;
  }
}

.filter-help-wrap.is-open .filter-help-tip,
.filter-help-wrap:focus-within .filter-help-tip {
  opacity: 1;
  visibility: visible;
}

.quick-template-pill .filter-help-wrap,
.quick-template-help .filter-help-wrap {
  margin-left: 0;
}

.quick-template-pill .filter-help-tip {
  z-index: 70;
}

th .filter-help-wrap .filter-help-tip {
  bottom: auto;
  top: calc(100% + 8px);
}

th .filter-help-wrap .filter-help-tip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #45475a;
}

/* Onboarding tour */
#onboarding-tour-modal .tour-card {
  max-width: 28rem;
  width: 100%;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid #e2e8f0;
}

#onboarding-tour-modal #tour-modal-title {
  color: #0f172a;
}

#onboarding-tour-modal .tour-step-panel h3 {
  color: #0f172a;
}

#onboarding-tour-modal .tour-step-panel p {
  color: #64748b;
}

#onboarding-tour-modal .tour-step-dot {
  background: #cbd5e1;
}

#onboarding-tour-modal .tour-step-dot.is-active {
  background: #2563eb;
}

#onboarding-tour-modal label[for="tour-dont-show-again"],
#onboarding-tour-modal .tour-dont-show-label {
  color: #64748b;
}

#onboarding-tour-modal #tour-close-btn {
  color: #94a3b8;
}

#onboarding-tour-modal #tour-close-btn:hover {
  color: #0f172a;
}

.tour-nav-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tour-nav-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.tour-nav-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.tour-nav-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

#onboarding-tour-modal .tour-footer-divider {
  border-color: #e2e8f0;
}

.tour-step-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.tour-step-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #45475a;
  transition: background 0.15s, transform 0.15s;
}

.tour-step-dot.is-active {
  background: #3b82f6;
  transform: scale(1.15);
}

.tour-step-panel {
  display: none;
}

.tour-step-panel.is-active {
  display: block;
}

.tour-step-panel h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.tour-step-panel p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #64748b;
}

/* Keep filter sidebar (investor mode) visible on first-load welcome tour */
#onboarding-tour-modal:not(.hidden) {
  justify-content: flex-end;
  align-items: flex-start;
  padding: 64px max(24px, 2vw) 24px 252px;
  background: linear-gradient(
    90deg,
    rgba(15, 25, 35, 0.04) 0,
    rgba(15, 25, 35, 0.04) 240px,
    rgba(0, 0, 0, 0.78) 240px,
    rgba(0, 0, 0, 0.78) 100%
  ) !important;
  backdrop-filter: blur(2px);
}

@media (max-width: 900px) {
  #onboarding-tour-modal:not(.hidden) {
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px);
  }
}
