.buy-popover-root {
  position: fixed;
  inset: 0;
  z-index: 1300;
  pointer-events: none;
}

.buy-popover-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: rgba(2, 8, 18, 0.3);
}

.buy-popover-panel {
  position: absolute;
  min-width: 280px;
  max-width: min(92vw, 360px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(9, 12, 24, 0.98);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.5);
  padding: 14px;
  color: #f3f6ff;
  pointer-events: auto;
}

.buy-popover-panel[data-placement="bottom"]::before,
.buy-popover-panel[data-placement="top"]::before {
  content: "";
  position: absolute;
  left: var(--arrow-left, 18px);
  width: 12px;
  height: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(9, 12, 24, 0.98);
}

.buy-popover-panel[data-placement="bottom"]::before {
  top: -7px;
  transform: rotate(45deg);
}

.buy-popover-panel[data-placement="top"]::before {
  bottom: -7px;
  transform: rotate(225deg);
}

.buy-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.buy-popover-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}

.buy-popover-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.buy-popover-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.buy-popover-field-label {
  display: block;
  font-size: 0.78rem;
  opacity: 0.82;
  margin-bottom: 6px;
}

.buy-popover-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.buy-popover-amount {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  padding: 10px 11px;
  font-size: 1rem;
}

.buy-popover-amount:focus {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

.buy-popover-unit {
  font-size: 0.8rem;
  opacity: 0.85;
}

.buy-popover-presets {
  display: flex;
  gap: 7px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}

.buy-popover-presets .btn {
  padding: 4px 9px;
}

.buy-popover-summary {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.buy-popover-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.83rem;
}

.buy-popover-summary-row strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.buy-popover-status {
  min-height: 1.2em;
  font-size: 0.77rem;
  opacity: 0.9;
  margin: 0 0 10px;
}

.buy-popover-status.is-error {
  color: #ff9aa2;
}

.buy-popover-actions {
  display: flex;
  gap: 8px;
}

.buy-popover-actions .btn {
  flex: 1;
}

@media (max-width: 820px) {
  .buy-popover-panel {
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: 10px !important;
    max-width: none;
    width: auto !important;
  }

  .buy-popover-panel::before {
    display: none;
  }
}
