/* Chart-specific styles - load after /css/site.css */

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.toolbar-label {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ltc-muted);
  margin-right: 0.15rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--ltc-silver);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.45rem 0.7rem;
  border-radius: 0.45rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: rgba(197, 205, 216, 0.35);
  color: var(--text);
}

.chip.is-active {
  background: var(--chip-on);
  border-color: rgba(74, 127, 212, 0.55);
  color: var(--text);
}

.chip:focus-visible {
  outline: 2px solid var(--ltc-blue-bright);
  outline-offset: 2px;
}

.series-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.series-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
}

.series-chip .swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.chart-shell {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg-panel-solid);
  overflow: hidden;
  min-height: min(70dvh, 640px);
}

.chart-shell--compact {
  min-height: min(52dvh, 440px);
  height: min(52dvh, 440px);
  margin-bottom: 1.25rem;
}

#cluster-chart {
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.data-table-wrap {
  margin: 0 0 1.5rem;
}

.data-table-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.data-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg-panel-solid);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  line-height: 1.35;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  color: var(--text);
}

.data-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ltc-muted);
  font-weight: 650;
  background: color-mix(in srgb, var(--chip-bg) 80%, transparent);
  position: sticky;
  top: 0;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: color-mix(in srgb, var(--chip-on) 55%, transparent);
}

.chart-shell.is-loading .load-overlay,
.chart-shell.is-error .load-overlay {
  display: flex;
}

.load-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--ltc-muted);
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--bg-panel-solid) 82%, transparent);
}

.chart-shell.is-error .load-overlay {
  color: #f0a8a8;
}

.chart-shell.is-error .load-overlay .spinner {
  display: none;
}

.load-overlay-text {
  max-width: 22rem;
  line-height: 1.4;
}

.spinner {
  box-sizing: border-box;
  width: 1.55rem;
  height: 1.55rem;
  border: 2px solid color-mix(in srgb, var(--ltc-muted) 35%, transparent);
  border-top-color: var(--ltc-blue-bright);
  border-radius: 50%;
  animation: chart-spin 0.7s linear infinite;
}

.explorer-top.is-busy .chip:disabled,
.preset-panel.is-busy .chip:disabled,
.explorer-bottom.is-busy .chip:disabled,
.panel-head.is-busy .chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@keyframes chart-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    border-top-color: var(--ltc-muted);
    opacity: 0.7;
  }
}

#cohorts-chart,
#metrics-chart,
#age-bands-chart {
  width: 100%;
  height: min(58dvh, 560px);
  box-sizing: border-box;
  background: var(--bg-panel-solid);
}

.chart-shell:has(#age-bands-chart),
.chart-shell:has(#metrics-chart) {
  min-height: min(58dvh, 560px);
  height: min(58dvh, 560px);
}

#age-bands-chart,
#metrics-chart {
  height: 100%;
}

#metrics-chart,
#age-bands-chart {
  /* Horizontal gestures belong to the chart; vertical gestures still scroll
     the page normally on phones and tablets. */
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  -webkit-user-select: none;
  user-select: none;
}

#metrics-chart .nsewdrag,
#metrics-chart .rangeslider-container,
#age-bands-chart .nsewdrag,
#age-bands-chart .rangeslider-container {
  touch-action: pan-y;
}

/* Soften the main plot while X is moving and Y autoscale is still pending.
   Geometry from JS (mainPlotRect). CSS filter on Plotly SVG <g> is ignored on
   mobile WebKit, so we use a clipped veil. Same blur strength on phone and PC. */
.chart-autoscale-veil {
  position: absolute;
  z-index: 4;
  display: none;
  pointer-events: none;
  overflow: hidden;
  box-sizing: border-box;
}

.chart-shell.is-awaiting-autoscale > .chart-autoscale-veil {
  display: block;
}

.chart-autoscale-veil-blur {
  position: absolute;
  /* Oversized so WebKit soft backdrop edges stay outside the clipped plot. */
  inset: -48px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  transform: translateZ(0);
}

[data-theme="dark"] .chart-autoscale-veil-blur {
  background: rgba(26, 39, 64, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .chart-autoscale-veil-blur {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(255, 255, 255, 0.55);
  }

  [data-theme="dark"] .chart-autoscale-veil-blur {
    background: rgba(26, 39, 64, 0.62);
  }
}

/* Fixed hover HUD — replaces the floating Plotly unified tooltip. */
.chart-hover-hud {
  display: none;
  position: absolute;
  z-index: 3;
  pointer-events: none;
  box-sizing: border-box;
  max-width: min(72%, 16.5rem);
  padding: 0.4rem 0.55rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px) saturate(1.02);
  -webkit-backdrop-filter: blur(4px) saturate(1.02);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.25;
  box-shadow: none;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.95), 0 0 10px rgba(255, 255, 255, 0.7);
}

.chart-hover-hud:not([hidden]) {
  display: block;
}

[data-theme="dark"] .chart-hover-hud {
  background: rgba(26, 39, 64, 0.28);
  box-shadow: none;
  text-shadow: 0 0 6px rgba(10, 16, 28, 0.95), 0 0 12px rgba(10, 16, 28, 0.75);
}

.chart-hover-hud-date {
  font-weight: 650;
  font-size: 0.74rem;
  margin-bottom: 0.28rem;
  color: var(--text);
}

.chart-hover-hud-rows {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.chart-hover-hud-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.chart-hover-hud-swatch {
  flex: 0 0 auto;
  width: 0.7rem;
  height: 2px;
  border-radius: 1px;
  margin-top: 0.35em;
  align-self: flex-start;
}

.chart-hover-hud-value {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.chart-hover-hud-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ltc-muted);
}

.chart-hover-spike {
  display: none;
  position: absolute;
  z-index: 2;
  pointer-events: none;
  width: 1px;
  margin-left: -0.5px;
  /* Vertical dashed: solid 1px box can't use border-style: dashed. */
  background: repeating-linear-gradient(
    to bottom,
    rgba(42, 82, 140, 0.9) 0,
    rgba(42, 82, 140, 0.9) 3px,
    transparent 3px,
    transparent 6px
  );
}

.chart-hover-spike:not([hidden]) {
  display: block;
}

[data-theme="dark"] .chart-hover-spike {
  background: repeating-linear-gradient(
    to bottom,
    rgba(74, 127, 212, 0.9) 0,
    rgba(74, 127, 212, 0.9) 3px,
    transparent 3px,
    transparent 6px
  );
}

/* Keep Plotly spike lines if any; hide the floating compare box everywhere. */
#metrics-chart .hoverlayer .hovertext,
#age-bands-chart .hoverlayer .hovertext {
  display: none !important;
}

.mode-note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--ltc-muted);
  line-height: 1.4;
}

.mode-note:empty {
  display: none;
}

.explorer-title {
  margin-bottom: 0.75rem;
}

.explorer-top {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem 0.7rem;
  margin-bottom: 0.85rem;
}

.explorer-top .chart-toolbar {
  margin-bottom: 0;
}

.chip-primary {
  background: var(--chip-on);
  border-color: rgba(74, 127, 212, 0.55);
  color: var(--text);
}

.chip-primary:hover {
  border-color: rgba(74, 127, 212, 0.75);
}

.explorer-bottom {
  margin-top: 0.85rem;
}

.active-panel {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem 1rem;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.add-metric-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.catalog-count {
  font-size: 0.78rem;
  color: var(--ltc-muted);
  white-space: nowrap;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.panel-sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--ltc-muted);
}

.active-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.active-empty {
  font-size: 0.85rem;
  color: var(--ltc-muted);
  padding: 0.35rem 0;
}

.active-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem 0.55rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--chip-bg);
}

.active-row.is-off {
  opacity: 0.55;
}

.active-row .swatch-btn {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.active-row .active-name {
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.active-row .axis-toggle,
.active-row .vis-btn,
.active-row .series-remove,
.active-row .help-btn,
.active-row .warn-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ltc-muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.active-row .axis-toggle {
  color: #5cb86a;
  border-color: rgba(92, 184, 106, 0.55);
  background: rgba(92, 184, 106, 0.14);
  font-weight: 700;
}

.active-row .axis-toggle:hover {
  color: #78d088;
  border-color: rgba(120, 208, 136, 0.75);
  background: rgba(120, 208, 136, 0.22);
}

.active-row .axis-toggle.is-blocked {
  color: #e0a040;
  border-color: rgba(224, 160, 64, 0.55);
  background: rgba(224, 160, 64, 0.12);
}

.active-row .vis-btn {
  font-size: 0.95rem;
  color: #f0c040;
  border-color: rgba(240, 192, 64, 0.5);
  background: rgba(240, 192, 64, 0.14);
}

.active-row .vis-btn:hover {
  color: #ffd54f;
  border-color: rgba(255, 213, 79, 0.75);
  background: rgba(255, 213, 79, 0.22);
}

.active-row .vis-btn.is-hidden {
  color: #c9a227;
  border-color: rgba(201, 162, 39, 0.4);
  background: rgba(201, 162, 39, 0.1);
  opacity: 0.95;
}

.active-row .series-remove {
  color: #e57373;
  border-color: rgba(229, 115, 115, 0.45);
  background: rgba(229, 115, 115, 0.1);
  font-size: 1.05rem;
  font-weight: 700;
}

.active-row .series-remove:hover {
  color: #ff8a80;
  border-color: rgba(239, 83, 80, 0.7);
  background: rgba(239, 83, 80, 0.18);
}

.help-btn,
.active-row .help-btn {
  appearance: none;
  border: 1px solid rgba(74, 127, 212, 0.55);
  background: rgba(74, 127, 212, 0.16);
  color: var(--ltc-blue-bright);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.35rem;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.help-btn:hover,
.active-row .help-btn:hover {
  color: #6ea0e8;
  border-color: rgba(74, 127, 212, 0.85);
  background: rgba(74, 127, 212, 0.28);
}

[data-theme="light"] .help-btn,
[data-theme="light"] .active-row .help-btn {
  color: #2a528c;
  border-color: rgba(42, 82, 140, 0.45);
  background: rgba(42, 82, 140, 0.1);
}

[data-theme="light"] .help-btn:hover,
[data-theme="light"] .active-row .help-btn:hover {
  color: #1e3f70;
  border-color: rgba(42, 82, 140, 0.7);
  background: rgba(42, 82, 140, 0.18);
}

.warn-btn,
.active-row .warn-btn {
  appearance: none;
  border: 1px solid rgba(224, 160, 64, 0.6);
  background: rgba(224, 160, 64, 0.16);
  color: #e0a040;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.35rem;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.warn-btn:hover,
.active-row .warn-btn:hover {
  color: #f0c060;
  border-color: rgba(240, 192, 96, 0.85);
  background: rgba(240, 192, 96, 0.28);
}

[data-theme="light"] .warn-btn,
[data-theme="light"] .active-row .warn-btn {
  color: #b8860b;
  border-color: rgba(184, 134, 11, 0.5);
  background: rgba(184, 134, 11, 0.12);
}

[data-theme="light"] .warn-btn:hover,
[data-theme="light"] .active-row .warn-btn:hover {
  color: #8a6508;
  border-color: rgba(138, 101, 8, 0.7);
  background: rgba(184, 134, 11, 0.2);
}

[data-theme="light"] .active-row .vis-btn {
  color: #b8860b;
  border-color: rgba(184, 134, 11, 0.45);
  background: rgba(255, 193, 7, 0.16);
}

[data-theme="light"] .active-row .vis-btn:hover {
  color: #8a6508;
  border-color: rgba(184, 134, 11, 0.7);
  background: rgba(255, 193, 7, 0.28);
}

[data-theme="light"] .active-row .axis-toggle {
  color: #2e7d3a;
  border-color: rgba(46, 125, 58, 0.45);
  background: rgba(76, 175, 80, 0.14);
}

[data-theme="light"] .active-row .axis-toggle:hover {
  color: #1b5e27;
  border-color: rgba(46, 125, 58, 0.7);
  background: rgba(76, 175, 80, 0.24);
}

.metric-tip {
  position: fixed;
  z-index: 100;
  width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--bg-panel-solid);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  color: var(--ltc-silver);
}

.metric-tip-title {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: var(--text);
}

.metric-tip-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ltc-silver);
}

.wizard-choice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  padding: 0.2rem 0.35rem 0.2rem 0;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--chip-bg);
}

.wizard-choice-row:has(.wizard-choice.is-selected) {
  background: var(--chip-on);
  border-color: rgba(74, 127, 212, 0.55);
}

.wizard-choice-row:has(.wizard-choice.is-disabled) {
  opacity: 0.55;
}

.wizard-choice-row .wizard-choice {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 0.35rem;
  padding: 0.45rem 0.55rem;
}

.wizard-choice-row .wizard-choice:hover {
  border-color: transparent;
}

.wizard-choice-row .wizard-choice.is-selected {
  background: transparent;
  border-color: transparent;
}

.wizard-choice-row .help-btn {
  align-self: center;
  margin-right: 0.15rem;
}

.wizard-summary-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--chip-bg);
}

.wizard-summary-row .wizard-summary {
  margin: 0;
  flex: 1;
}

.preset-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem 0.7rem;
  margin-bottom: 0.85rem;
}

.color-pop {
  position: fixed;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(8, 1.15rem);
  gap: 0.3rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-panel-solid);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.color-pop button {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding: 0;
  cursor: pointer;
}

.color-pop button.is-selected {
  outline: 2px solid var(--ltc-blue-bright);
  outline-offset: 1px;
}

.wizard-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.55);
  z-index: 80;
}

.metric-wizard {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: min(84dvh, 640px);
  display: flex;
  flex-direction: column;
  z-index: 90;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

/* Author `display: flex` otherwise beats the UA [hidden] rule. */
.metric-wizard[hidden],
.wizard-backdrop[hidden] {
  display: none !important;
}

.wizard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.wizard-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.wizard-close {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--ltc-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.wizard-steps {
  display: flex;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}

.wizard-steps li {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ltc-muted);
  padding: 0.35rem 0.25rem;
  border-radius: 0.35rem;
}

.wizard-steps li.is-active {
  color: var(--text);
  background: var(--chip-on);
}

.wizard-steps li.is-done {
  color: var(--ltc-silver);
}

.wizard-body {
  padding: 0.85rem 1rem;
  overflow: auto;
  flex: 1;
  min-height: 12rem;
}

.wizard-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.7rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
}

.wizard-foot .chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wizard-foot-spacer {
  flex: 1;
}

.wizard-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--chip-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
}

.wizard-choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wizard-choice {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.45rem;
  cursor: pointer;
}

.wizard-choice:hover {
  border-color: rgba(197, 205, 216, 0.4);
}

.wizard-choice.is-selected {
  background: var(--chip-on);
  border-color: rgba(74, 127, 212, 0.55);
}

.wizard-choice.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wizard-choice-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--ltc-muted);
}

.wizard-style-block {
  margin-bottom: 1rem;
}

.wizard-style-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ltc-muted);
}

.wizard-swatches {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.35rem;
}

.wizard-swatches button {
  appearance: none;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.35);
  padding: 0;
  cursor: pointer;
  min-height: 1.4rem;
}

.wizard-swatches button.is-selected {
  outline: 2px solid var(--ltc-blue-bright);
  outline-offset: 2px;
}

.wizard-axis-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.wizard-axis-option {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.wizard-axis-option .chip.is-disabled,
.wizard-axis-option .chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.wizard-axis-note {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--ltc-muted);
  line-height: 1.4;
}

.wizard-summary {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ltc-silver);
  line-height: 1.4;
}

.wizard-empty {
  margin: 0.5rem 0;
  color: var(--ltc-muted);
  font-size: 0.85rem;
}

.chart-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--ltc-muted);
  line-height: 1.4;
}

#cohorts-chart .rangeslider-slidebox,
#metrics-chart .rangeslider-slidebox,
#age-bands-chart .rangeslider-slidebox {
  cursor: grab !important;
}

#cohorts-chart .rangeslider-slidebox:active,
#metrics-chart .rangeslider-slidebox:active,
#age-bands-chart .rangeslider-slidebox:active {
  cursor: grabbing !important;
}

/* rangemode:auto draws Y mismatch bands; they steal drags and collapse the window. */
#cohorts-chart .rangeslider-mask-min-opp-axis,
#cohorts-chart .rangeslider-mask-max-opp-axis,
#metrics-chart .rangeslider-mask-min-opp-axis,
#metrics-chart .rangeslider-mask-max-opp-axis,
#age-bands-chart .rangeslider-mask-min-opp-axis,
#age-bands-chart .rangeslider-mask-max-opp-axis {
  display: none !important;
  pointer-events: none !important;
}

#cohorts-chart .rangeslider-grabarea-min,
#cohorts-chart .rangeslider-grabarea-max,
#cohorts-chart .rangeslider-grabber-min,
#cohorts-chart .rangeslider-grabber-max,
#metrics-chart .rangeslider-grabarea-min,
#metrics-chart .rangeslider-grabarea-max,
#metrics-chart .rangeslider-grabber-min,
#metrics-chart .rangeslider-grabber-max,
#age-bands-chart .rangeslider-grabarea-min,
#age-bands-chart .rangeslider-grabarea-max,
#age-bands-chart .rangeslider-grabber-min,
#age-bands-chart .rangeslider-grabber-max {
  cursor: ew-resize !important;
}

/* White knob is decorative only. If it captures hits, ↔ disappears on the
   knob while still working above/below (grabarea), and Plotly won't resize. */
#cohorts-chart .rangeslider-handle-min,
#cohorts-chart .rangeslider-handle-max,
#metrics-chart .rangeslider-handle-min,
#metrics-chart .rangeslider-handle-max,
#age-bands-chart .rangeslider-handle-min,
#age-bands-chart .rangeslider-handle-max {
  pointer-events: none !important;
  cursor: ew-resize !important;
}

/* Gray mask bands sit left of min / right of max — do not show ↔ there. */
#cohorts-chart .rangeslider-mask-min,
#cohorts-chart .rangeslider-mask-max,
#metrics-chart .rangeslider-mask-min,
#metrics-chart .rangeslider-mask-max,
#age-bands-chart .rangeslider-mask-min,
#age-bands-chart .rangeslider-mask-max {
  cursor: default !important;
}

/* Mobile: wider navigator handles. Grabarea scale+offset is applied in JS
   (alignRangesliderGrabareas) so it stays centered on the white knob. */
@media (pointer: coarse), (max-width: 640px) {
  #metrics-chart .rangeslider-handle-min,
  #metrics-chart .rangeslider-handle-max,
  #age-bands-chart .rangeslider-handle-min,
  #age-bands-chart .rangeslider-handle-max {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleX(2.5);
  }
}

#cohorts-chart .hoverlayer line.spikeline[stroke-width="3"],
#cohorts-chart .hoverlayer line.spikeline[stroke-width="4"],
#cohorts-chart .hoverlayer line.spikeline[stroke-width="5"],
#metrics-chart .hoverlayer line.spikeline[stroke-width="3"],
#metrics-chart .hoverlayer line.spikeline[stroke-width="4"],
#metrics-chart .hoverlayer line.spikeline[stroke-width="5"],
#age-bands-chart .hoverlayer line.spikeline[stroke-width="3"],
#age-bands-chart .hoverlayer line.spikeline[stroke-width="4"],
#age-bands-chart .hoverlayer line.spikeline[stroke-width="5"] {
  display: none !important;
}

#cohorts-chart .hoverlayer line.spikeline,
#metrics-chart .hoverlayer line.spikeline,
#age-bands-chart .hoverlayer line.spikeline {
  stroke-width: 1px !important;
  stroke-dasharray: 3 3 !important;
  vector-effect: non-scaling-stroke;
}

#cohorts-chart .nsewdrag,
#metrics-chart .nsewdrag,
#age-bands-chart .nsewdrag {
  cursor: grab !important;
}

#cohorts-chart .nsewdrag:active,
#metrics-chart .nsewdrag:active,
#age-bands-chart .nsewdrag:active {
  cursor: grabbing !important;
}

#cohorts-chart .draglayer > g .nsewdrag,
#metrics-chart .draglayer > g .nsewdrag,
#age-bands-chart .draglayer > g .nsewdrag {
  cursor: grab !important;
}

#cohorts-chart .draglayer > g .nsewdrag:active,
#metrics-chart .draglayer > g .nsewdrag:active,
#age-bands-chart .draglayer > g .nsewdrag:active {
  cursor: grabbing !important;
}

@media (max-width: 640px) {
  #cohorts-chart,
  #metrics-chart,
  #age-bands-chart,
  #cluster-chart,
  .chart-shell,
  .chart-shell:has(#age-bands-chart),
  .chart-shell:has(#metrics-chart) {
    min-height: min(48dvh, 420px);
    height: min(48dvh, 420px);
  }

  .chart-shell--compact {
    min-height: min(42dvh, 360px);
    height: min(42dvh, 360px);
  }

  .wizard-swatches {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .chip {
    transition: none;
  }
}
/* Pipeline update progress (on-chain explorer) */
.pipeline-progress {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.7rem 1rem 0.75rem;
  margin-bottom: 0.5rem;
}

.pipeline-progress[hidden] {
  display: none !important;
}

.pipeline-progress-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.pipeline-progress-aside {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pipeline-progress-meta-line {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ltc-muted);
  line-height: 1.45;
}

.pipeline-progress-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ltc-muted);
}

.pipeline-progress-meta {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ltc-muted);
  text-align: left;
  line-height: 1.45;
}

.pipeline-progress-meta strong {
  color: var(--text);
  font-weight: 600;
}

.pipeline-overall-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.pipeline-overall {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--inset-bg-strong);
  overflow: hidden;
  margin-bottom: 0;
  min-width: 0;
}

.pipeline-overall-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ltc-blue), var(--ltc-blue-bright));
  transition: width 0.45s ease;
}

.pipeline-overall-pct {
  min-width: 2.6rem;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--ltc-muted);
  line-height: 1;
}

.pipeline-progress.is-idle .pipeline-overall-bar {
  background: color-mix(in srgb, var(--ltc-blue) 45%, var(--ltc-silver));
}

.pipeline-progress.is-failed .pipeline-overall-bar {
  background: #c45b5b;
}

.pipeline-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.pipeline-stage {
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 9.5rem) 3.75rem 1fr auto;
  align-items: center;
  gap: 0.45rem 0.55rem;
  font-size: 0.78rem;
  color: var(--ltc-muted);
}

.pipeline-stage-cadence {
  justify-self: start;
  display: inline-block;
  width: fit-content;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  color: var(--ltc-muted);
  white-space: nowrap;
}

.pipeline-stage-cadence--daily {
  color: var(--ltc-blue-bright);
  border-color: color-mix(in srgb, var(--ltc-blue-bright) 35%, var(--border));
}

.pipeline-stage-cadence--weekly {
  color: #9a7bd4;
  border-color: color-mix(in srgb, #9a7bd4 35%, var(--border));
}

.pipeline-stage.is-skipped {
  color: var(--ltc-muted);
  opacity: 1;
}

.pipeline-stage.is-skipped .pipeline-stage-icon,
.pipeline-stage.is-skipped .pipeline-stage-name,
.pipeline-stage.is-skipped .pipeline-stage-pct {
  color: var(--ltc-muted);
}

.pipeline-stage.is-skipped .pipeline-stage-cadence {
  color: var(--ltc-muted);
  border-color: var(--border);
  background: transparent;
}

.pipeline-stage.is-skipped .pipeline-stage-bar {
  width: 100% !important;
  background: color-mix(in srgb, var(--ltc-muted) 55%, var(--inset-bg));
}

.pipeline-stage.is-weekly:not(.is-running):not(.is-ok):not(.is-failed):not(.is-skipped) {
  opacity: 0.65;
}

.pipeline-stage-icon {
  width: 1.1rem;
  text-align: center;
  line-height: 1;
  font-size: 0.85rem;
}

.pipeline-stage.is-ok {
  color: var(--text);
}

.pipeline-stage.is-ok .pipeline-stage-icon {
  color: #3fae6e;
}

.pipeline-stage.is-running {
  color: var(--text);
}

.pipeline-stage.is-running .pipeline-stage-icon {
  color: var(--ltc-blue-bright);
}

.pipeline-stage.is-failed {
  color: #c45b5b;
}

.pipeline-stage-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-stage-track {
  height: 0.28rem;
  border-radius: 999px;
  background: var(--inset-bg);
  overflow: hidden;
}

.pipeline-stage-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--ltc-blue-bright);
  transition: width 0.35s ease;
}

.pipeline-stage.is-ok .pipeline-stage-bar {
  width: 100% !important;
  background: color-mix(in srgb, #3fae6e 75%, var(--ltc-blue));
}

.pipeline-stage.is-failed .pipeline-stage-bar {
  background: #c45b5b;
}

.pipeline-stage-pct {
  min-width: 2.6rem;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--ltc-muted);
}

.pipeline-stage-msg {
  grid-column: 2 / -1;
  margin: 0;
  font-size: 0.72rem;
  color: var(--ltc-muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.pipeline-stage-msg:empty {
  display: none;
}

@media (max-width: 640px) {
  .pipeline-stage {
    grid-template-columns: 1.1rem minmax(0, 1fr) 3.5rem auto;
  }

  .pipeline-stage-track {
    grid-column: 2 / 5;
  }

  .pipeline-stage-pct {
    grid-column: 4;
    grid-row: 1;
  }

  .pipeline-stage-cadence {
    grid-column: 3;
    grid-row: 1;
  }

  .pipeline-stage-msg {
    grid-column: 2 / 5;
  }
}

/* Lead sits above the On chart panel (series list / add wizard). */
.explorer-bottom > .page-lead {
  margin: 0 0 0.55rem;
  max-width: none;
  width: 100%;
}
