/* All rules are double-scoped under .hfsnlx-widget so they beat typical
   host-page rules (element selectors, single-class utilities) when this
   widget is embedded in a larger site. Properties that host pages commonly
   set globally (margins, line-height, fonts on form controls) are set
   explicitly rather than relying on browser defaults. */

.hfsnlx-widget,
.hfsnlx-widget * {
  box-sizing: border-box;
}

.hfsnlx-widget [hidden] {
  display: none !important;
}

.hfsnlx-widget {
  width: 100%;
  padding: 24px;
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  background: #ffffff;
  color: #333;
}

/* Buttons and inputs do not inherit font by default, and host pages often
   style them globally — pin both down. margin uses !important because
   host-page spacing utilities (e.g. `* + * { margin-top: ... }`) otherwise
   blow the tab switcher and controls apart on the embedded site. */
.hfsnlx-widget button,
.hfsnlx-widget input,
.hfsnlx-widget label {
  font-family: inherit;
  line-height: inherit;
  margin: 0 !important;
  float: none !important;
}

.hfsnlx-widget .hfsnlx-tabs > *,
.hfsnlx-widget .hfsnlx-controls-bar > * {
  margin: 0 !important;
}

/* Segmented-control style tab switcher. */
.hfsnlx-widget .hfsnlx-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 18px;
  background: #f4f1fc;
  border: 1px solid #e9e3f9;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.hfsnlx-widget .hfsnlx-tab-btn {
  border: none;
  background: transparent;
  color: #6b6580;
  padding: 9px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.hfsnlx-widget .hfsnlx-tab-btn:hover {
  background: rgba(116, 56, 242, 0.08);
  color: #7438F2 !important;
}

.hfsnlx-widget .hfsnlx-tab-btn--active {
  background: #7438F2;
  color: #fff !important;
  box-shadow: 0 2px 10px rgba(116, 56, 242, 0.35);
}

.hfsnlx-widget .hfsnlx-tab-btn--active:hover {
  background: #6a2fdd;
  color: #fff !important;
}

.hfsnlx-widget .hfsnlx-controls {
  display: flex;
  justify-content: center;
  margin: 0 0 18px;
}

/* Pill bar grouping the toggle and legend notes, with hairline dividers. */
.hfsnlx-widget .hfsnlx-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  row-gap: 8px;
  background: #fbfaff;
  border: 1px solid #efeaf9;
  border-radius: 999px;
  padding: 9px 8px;
}

.hfsnlx-widget .hfsnlx-controls-bar > * {
  padding: 0 18px;
  margin: 0;
}

.hfsnlx-widget .hfsnlx-controls-bar > * + * {
  border-left: 1px solid #e7e1f5;
}

/* !important throughout: host pages routinely restyle checkboxes globally
   (custom appearance, floats, offsets) which knocks this box off its text
   line when the widget is embedded. */
.hfsnlx-widget .hfsnlx-trails-toggle {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #4a4560;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: static !important;
  transform: none !important;
}

.hfsnlx-widget .hfsnlx-trails-toggle input {
  display: inline-block !important;
  flex-shrink: 0 !important;
  align-self: center !important;
  cursor: pointer;
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
  top: auto !important;
  float: none !important;
  transform: none !important;
  vertical-align: middle !important;
  accent-color: #B435E1;
  appearance: auto !important;
  -webkit-appearance: auto !important;
}

.hfsnlx-widget .hfsnlx-legend-note {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  color: #6b6580;
}

.hfsnlx-widget .hfsnlx-legend-note strong {
  color: #2d2a3e;
  font-weight: 700;
  margin-right: 4px;
}

/* Little pulsing-style dot marker in front of the click hint. */
.hfsnlx-widget .hfsnlx-hint-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B435E1;
  margin-right: 7px;
  box-shadow: 0 0 0 3px rgba(180, 53, 225, 0.2);
}

/* On narrow screens the chart keeps a minimum virtual width and pans
   horizontally inside this container instead of crushing 28 labels into
   a phone-sized plot. */
.hfsnlx-widget .hfsnlx-chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Axis bars auto-size to their content (auto tracks) so a host page's
   larger base font can never overflow them. */
.hfsnlx-widget .hfsnlx-chart-wrap {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  min-width: 0;
}

.hfsnlx-widget .hfsnlx-swipe-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  color: #999;
  margin: 8px 0 0;
}

.hfsnlx-widget .hfsnlx-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-modal--open {
  visibility: visible;
  pointer-events: auto;
}

.hfsnlx-widget .hfsnlx-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 20, 45, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hfsnlx-widget .hfsnlx-modal--open .hfsnlx-modal-backdrop {
  opacity: 1;
}

.hfsnlx-widget .hfsnlx-modal-dialog {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  width: min(460px, calc(100vw - 40px));
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.hfsnlx-widget .hfsnlx-modal--open .hfsnlx-modal-dialog {
  opacity: 1;
  transform: none;
}

/* !important on colors: embedded host pages often carry global
   button/button:hover color rules (some !important) that would otherwise
   turn this × white and invisible. */
.hfsnlx-widget .hfsnlx-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent !important;
  font-size: 22px;
  line-height: 1;
  padding: 2px 6px;
  color: #999 !important;
  cursor: pointer;
}

.hfsnlx-widget .hfsnlx-detail-close:hover,
.hfsnlx-widget .hfsnlx-detail-close:focus {
  background: transparent !important;
  color: #333 !important;
}

.hfsnlx-widget .hfsnlx-detail-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
}

/* Same styling as the chart's leader dots: purple core + soft halo. */
.hfsnlx-widget .hfsnlx-detail-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #B435E1;
  box-shadow: 0 0 0 4px rgba(180, 53, 225, 0.25);
}

.hfsnlx-widget .hfsnlx-detail-name {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.hfsnlx-widget .hfsnlx-detail-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 10px;
}

.hfsnlx-widget .hfsnlx-detail-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #444;
  margin: 0;
  padding: 0;
}

.hfsnlx-widget #hfsNlxChart {
  display: block;
  width: 100%;
  min-height: 320px;
  grid-column: 2;
  grid-row: 1;
}

.hfsnlx-widget .hfsnlx-axis-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
  line-height: 1.25;
  color: #2d2a3e;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.hfsnlx-widget .hfsnlx-axis-main,
.hfsnlx-widget .hfsnlx-axis-sub {
  display: block;
  margin: 0;
  padding: 0;
}

.hfsnlx-widget .hfsnlx-axis-sub {
  font-weight: 400;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  color: #8a8798;
}

.hfsnlx-widget .hfsnlx-y-axis-label {
  grid-column: 1;
  grid-row: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 10px 2px;
}

/* Modern browsers: render the vertical label natively instead of via a
   180° transform — transforms rasterize the text layer and blur glyphs. */
@supports (writing-mode: sideways-lr) {
  .hfsnlx-widget .hfsnlx-y-axis-label {
    writing-mode: sideways-lr;
    transform: none;
  }
}

.hfsnlx-widget .hfsnlx-x-axis-label {
  grid-column: 2;
  grid-row: 2;
  margin-top: 0;
  padding: 0 10px 4px;
}

.hfsnlx-widget .hfsnlx-axis text {
  fill: #666;
  font-size: 11px;
}

.hfsnlx-widget .hfsnlx-axis path,
.hfsnlx-widget .hfsnlx-axis line {
  stroke: #ccc;
}

.hfsnlx-widget .hfsnlx-trail {
  stroke: #d98c46;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.55;
  pointer-events: none;
}

/* Non-leader dots are muted and not clickable — analysis only exists for
   the Non-linear Leaders quadrant, whose dots are purple. */
.hfsnlx-widget .hfsnlx-point {
  fill: #b1aec0;
  stroke: #fff;
  stroke-width: 1;
  cursor: default;
  transition: fill 0.4s ease;
}

/* Leader dots: vivid purple core with a crisp white rim. The soft halo is
   a separate circle behind all dots (.hfsnlx-point-halo), so clustered
   dots stay individually distinguishable instead of fusing into a blob. */
.hfsnlx-widget .hfsnlx-point--leader {
  fill: #B435E1;
  stroke: #fff;
  stroke-width: 1.4;
  cursor: pointer;
}

.hfsnlx-widget .hfsnlx-point-halo {
  fill: #B435E1;
  fill-opacity: 0.18;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-select-ring {
  fill: #fff;
  stroke: #B435E1;
  stroke-width: 2;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-point-label {
  font-size: 9.5px;
  fill: #333;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-point-label--highlight {
  fill: #c25b1e;
  font-weight: 600;
}

.hfsnlx-widget .hfsnlx-point-label--consecutive-leader {
  font-weight: 700;
}

.hfsnlx-widget .hfsnlx-quadrant-highlight {
  fill: #DFD1FC;
  fill-opacity: 1;
  stroke: #B435E1;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}

.hfsnlx-widget .hfsnlx-quadrant-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-quadrant-sub {
  font-size: 8.5px;
  font-weight: 400;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-consecutive-highlight {
  fill: none;
  stroke: #2e7d32;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.hfsnlx-widget .hfsnlx-tooltip {
  position: fixed;
  pointer-events: none;
  background: #1a1a2e;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-width: 220px;
}

.hfsnlx-widget .hfsnlx-tooltip-name {
  font-weight: 700;
  margin: 0 0 2px;
}

.hfsnlx-widget .hfsnlx-tooltip-meta {
  color: #cfcfe0;
  margin: 0;
}

@media (max-width: 768px) {
  /* Keep the desktop chart geometry and pan instead of squeezing —
     below ~700px the 28 always-on labels physically cannot fit. */
  .hfsnlx-widget .hfsnlx-chart-wrap {
    min-width: 720px;
  }

  /* Keep the y-axis label visible while panning; solid background so it
     stays readable when it slides over chart content. */
  .hfsnlx-widget .hfsnlx-y-axis-label {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
  }

  .hfsnlx-widget .hfsnlx-swipe-hint {
    display: block;
  }
}

@media (max-width: 600px) {
  .hfsnlx-widget {
    padding: 14px;
  }

  /* Tabs: full-width rows inside the pill instead of one wrapped button
     floating half-centered under the other. */
  .hfsnlx-widget .hfsnlx-tabs {
    width: 100%;
    max-width: 420px;
    border-radius: 22px;
  }

  .hfsnlx-widget .hfsnlx-tab-btn {
    flex: 1 1 100%;
    font-size: 12px;
    padding: 8px 14px;
  }

  .hfsnlx-widget .hfsnlx-controls-bar {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 16px;
    padding: 12px 16px;
    row-gap: 10px;
  }

  .hfsnlx-widget .hfsnlx-controls-bar > * {
    padding: 0;
  }

  .hfsnlx-widget .hfsnlx-controls-bar > * + * {
    border-left: none;
  }

  .hfsnlx-widget .hfsnlx-axis-label {
    font-size: 11px;
  }

  .hfsnlx-widget .hfsnlx-axis-sub {
    font-size: 9.5px;
  }

  .hfsnlx-widget .hfsnlx-y-axis-label {
    padding: 8px 5px;
  }

  .hfsnlx-widget .hfsnlx-modal-dialog {
    padding: 16px 18px;
    max-height: 85vh;
  }
}
