/* Pair-dashboard SVG charts use the shared FXMacroData colour tokens. */
.bb-page .fxd-card-section .grid:has(> div > .chart-container.fxmd-svg-host),
.bb-page .fxd-card-section .grid:has(> div > div > .chart-container.fxmd-svg-host) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr)) !important;
}
.bb-page .fxd-card-section .grid > div:has(.chart-container.fxmd-svg-host),
.bb-page .fxd-card-section .mt-6 > div:has(.chart-container.fxmd-svg-host) {
  min-width: 0;
  height: auto !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.bb-page .fxd-card-section div:has(> .chart-header ~ .chart-container.fxmd-svg-host) {
  min-width: 0;
  height: auto !important;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--fxmd-border);
  border-radius: 18px;
  background: var(--fxmd-page-bg);
  box-shadow: none;
}
.bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 0;
  padding: 14px 28px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) > div:first-child {
  flex: 1 1 180px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--fxmd-text) !important;
}
.bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) > div:first-child::before { display: none; }
.bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) .chart-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) .chart-action-btn {
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--fxmd-border);
  border-radius: 8px;
  color: var(--fxmd-text);
  background: var(--fxmd-surface);
  font-size: 12px;
  box-shadow: none;
}
.bb-page .fxd-card-section .chart-container.fxmd-svg-host {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.bb-page .fxd-card-section .chart-container.fxmd-svg-host + .fxd-source-note {
  margin: 0;
  padding: 12px 28px 18px;
  border: 0;
  border-top: 1px solid var(--fxmd-border);
  border-radius: 0;
  color: var(--fxmd-text-muted);
  background: transparent;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.bb-page .fxd-card-section .chart-container.fxmd-svg-host + .fxd-source-note code { font-size: inherit; }
.chart-container.fxmd-svg-host,
.chart-container.fxmd-svg-host .fxmd-svg-mount {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
}
.chart-container.fxmd-svg-host .fxmd-svg-mount { width: 100%; max-width: 100%; min-width: 0; }
.fxmd-svg-panel {
  container: fxmd-svg-chart / inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 18px 0 0;
  border-radius: 0;
  color: var(--fxmd-text-strong);
  background: var(--fxmd-page-bg);
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
}
.fxmd-svg-panel *, .fxmd-svg-panel *::before, .fxmd-svg-panel *::after { box-sizing: border-box; }
.fxmd-svg-panel[hidden], .fxmd-svg-panel [hidden] { display: none !important; }
.fxmd-svg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 0 28px;
}
.fxmd-svg-pair { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fxmd-svg-pair-heading { min-width: 0; }
.fxmd-svg-pair-heading .fxmd-svg-value-label { margin: 2px 0 0; }
.fxmd-svg-pair-mark { display: flex; flex: 0 0 auto; width: 64px; height: 43px; }
.fxmd-svg-pair-mark span {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--fxmd-cyan) 50%, transparent);
  border-radius: 50%;
  color: var(--fxmd-cyan);
  background: var(--fxmd-surface);
  font: 600 10px/1 'Space Grotesk', sans-serif;
  letter-spacing: .015em;
}
.fxmd-svg-pair-mark span + span { margin: 5px 0 0 -12px; border-color: color-mix(in srgb, var(--fxmd-amber) 45%, transparent); color: var(--fxmd-amber); }
.fxmd-svg-title {
  margin: 0;
  color: var(--fxmd-text-strong);
  font: 600 21px/1.25 'Space Grotesk', sans-serif;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.fxmd-svg-meta {
  color: var(--fxmd-text);
  font: 400 12px/1.4 'Space Grotesk', sans-serif;
  overflow-wrap: anywhere;
}
.fxmd-svg-header > .fxmd-svg-meta { text-align: right; }
.fxmd-svg-values {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 28px;
  min-width: 0;
  padding: 16px 28px 0;
}
.fxmd-svg-value { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.fxmd-svg-value-label {
  margin-bottom: 4px;
  color: var(--fxmd-text);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.fxmd-svg-rate {
  display: block;
  max-width: 100%;
  color: var(--fxmd-text-strong);
  font: 500 57px/1.05 'Space Grotesk', sans-serif;
  letter-spacing: -0.06em;
  overflow-wrap: anywhere;
}
.fxmd-svg-unit {
  margin-left: 7px;
  color: var(--fxmd-text);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}
.fxmd-svg-change {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
  color: var(--fxmd-text);
  font-size: 13px;
  line-height: 1.4;
}
.fxmd-svg-change[data-direction='positive'] { color: var(--fxmd-mint); }
.fxmd-svg-change[data-direction='negative'] { color: var(--fxmd-magenta); }
.fxmd-svg-change .fxmd-svg-meta { color: var(--fxmd-text); }
.fxmd-svg-plot {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 280px;
  margin-top: 14px;
  background: var(--fxmd-page-bg);
}
.fxmd-svg-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  touch-action: pan-y;
}
.fxmd-svg-canvas text {
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
}
.fxmd-svg-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
  min-width: 0;
  margin: 0 28px;
  padding: 15px 0 0;
  border-top: 1px solid var(--fxmd-border);
}
.fxmd-svg-series {
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 5px 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 56px;
  padding: 4px 0;
  border: 0;
  border-radius: 3px;
  color: var(--fxmd-text-strong);
  background: transparent;
  font: 500 12px/1.3 'Space Grotesk', sans-serif;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.fxmd-svg-series[aria-pressed='false'] { color: var(--fxmd-text-muted); text-decoration: line-through; }
.fxmd-svg-series[aria-pressed='false'] .fxmd-svg-swatch { opacity: .35; }
.fxmd-svg-series:hover { color: var(--fxmd-cyan); }
.fxmd-svg-series-label { grid-column: 2; grid-row: 1; min-width: 0; }
.fxmd-svg-swatch { display: block; grid-column: 1; grid-row: 1; width: 17px; height: 3px; border-radius: 3px; background: var(--series-color, currentColor); }
.fxmd-svg-series[data-axis='y2'] .fxmd-svg-swatch,
.fxmd-svg-swatch[data-dashed='true'] { background: repeating-linear-gradient(to right, var(--series-color, currentColor) 0 6px, transparent 6px 9px); }
.fxmd-svg-series-value { grid-column: 2; grid-row: 2; min-width: 0; color: var(--fxmd-text-strong); font: 500 17px/1.3 'IBM Plex Mono', monospace; overflow-wrap: anywhere; }
.fxmd-svg-series:focus-visible,
.fxmd-svg-canvas:focus-visible,
.fxmd-svg-ranges button:focus-visible { outline: 2px solid var(--fxmd-cyan); outline-offset: 2px; }
.fxmd-svg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 12px;
  min-width: 0;
  margin: 12px 28px 0;
  padding-bottom: 18px;
  color: var(--fxmd-text);
  font-size: 11px;
  line-height: 1.4;
}
.fxmd-svg-ranges {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--fxmd-border);
  border-radius: var(--fxmd-radius);
  background: var(--fxmd-surface);
}
.fxmd-svg-ranges button {
  min-width: 44px;
  min-height: 44px;
  padding: 4px 7px;
  border: 0;
  border-radius: 5px;
  color: var(--fxmd-text);
  background: transparent;
  font: 500 12px 'Space Grotesk', sans-serif;
  cursor: pointer;
}
.fxmd-svg-ranges button[aria-pressed='true'] { color: var(--fxmd-cta-ink); background: linear-gradient(135deg, var(--fxmd-cyan), var(--fxmd-mint)); }
.fxmd-svg-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  top: 8px;
  min-width: 110px;
  max-width: min(280px, calc(100% - 24px));
  padding: 10px 12px;
  border: 1px solid var(--fxmd-border-strong);
  border-radius: var(--fxmd-radius);
  color: var(--fxmd-text-strong);
  background: var(--fxmd-surface);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--fxmd-ink-black) 45%, transparent);
  font: 400 12px/1.4 'Space Grotesk', sans-serif;
  overflow-wrap: anywhere;
}
.fxmd-svg-tooltip strong { display: block; margin-bottom: 3px; font-size: 17px; line-height: 1.25; font-weight: 600; }
.fxmd-svg-tooltip span { color: var(--fxmd-text); }
.fxmd-svg-tooltip-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 3px 12px; padding-top: 7px; }
.fxmd-svg-tooltip-row > strong { margin: 0; font-size: 15px; }
.fxmd-svg-tooltip-row > .fxmd-svg-meta { grid-column: 1 / -1; }
@container fxmd-svg-chart (max-width: 500px) {
  .fxmd-svg-header { gap: 8px; padding: 0 18px; }
  .fxmd-svg-title { font-size: 20px; }
  .fxmd-svg-header > .fxmd-svg-meta { max-width: 95px; font-size: 11px; }
  .fxmd-svg-pair { gap: 9px; }
  .fxmd-svg-pair-mark { width: 57px; height: 40px; }
  .fxmd-svg-pair-mark span { width: 34px; height: 34px; flex-basis: 34px; }
  .fxmd-svg-pair-mark span + span { margin-left: -11px; }
  .fxmd-svg-values { gap: 11px 20px; padding: 18px 18px 0; }
  .fxmd-svg-rate { font-size: 44px; }
  .fxmd-svg-unit { margin-left: 5px; font-size: 13px; }
  .fxmd-svg-value-label, .fxmd-svg-change { font-size: 12px; }
  .fxmd-svg-plot { height: 270px; margin-top: 14px; }
  .fxmd-svg-legend { gap: 12px; margin: 0 18px; padding-top: 13px; }
  .fxmd-svg-series { grid-template-columns: minmax(0, 1fr); align-items: start; align-content: start; gap: 8px; font-size: 11px; }
  .fxmd-svg-swatch { grid-column: 1; grid-row: 1; }
  .fxmd-svg-series-label { grid-column: 1; grid-row: 2; }
  .fxmd-svg-series-value { grid-column: 1; grid-row: 3; font-size: 17px; }
  .fxmd-svg-footer { margin: 12px 18px 0; padding-bottom: 18px; }
}
@container fxmd-svg-chart (max-width: 340px) {
  .fxmd-svg-header { gap: 6px; }
  .fxmd-svg-header > .fxmd-svg-meta { max-width: 78px; font-size: 10px; }
  .fxmd-svg-title { font-size: 19px; }
  .fxmd-svg-legend { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fxmd-svg-series { grid-template-columns: 17px minmax(0, 1fr) auto; align-items: center; min-height: 44px; }
  .fxmd-svg-series-label { grid-column: 2; grid-row: 1; }
  .fxmd-svg-series-value { grid-column: 3; grid-row: 1; }
}
@media (max-width: 640px) {
  .bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) { gap: 12px; padding: 16px 18px 0; }
  .bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) > div:first-child { flex-basis: 100%; font-size: 13px; }
  .bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) .chart-actions { width: 100%; gap: 6px; }
  .bb-page .fxd-card-section .chart-header:has(~ .chart-container.fxmd-svg-host) .chart-action-btn { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 11px; }
  .bb-page .fxd-card-section .chart-container.fxmd-svg-host + .fxd-source-note { padding: 12px 18px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .fxmd-svg-panel *, .fxmd-svg-panel *::before, .fxmd-svg-panel *::after { transition: none; animation: none; }
}
