.funding-history-popover {
  position: fixed;
  z-index: 120;
  width: min(420px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: min(480px, calc(100vh - 16px));
  overflow: auto;
  padding: 14px;
  color: #dce8ec;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  background:
    linear-gradient(rgba(53, 212, 223, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 212, 223, 0.025) 1px, transparent 1px),
    linear-gradient(145deg, #102129 0%, #0a171d 72%);
  background-size: 18px 18px, 18px 18px, auto;
  border: 1px solid #2b4651;
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 7, 10, 0.58), 0 0 0 1px rgba(53, 212, 223, 0.05);
  animation: funding-history-in 140ms ease-out;
}

.funding-history-popover[hidden],
.funding-history-popover [hidden] {
  display: none !important;
}

.funding-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid #223a44;
}

.funding-history-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--cyan, #35d4df);
  font-family: "Azeret Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.funding-history-header h2 {
  margin: 0;
  color: #f3f8fa;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.funding-history-header p {
  margin: 4px 0 0;
  color: #8199a4;
  font-size: 10px;
}

.funding-history-ranges {
  display: flex;
  flex: 0 0 auto;
  padding: 2px;
  background: #08151a;
  border: 1px solid #29434e;
  border-radius: 7px;
}

.funding-history-ranges button {
  min-width: 38px;
  padding: 5px 8px;
  color: #78919d;
  font: 700 10px/1 "Azeret Mono", "SFMono-Regular", Consolas, monospace;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.funding-history-ranges button[aria-pressed="true"] {
  color: #061317;
  background: var(--cyan, #35d4df);
  box-shadow: 0 0 14px rgba(53, 212, 223, 0.2);
}

#skhx-funding-card:focus-visible,
#skhy-funding-card:focus-visible,
.funding-history-ranges button:focus-visible {
  outline: 2px solid var(--cyan, #35d4df);
  outline-offset: 3px;
}

.funding-history-legend {
  display: grid;
  gap: 6px;
  margin: 10px 0 8px;
}

.funding-history-legend > div {
  display: grid;
  grid-template-columns: 10px minmax(88px, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 6px 8px;
  color: #79919c;
  font: 500 10px/1.2 "Azeret Mono", "SFMono-Regular", Consolas, monospace;
  background: rgba(5, 16, 21, 0.7);
  border: 1px solid #1d343e;
  border-radius: 6px;
}

.funding-history-legend b {
  color: #dce8ec;
  font-size: 11px;
}

.funding-history-legend strong {
  color: #c7d8de;
  font-weight: 650;
}

.funding-history-swatch {
  width: 9px;
  height: 3px;
  border-radius: 4px;
}

.funding-history-legend [data-tone="cyan"] .funding-history-swatch {
  background: linear-gradient(90deg, var(--cyan, #35d4df), #49d17d);
}

.funding-history-legend [data-tone="amber"] .funding-history-swatch {
  background: linear-gradient(90deg, var(--amber, #f0b64d), #6ea8ff);
}

.funding-history-chart-panel {
  min-height: 176px;
  padding: 4px 0 0;
  border-top: 1px solid rgba(53, 212, 223, 0.08);
}

.funding-history-chart {
  width: 100%;
  min-height: 176px;
}

.funding-history-state {
  display: grid;
  min-height: 176px;
  margin: 0;
  place-items: center;
  color: #8ba0a9;
  font-size: 12px;
  text-align: center;
  border: 1px dashed #29434e;
  border-radius: 7px;
}

.funding-history-popover[data-status="error"] .funding-history-state {
  color: var(--coral, #ff6f61);
  border-color: rgba(255, 111, 97, 0.38);
}

@keyframes funding-history-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .funding-history-popover {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px);
    padding: 12px;
  }

  .funding-history-header {
    gap: 8px;
  }

  .funding-history-legend > div {
    grid-template-columns: 10px minmax(76px, 1fr) auto;
  }

  .funding-history-legend > div span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .funding-history-popover {
    animation: none;
    scroll-behavior: auto;
  }
}
