/**
 * Polo Exchange — Fintech chart system (dashboard presentation only).
 * TradingView / Wise–inspired: flat surfaces, data-first, no decorative gradients.
 */

.dash-root {
  --fx-primary: #2563eb;
  --fx-positive: #16a34a;
  --fx-negative: #dc2626;
  --fx-neutral: #64748b;
  --fx-chart-bg: #ffffff;
  --fx-chart-border: #e2e8f0;
  --fx-chart-grid: #f1f5f9;
  --fx-chart-text: #0f172a;
  --fx-chart-muted: #64748b;
  --fx-chart-fill-buy: rgba(37, 99, 235, 0.08);
  --fx-chart-fill-sell: rgba(22, 163, 74, 0.08);
  --fx-chart-fill-profit: rgba(22, 163, 74, 0.08);
  --fx-chart-radius: 12px;
  --fx-chart-min-h: 400px;
  --fx-profit-chart-min-h: 440px;
  --fx-font: var(--eui-font, 'Inter', ui-sans-serif, system-ui, sans-serif);
}

body.theme-dark .dash-root,
body.dark .dash-root {
  --fx-chart-bg: #0f172a;
  --fx-chart-border: #334155;
  --fx-chart-grid: #1e293b;
  --fx-chart-text: #f8fafc;
  --fx-chart-muted: #94a3b8;
  --fx-chart-fill-buy: rgba(37, 99, 235, 0.14);
  --fx-chart-fill-sell: rgba(34, 197, 94, 0.12);
  --fx-chart-fill-profit: rgba(22, 163, 74, 0.12);
}

/* ── Chart card shell ───────────────────────────────────────── */
.fx-chart {
  font-family: var(--fx-font);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  border: 1px solid var(--fx-chart-border);
  border-radius: var(--fx-chart-radius);
  background: var(--fx-chart-bg);
  overflow: hidden;
}

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

.fx-chart__range {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: var(--fx-chart-grid);
}

.fx-chart__range-btn {
  border: none;
  background: transparent;
  color: var(--fx-chart-muted);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.fx-chart__range-btn:hover {
  color: var(--fx-chart-text);
}

.fx-chart__range-btn.is-active {
  background: var(--fx-chart-bg);
  color: var(--fx-chart-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  cursor: default;
}

.fx-chart__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--fx-chart-muted);
}

.fx-chart__status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fx-chart__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fx-positive);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25);
}

.fx-chart__status--live::before {
  animation: fx-pulse 2s ease-in-out infinite;
}

@keyframes fx-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.fx-chart__updated {
  font-variant-numeric: tabular-nums;
}

.fx-chart__change {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--fx-chart-grid);
}

.fx-chart__change.is-up {
  color: var(--fx-positive);
}

.fx-chart__change.is-down {
  color: var(--fx-negative);
}

.fx-chart__change.is-flat {
  color: var(--fx-chart-muted);
}

.fx-chart__kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem 0.75rem;
}

.fx-chart__kpi {
  min-width: 5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--fx-chart-border);
  background: var(--fx-chart-grid);
}

.fx-chart__kpi-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fx-chart-muted);
}

.fx-chart__kpi-value {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fx-chart-text);
  font-variant-numeric: tabular-nums;
}

.fx-chart__kpi-value.is-up {
  color: var(--fx-positive);
}

.fx-chart__kpi-value.is-down {
  color: var(--fx-negative);
}

.fx-chart__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem 0.25rem;
}

.fx-chart__summary-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--fx-chart-muted);
  max-width: 18rem;
  line-height: 1.45;
}

.fx-chart__readout {
  text-align: right;
}

.fx-chart__readout-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fx-chart-muted);
}

.fx-chart__readout-value {
  display: block;
  margin-top: 0.1rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fx-chart-text);
  font-variant-numeric: tabular-nums;
}

.fx-chart__readout-value.is-up {
  color: var(--fx-positive);
}

.fx-chart__readout-value.is-down {
  color: var(--fx-negative);
}

.fx-chart__readout-sub {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--fx-chart-muted);
}

/* ── Chart stage ─────────────────────────────────────────── */
.fx-chart__stage,
#dash-rates-chart-wrap.fx-chart__stage {
  position: relative;
  width: 100%;
  min-height: var(--fx-chart-min-h);
  height: var(--fx-chart-min-h);
  padding: 0.5rem 0.75rem 0.75rem;
  cursor: default;
  outline: none;
  touch-action: none;
  background: var(--fx-chart-bg);
}

.dash-profit-chart-stage.fx-chart__stage,
#dash-profit-chart-stage.fx-chart__stage {
  position: relative;
  width: 100%;
  min-height: var(--fx-profit-chart-min-h);
  height: var(--fx-profit-chart-min-h);
  padding: 0.5rem 0.75rem 0.75rem;
  cursor: default;
  outline: none;
  touch-action: none;
  background: var(--fx-chart-bg);
}

.fx-chart__stage.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.fx-chart__svg,
.dash-profit-ogive-chart,
.dash-rates-line-chart,
.dash-daily-trend-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: visible;
}

.fx-chart__svg text,
.dash-profit-ogive-chart text,
.dash-rates-line-chart text,
.dash-daily-trend-svg text {
  font-family: var(--fx-font);
  font-variant-numeric: tabular-nums;
}

/* Grid & axes */
.fx-grid-line,
.dash-profit-grid-line,
.dash-rates-grid {
  stroke: var(--fx-chart-grid);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.fx-axis-label,
.dash-rates-axis-label,
.dash-daily-axis-label {
  fill: var(--fx-chart-muted);
  font-size: 13px;
  font-weight: 500;
}

.fx-axis-label--x,
.dash-rates-axis-label--x {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.dash-daily-trend-svg .fx-axis-label--x.dash-daily-axis-label {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.dash-profit-ogive-chart .dash-profit-axis-label {
  font-size: 13px;
}

.dash-profit-ogive-chart .dash-profit-axis-label--x {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.fx-zero-line,
.dash-profit-zero-line {
  stroke: var(--fx-neutral);
  stroke-dasharray: 4 4;
  opacity: 0.65;
}

/* Lines & areas — flat, no glow */
.fx-line-profit,
.dash-profit-ogive-line {
  fill: none;
  stroke: var(--fx-positive);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.fx-area-profit,
.dash-profit-ogive-area {
  fill: var(--fx-chart-fill-profit);
  stroke: none;
}

.fx-line-buy,
.dash-line-buy {
  fill: none;
  stroke: var(--fx-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.fx-line-sell,
.dash-line-sell,
.dash-daily-line-sell {
  fill: none;
  stroke: var(--fx-positive);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
  filter: none;
}

.fx-area-buy,
.dash-rate-area-buy {
  fill: var(--fx-chart-fill-buy);
  stroke: none;
}

.fx-area-sell,
.dash-rate-area-sell {
  fill: var(--fx-chart-fill-sell);
  stroke: none;
}

/* Points */
.fx-dot,
.dash-profit-day-dot,
.dash-profit-end-dot,
.dash-profit-hover-dot,
.dash-rate-dot {
  filter: none;
  transition: r 0.15s ease, opacity 0.15s ease;
}

.fx-dot--high,
.fx-marker-high {
  fill: var(--fx-positive);
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.fx-dot--low,
.fx-marker-low {
  fill: var(--fx-negative);
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.dash-profit-day-dot {
  fill: var(--fx-chart-bg);
  stroke: var(--fx-positive);
  stroke-width: 2;
  opacity: 0.85;
}

.dash-profit-hover-dot.is-visible {
  fill: var(--fx-positive);
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.dash-rate-dot--buy {
  fill: var(--fx-primary);
}

.dash-rate-dot--sell {
  fill: var(--fx-positive);
}

.dash-rate-dot.is-active {
  r: 5;
}

/* Profit chart: one hover guide (SVG line only) */
.dash-profit-crosshair {
  display: none !important;
}

/* Crosshair */
.fx-crosshair,
.dash-rates-crosshair {
  position: absolute;
  top: 0.75rem;
  bottom: 2rem;
  width: 1px;
  background: var(--fx-neutral);
  opacity: 0.35;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.15s ease, left 0.12s ease;
}

.fx-crosshair.is-visible,
.dash-profit-crosshair.is-visible,
.dash-rates-crosshair.is-visible {
  opacity: 1;
}

.fx-hover-line,
.dash-profit-hover-line {
  stroke: var(--fx-neutral);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.5;
}

/* Tooltips */
.fx-tooltip,
.dash-profit-tooltip,
.dash-rates-tooltip,
.dash-daily-tooltip,
.dash-currency-chart-tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  min-width: 8.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--fx-chart-border);
  background: var(--fx-chart-bg);
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12);
  font-family: var(--fx-font);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--fx-chart-text);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 8px));
  transition: opacity 0.15s ease, transform 0.15s ease, left 0.12s ease, top 0.12s ease;
}

body.theme-dark .fx-tooltip,
body.dark .fx-tooltip,
body.theme-dark .dash-profit-tooltip,
body.dark .dash-profit-tooltip,
body.theme-dark .dash-rates-tooltip,
body.dark .dash-rates-tooltip,
body.theme-dark .dash-daily-tooltip,
body.dark .dash-daily-tooltip,
body.theme-dark .dash-currency-chart-tooltip,
body.dark .dash-currency-chart-tooltip {
  box-shadow: 0 8px 28px -8px rgba(0, 0, 0, 0.45);
}

.fx-tooltip.is-visible,
.dash-profit-tooltip.is-visible,
.dash-rates-tooltip.is-visible,
.dash-daily-tooltip.is-visible,
.dash-currency-chart-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 10px));
}

.fx-tooltip__title {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fx-chart-muted);
  margin-bottom: 0.25rem;
}

.fx-tooltip__value {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--fx-chart-text);
}

.fx-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  color: var(--fx-chart-muted);
}

.fx-tooltip__row strong {
  color: var(--fx-chart-text);
  font-weight: 600;
}

.fx-tooltip__pct.is-up {
  color: var(--fx-positive);
}

.fx-tooltip__pct.is-down {
  color: var(--fx-negative);
}

/* Legend */
.fx-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: var(--fx-chart-grid);
}

.fx-legend__btn,
.dash-panel__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fx-chart-muted);
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.fx-legend__btn.is-off {
  opacity: 0.4;
}

.fx-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.fx-legend__dot--buy {
  background: var(--fx-primary);
}

.fx-legend__dot--sell {
  background: var(--fx-positive);
}

.fx-legend__dot--profit {
  background: var(--fx-positive);
}

/* Empty & loading */
.fx-chart__empty,
.dash-panel__empty--chart {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--fx-chart-min-h);
  padding: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fx-chart-muted);
  text-align: center;
}

.fx-chart__empty-icon {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  opacity: 0.35;
}

/* Override legacy decorative panels */
.dash-root .dash-profit-panel,
.dash-root .dash-rates-chart-wrap.dash-panel__chart,
.dash-root .dash-panel__chart#dash-daily-trend-chart {
  background: var(--fx-chart-bg) !important;
  border: 1px solid var(--fx-chart-border) !important;
  border-radius: var(--fx-chart-radius) !important;
  box-shadow: none !important;
  background-image: none !important;
}

.dash-root .dash-profit-panel__controls,
.dash-root .dash-profit-chart-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.dash-root .dash-panel__chart,
.dash-root #dash-rates-chart-wrap.fx-chart__stage,
.dash-root #dash-daily-trend-chart.fx-chart__stage {
  height: auto !important;
  min-height: var(--fx-chart-min-h) !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Rates chart — match profit panel */
.dash-rates-line-chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dash-rates-line-chart .dash-rates-axis-label {
  font-size: 13px;
}

.dash-rates-line-chart .dash-rates-axis-label--x {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.dash-rates-line-chart .dash-rate-area-buy,
.dash-rates-line-chart .dash-rate-area-sell {
  opacity: 1;
}

.dash-rates-line-chart .dash-line-sell,
.dash-daily-trend-svg .dash-daily-line-sell {
  stroke: var(--fx-positive);
}

.dash-rates-line-chart .dash-rate-dot {
  opacity: 1;
  animation: none;
  filter: none;
}

.dash-rates-line-chart .dash-line-buy,
.dash-rates-line-chart .dash-line-sell {
  filter: none;
}

/* Daily trend chart */
.dash-daily-trend-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  cursor: default;
}

.dash-daily-trend-svg .dash-daily-axis-label {
  font-size: 13px;
}

.dash-daily-grid-mid {
  stroke-dasharray: 3 4;
  opacity: 0.5;
}

#dash-daily-trend-chart.is-series-buy .dash-daily-line-sell,
#dash-daily-trend-chart.is-series-sell .dash-daily-line-buy {
  opacity: 0.22;
}

#dash-daily-trend-chart.is-series-buy .dash-daily-area-sell,
#dash-daily-trend-chart.is-series-sell .dash-daily-area-buy {
  opacity: 0.35;
}

.dash-daily-crosshair,
.dash-rates-crosshair {
  display: none !important;
}

.dash-daily-hover-line {
  stroke: var(--fx-neutral);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: 0.5;
}

.dash-daily-hover-dot--buy {
  fill: var(--fx-primary);
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.dash-daily-hover-dot--sell {
  fill: var(--fx-positive);
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

#dash-daily-trend-chart.is-pinned {
  cursor: crosshair;
}

.dash-panel__currency-card .dash-currency-chart-tooltip {
  top: 0.45rem;
  left: 50%;
  right: auto;
  bottom: auto;
  min-width: 8.25rem;
  max-width: calc(100% - 1rem);
  text-align: left;
  z-index: 12;
  transform: translateX(-50%) translateY(6px) scale(0.97);
  transition:
    opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.dash-panel__currency-card .dash-currency-chart-tooltip.is-visible {
  transform: translateX(-50%) translateY(0) scale(1);
}

.fx-tooltip__row.is-active strong {
  color: var(--fx-chart-text);
}

.dash-panel__currency-card .fx-tooltip__row.is-active strong {
  color: var(--fx-primary);
}

.dash-panel__currency-card.is-series-sell .fx-tooltip__row.is-active strong {
  color: var(--fx-positive);
}

.dash-panel__currency-card.is-chart-active .dash-panel__currency-code {
  opacity: 0.4;
  transition: opacity 0.22s ease;
}

/* Currency mini charts */
.dash-currency-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.dash-currency-chart .fx-grid-line {
  stroke: var(--fx-chart-grid);
  stroke-width: 1;
}

.dash-currency-grid-mid {
  opacity: 0.55;
}

.dash-currency-bar--buy {
  fill: var(--fx-primary);
  opacity: 0.9;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.dash-currency-bar--sell {
  fill: var(--fx-positive);
  opacity: 0.85;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.dash-currency-value-label {
  font-size: 11px;
  font-weight: 600;
  fill: var(--fx-chart-text);
}

.dash-currency-caption {
  font-size: 11px;
  font-weight: 600;
  fill: var(--fx-chart-muted);
}

.dash-panel__currency-card.is-chart-active .dash-currency-bar--buy.is-bar-hover {
  opacity: 1;
}

.dash-panel__currency-card.is-chart-active .dash-currency-bar--sell.is-bar-hover {
  opacity: 1;
}

.dash-panel__currency-card.is-chart-active .dash-currency-bar.is-bar-dim {
  opacity: 0.35;
}

/* 7-day profit bars */
.dash-panel__profit-bar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fx-chart-muted);
}

.dash-panel__profit-bar {
  background: var(--fx-positive);
  border-radius: 4px 4px 0 0;
  opacity: 0.85;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.dash-panel__profit-bar-col.is-bar-active .dash-panel__profit-bar {
  opacity: 1;
  filter: brightness(1.05);
}

/* Intro animation — subtle */
.fx-line-profit.is-intro,
.dash-profit-ogive-line.is-intro {
  stroke-dasharray: var(--profit-line-len, 1200);
  stroke-dashoffset: var(--profit-line-len, 1200);
  animation: fx-draw-line 0.45s ease-out 0.03s forwards;
}

.fx-area-profit.is-intro,
.dash-profit-ogive-area.is-intro {
  opacity: 0;
  animation: fx-fade-in 0.35s ease-out 0.06s forwards;
}

@keyframes fx-draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fx-fade-in {
  to {
    opacity: 1;
  }
}

.dash-rate-value-label {
  display: none;
}

.dash-rates-line-chart .dash-rate-dot {
  opacity: 1;
  animation: none;
}

.dash-rate-point.is-rate-high .dash-rate-dot--buy {
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.dash-rate-point.is-rate-low .dash-rate-dot--buy {
  stroke: var(--fx-chart-bg);
  stroke-width: 2;
}

.fx-chart__meta--rates {
  padding: 0 1rem 0.5rem;
}

.fx-high-low-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  fill: var(--fx-chart-muted);
}

/* ── Scroll-triggered chart reveal (Intersection Observer) ── */
@keyframes fx-chart-draw-line {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fx-chart-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fx-chart-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fx-chart-bar-grow {
  from {
    opacity: 0;
    transform: scaleY(0);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes fx-chart-dot-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fx-chart-label-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hold chart motion until scrolled into view */
.fx-chart-reveal:not(.is-chart-inview) .dash-profit-day-dot,
.fx-chart-reveal:not(.is-chart-inview) .dash-profit-end-dot {
  opacity: 0 !important;
  animation: none !important;
}

/* Exchange rates — JS-driven line reveal; keep axes readable */
#dash-rates-chart-wrap:not(.is-chart-inview) .dash-line-buy,
#dash-rates-chart-wrap:not(.is-chart-inview) .dash-line-sell {
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
}

#dash-rates-chart-wrap:not(.is-chart-inview) .dash-rate-area-buy,
#dash-rates-chart-wrap:not(.is-chart-inview) .dash-rate-area-sell {
  opacity: 0;
}

#dash-rates-chart-wrap .fx-grid-line,
#dash-rates-chart-wrap .fx-axis-label {
  opacity: 1 !important;
  animation: none !important;
  transform: none !important;
}

#dash-rates-chart-wrap .dash-rate-dot {
  opacity: 1 !important;
  animation: none !important;
}

#dash-rates-chart-wrap.is-chart-inview .dash-line-buy,
#dash-rates-chart-wrap.is-chart-inview .dash-line-sell {
  animation: none !important;
}

/* Daily statistics — JS-driven line reveal; keep axes readable */
#dash-daily-trend-chart:not(.is-chart-inview) .dash-daily-line-buy,
#dash-daily-trend-chart:not(.is-chart-inview) .dash-daily-line-sell {
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
}

#dash-daily-trend-chart:not(.is-chart-inview) .dash-daily-area-buy,
#dash-daily-trend-chart:not(.is-chart-inview) .dash-daily-area-sell {
  opacity: 0;
}

#dash-daily-trend-chart .fx-grid-line,
#dash-daily-trend-chart .fx-axis-label {
  opacity: 1 !important;
  animation: none !important;
  transform: none !important;
}

#dash-daily-trend-chart.is-chart-inview .dash-daily-line-buy,
#dash-daily-trend-chart.is-chart-inview .dash-daily-line-sell {
  animation: none !important;
}

#dash-daily-trend-chart.fx-chart-reveal:not(.is-chart-inview) .fx-grid-line,
#dash-daily-trend-chart.fx-chart-reveal:not(.is-chart-inview) .fx-axis-label,
#dash-daily-trend-chart.fx-chart-reveal.is-chart-inview .fx-grid-line,
#dash-daily-trend-chart.fx-chart-reveal.is-chart-inview .fx-axis-label {
  opacity: 1 !important;
  animation: none !important;
}

.fx-chart-reveal:not(.is-chart-inview) .dash-profit-ogive-line.is-intro,
.fx-chart-reveal:not(.is-chart-inview) .dash-profit-ogive-area.is-intro {
  animation: none !important;
}

.fx-chart-reveal:not(.is-chart-inview) .dash-profit-ogive-line.is-intro {
  stroke-dasharray: var(--profit-line-len, 1200) !important;
  stroke-dashoffset: var(--profit-line-len, 1200) !important;
}

.fx-chart-reveal:not(.is-chart-inview) .dash-profit-ogive-area.is-intro {
  opacity: 0 !important;
}

.fx-chart-reveal:not(.is-chart-inview) .fx-grid-line {
  opacity: 0;
}

.fx-chart-reveal:not(.is-chart-inview) .fx-axis-label {
  opacity: 0;
}

#dash-rates-chart-wrap.fx-chart-reveal:not(.is-chart-inview) .fx-grid-line,
#dash-rates-chart-wrap.fx-chart-reveal:not(.is-chart-inview) .fx-axis-label {
  opacity: 1 !important;
}

.fx-chart-reveal:not(.is-chart-inview) .dash-currency-bar {
  opacity: 0;
  transform: scaleY(0);
  transform-origin: center bottom;
  transform-box: fill-box;
}

.fx-chart-reveal:not(.is-chart-inview) .dash-panel__profit-bar {
  opacity: 0;
  transform: scaleY(0);
  transform-origin: bottom center;
}

.fx-chart-reveal--stagger:not(.is-chart-inview) [data-fx-reveal-item] {
  opacity: 0;
  transform: translateY(12px);
}

/* Play when in view (!important beats dashboard inline load animations) */
.fx-chart-reveal.is-chart-inview .dash-profit-ogive-line.is-intro {
  animation: fx-chart-draw-line 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.06s forwards !important;
}

.fx-chart-reveal.is-chart-inview .dash-profit-ogive-area.is-intro {
  animation: fx-chart-fade-in 0.5s ease 0.1s forwards !important;
}

.fx-chart-reveal.is-chart-inview .dash-profit-day-dot {
  animation-name: fx-chart-dot-pop !important;
  animation-duration: 0.32s !important;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1) !important;
  animation-fill-mode: forwards !important;
}

.fx-chart-reveal.is-chart-inview .dash-profit-end-dot {
  animation: fx-chart-dot-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards !important;
}

.fx-chart-reveal.is-chart-inview .fx-grid-line {
  animation: fx-chart-fade-in 0.5s ease calc(0.05s + var(--fx-reveal-delay, 0s)) forwards !important;
}

.fx-chart-reveal.is-chart-inview .fx-axis-label {
  animation: fx-chart-label-in 0.45s ease calc(0.15s + var(--fx-reveal-delay, 0s)) forwards !important;
}

#dash-rates-chart-wrap.fx-chart-reveal.is-chart-inview .fx-grid-line,
#dash-rates-chart-wrap.fx-chart-reveal.is-chart-inview .fx-axis-label {
  opacity: 1 !important;
  animation: none !important;
}

/* Currency grid: smoother motion handled in JS (animateCurrencyGrid) */
.fx-chart-reveal--currency.is-chart-inview [data-fx-reveal-item],
.fx-chart-reveal--currency.is-chart-inview .dash-currency-bar {
  animation: none !important;
}

.fx-chart-reveal--currency:not(.is-chart-inview) [data-fx-reveal-item] {
  opacity: 0;
  transform: translateY(20px);
}

.fx-chart-reveal--currency:not(.is-chart-inview) .dash-currency-bar {
  opacity: 0;
  transform: scaleY(0);
  transform-origin: center bottom;
  transform-box: fill-box;
}

.fx-chart-reveal--stagger.is-chart-inview [data-fx-reveal-item] {
  animation: fx-chart-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) var(--fx-reveal-delay, 0s) both !important;
}

.fx-chart-reveal.is-chart-inview .dash-panel__profit-bar {
  animation: fx-chart-bar-grow 0.5s cubic-bezier(0.22, 1, 0.36, 1) var(--fx-reveal-delay, 0s) forwards !important;
}

.fx-chart-reveal.is-chart-inview .dash-panel__profit-bar-label {
  animation: fx-chart-label-in 0.4s ease calc(0.12s + var(--fx-reveal-delay, 0s)) forwards !important;
}

@media (max-width: 767px) {
  #dash-rates-chart-wrap.fx-chart__stage {
    min-height: 280px;
    height: 280px;
  }

  #dash-profit-chart-stage.fx-chart__stage {
    min-height: 308px;
    height: 308px;
  }

  .dash-root {
    --fx-chart-min-h: 280px;
    --fx-profit-chart-min-h: 308px;
  }

  .fx-chart__readout-value {
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-line-profit.is-intro,
  .dash-profit-ogive-line.is-intro,
  .fx-area-profit.is-intro,
  .dash-profit-ogive-area.is-intro,
  .dash-profit-day-dot,
  .dash-rate-dot,
  .fx-chart-reveal:not(.is-chart-inview) .dash-line-buy,
  .fx-chart-reveal:not(.is-chart-inview) .dash-line-sell {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
  }

  .fx-chart-reveal--stagger:not(.is-chart-inview) [data-fx-reveal-item],
  .fx-chart-reveal:not(.is-chart-inview) .dash-currency-bar,
  .fx-chart-reveal:not(.is-chart-inview) .dash-panel__profit-bar {
    opacity: 1 !important;
    transform: none !important;
  }

  .fx-chart__status--live::before {
    animation: none;
  }
}
