.p2p-page {
  /* Neutral (no blue tint) dark palette for the P2P page. */
  --text: #e7e9ee;
  --muted: #9aa4b2;
  --border: rgba(255, 255, 255, 0.09);

  --p2p-surface-1: rgba(18, 20, 24, 0.94);
  --p2p-surface-2: rgba(14, 16, 19, 0.72);
  --p2p-surface-3: rgba(12, 13, 15, 0.56);
  --p2p-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);

  --p2p-btn-border: rgba(255, 255, 255, 0.14);
  --p2p-btn-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  --p2p-btn-text: var(--text);

  --p2p-link-underline: rgba(148, 163, 184, 0.36);
  --p2p-link-hover: #e2e8f0;

  --p2p-accent: #94a3b8;
}

body.light.p2p-page {
  --text: #0f172a;
  --muted: #475569;
  --border: rgba(15, 23, 42, 0.14);

  --p2p-surface-1: #ffffff;
  --p2p-surface-2: #ffffff;
  --p2p-surface-3: #f8fafc;
  --p2p-shadow: none;

  --p2p-btn-border: rgba(15, 23, 42, 0.16);
  --p2p-btn-bg: linear-gradient(180deg, #ffffff, #f1f5f9);
  --p2p-btn-text: #0f172a;

  --p2p-link-underline: rgba(15, 23, 42, 0.24);
  --p2p-link-hover: #0f172a;

  --p2p-accent: #0f172a;
}

.p2p-page .container {
  max-width: 1240px;
}

.p2p-shell {
  background: transparent;
  transition: opacity 0.22s ease;
}

.p2p-shell.is-fetching .p2p-summary-grid,
.p2p-shell.is-fetching .p2p-columns,
.p2p-shell.is-fetching .p2p-history-card {
  opacity: 0.86;
  transition: opacity 0.22s ease;
}

.p2p-alerts-page .p2p-shell {
  max-width: 1060px;
  margin: 0 auto;
}

.p2p-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background:
    radial-gradient(140% 180% at 100% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    linear-gradient(145deg, rgba(18, 20, 24, 0.94), rgba(14, 16, 19, 0.9));
  box-shadow: var(--p2p-shadow);
  margin-bottom: 12px;
}

.p2p-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p2p-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted, #95a2b3);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.p2p-back-link:hover,
.p2p-back-link:focus {
  color: var(--text, #e8ecf1);
  text-decoration: none;
}

.p2p-title {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text, #e8ecf1);
}

.p2p-live-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.15);
  color: #7ef3b6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.p2p-subtitle {
  margin: 7px 0 0;
  color: var(--muted, #95a2b3);
}

.p2p-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: rgba(12, 13, 15, 0.6);
  color: var(--text, #e8ecf1);
  font-size: 13px;
}

.p2p-meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #95a2b3);
}

.p2p-mode-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  margin-bottom: 10px;
}

.p2p-mode-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.p2p-open-alerts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--p2p-btn-border, rgba(255,255,255,0.14));
  background: var(--p2p-btn-bg);
  color: var(--text, #e8ecf1);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.p2p-open-alerts-btn:hover,
.p2p-open-alerts-btn:focus {
  color: var(--text, #e8ecf1);
  text-decoration: none;
  filter: brightness(1.06);
}

.p2p-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  min-width: 220px;
}

.p2p-mode-btn {
  height: 32px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #95a2b3);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.p2p-mode-btn.active {
  color: var(--text, #e8ecf1);
  border-color: var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-btn-bg);
}

.p2p-mode-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #95a2b3);
  text-align: left;
}

.p2p-toolbar {
  display: grid;
  grid-template-columns:
    minmax(110px, 0.95fr)
    minmax(120px, 0.95fr)
    minmax(90px, 0.8fr)
    minmax(220px, 2fr)
    minmax(180px, 1.2fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.p2p-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.p2p-field span {
  font-size: 12px;
  color: var(--muted, #95a2b3);
  letter-spacing: 0.03em;
}

.p2p-field select,
.p2p-field input {
  width: 100%;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--text, #e8ecf1);
  padding: 0 12px;
  font-size: 14px;
}

.p2p-field-amount {
  grid-column: auto;
}

.p2p-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--text, #e8ecf1);
  padding: 0 12px;
  font-size: 13px;
  width: 100%;
  line-height: 1;
  align-self: end;
}

.p2p-toggle input {
  accent-color: var(--p2p-accent);
}

.p2p-alerts-card {
  border-radius: 16px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(145deg, rgba(21, 23, 26, 0.92), rgba(16, 18, 20, 0.86));
  padding: 10px;
  margin-bottom: 10px;
}

.p2p-alerts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.p2p-alerts-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #e8ecf1);
}

.p2p-alerts-actions {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.p2p-alert-permission-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

.p2p-alert-permission-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.p2p-alert-permission {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  color: var(--muted, #95a2b3);
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
}

.p2p-alert-permission.granted {
  color: #7ef3b6;
  border-color: rgba(34, 197, 94, 0.45);
}

.p2p-alert-permission.warn {
  color: #f6c26b;
  border-color: rgba(245, 158, 11, 0.45);
}

.p2p-alert-permission.blocked {
  color: #ff8f93;
  border-color: rgba(239, 68, 68, 0.45);
}

.p2p-alert-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--p2p-btn-border, rgba(255,255,255,0.14));
  background: var(--p2p-btn-bg);
  color: var(--p2p-btn-text, #e8ecf1);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.p2p-alert-btn:hover {
  filter: brightness(1.06);
}

.p2p-alert-btn-primary {
  border-color: rgba(96, 165, 250, 0.5);
  color: #bfdbfe;
}

.p2p-alert-btn-danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.p2p-alert-form {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: end;
}

.p2p-alert-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.p2p-alert-field span {
  font-size: 10px;
  color: var(--muted, #95a2b3);
  display: block;
  min-height: 13px;
  line-height: 13px;
}

.p2p-alert-field select,
.p2p-alert-field input:not([type="checkbox"]) {
  width: 100%;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--text, #e8ecf1);
  padding: 0 9px;
  font-size: 12.5px;
}

.p2p-alert-field-wide,
.p2p-alert-field-op {
  grid-column: span 2;
}

.p2p-alert-op-wrap {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px;
}

.p2p-alert-actions-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.p2p-alert-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  padding: 0 10px;
  color: var(--text, #e8ecf1);
  font-size: 12.5px;
}

.p2p-alert-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--p2p-accent);
}

.p2p-alert-feedback {
  min-height: 20px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted, #95a2b3);
  line-height: 1.35;
  white-space: pre-line;
}

.p2p-alert-feedback.error {
  color: #ff8f93;
}

.p2p-alert-feedback.ok {
  color: #7ef3b6;
}

.p2p-alert-permission-help {
  display: none;
  width: min(460px, 100%);
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--muted, #95a2b3);
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-line;
}

.p2p-alert-permission-help.is-visible {
  display: block;
}

.p2p-alert-permission-help.warn {
  color: #f6c26b;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.p2p-alert-permission-help.error {
  color: #ffb4b8;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.p2p-alert-permission-help.ok {
  color: #7ef3b6;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.p2p-alert-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  gap: 10px;
  align-items: start;
}

.p2p-alert-column {
  min-width: 0;
}

.p2p-alert-column-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #95a2b3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.p2p-alert-list {
  display: grid;
  gap: 8px;
}

.p2p-alert-fired-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
  padding-right: 2px;
}

.p2p-alert-empty {
  border: 1px dashed var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--muted, #95a2b3);
  font-size: 12px;
}

.p2p-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--p2p-surface-3);
}

.p2p-alert-item.is-disabled {
  opacity: 0.6;
}

.p2p-alert-item-main {
  min-width: 0;
}

.p2p-alert-item-title {
  color: var(--text, #e8ecf1);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.p2p-alert-item-meta {
  margin-top: 2px;
  color: var(--muted, #95a2b3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-alert-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.p2p-alert-mini-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted, #95a2b3);
  font-size: 12px;
}

.p2p-alert-mini-btn {
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--text, #e8ecf1);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.p2p-alert-submit-btn {
  width: auto;
  min-width: 220px;
  height: 32px;
  padding: 0 18px;
}

.p2p-alert-fire-item {
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--p2p-surface-3);
}

.p2p-alert-fire-item.is-test {
  border-color: rgba(96, 165, 250, 0.38);
}

.p2p-alert-fire-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.p2p-alert-fire-title {
  min-width: 0;
  color: var(--text, #e8ecf1);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-alert-fire-time {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted, #95a2b3);
}

.p2p-alert-fire-meta {
  margin-top: 2px;
  color: var(--muted, #95a2b3);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.p2p-status {
  min-height: 26px;
  display: flex;
  align-items: center;
  padding: 4px 2px 8px;
  font-size: 13px;
  color: var(--muted, #95a2b3);
}

.p2p-status.is-loading::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.55);
  border-top-color: transparent;
  animation: p2pSpin 0.85s linear infinite;
}

.p2p-status.error {
  color: #ff8f93;
}

.p2p-status.cached {
  color: #f6c26b;
}

.p2p-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.p2p-read-hint {
  margin: -2px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-3);
  color: var(--muted, #95a2b3);
  font-size: 12.5px;
  line-height: 1.45;
}

.p2p-read-hint strong {
  color: var(--text, #e8ecf1);
}

.p2p-summary-card {
  border-radius: 16px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(145deg, rgba(21, 23, 26, 0.92), rgba(16, 18, 20, 0.86));
  padding: 14px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.p2p-summary-card.is-loading .p2p-price,
.p2p-summary-card.is-loading .p2p-meta {
  color: transparent !important;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.16) 0%,
    rgba(148, 163, 184, 0.28) 50%,
    rgba(148, 163, 184, 0.16) 100%
  );
  background-size: 220% 100%;
  animation: p2pShimmer 1.25s ease-in-out infinite;
}

.p2p-summary-card.is-loading .p2p-price {
  min-height: 34px;
}

.p2p-summary-card.is-loading .p2p-meta {
  min-height: 16px;
}

.p2p-summary-card.is-fresh {
  animation: p2pPopIn 0.3s ease;
}

.p2p-summary-card h2 {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #95a2b3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.p2p-price {
  margin-top: 8px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  color: var(--text, #e8ecf1);
}

.p2p-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted, #95a2b3);
}

.p2p-buy .p2p-price,
.p2p-buy .p2p-meta strong {
  color: #30d181;
}

.p2p-sell .p2p-price,
.p2p-sell .p2p-meta strong {
  color: #ff7e80;
}

.p2p-spread .p2p-price.positive {
  color: #30d181;
}

.p2p-spread .p2p-price.negative {
  color: #ff7e80;
}

.p2p-history-card {
  border-radius: 16px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(145deg, rgba(21, 23, 26, 0.92), rgba(16, 18, 20, 0.86));
  padding: 12px;
  margin-bottom: 14px;
}

.p2p-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.p2p-history-title {
  margin: 0;
  font-size: 16px;
  color: var(--text, #e8ecf1);
}

.p2p-history-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted, #95a2b3);
}

.p2p-history-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
}

.p2p-history-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p2p-history-field span {
  font-size: 11px;
  color: var(--muted, #95a2b3);
  letter-spacing: 0.03em;
}

.p2p-history-field select {
  width: 100%;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-2);
  color: var(--text, #e8ecf1);
  padding: 0 10px;
  font-size: 13px;
}

.p2p-history-chart {
  position: relative;
  width: 100%;
  height: 420px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--p2p-surface-3);
  overflow: hidden;
}

.p2p-history-empty {
  margin-top: 8px;
  color: var(--muted, #95a2b3);
  font-size: 13px;
}

.p2p-history-legend {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted, #95a2b3);
  overflow-x: auto;
}

.p2p-history-legend span {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.p2p-history-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.p2p-history-legend .dot-buy { background: #30d181; }
.p2p-history-legend .dot-sell { background: #ff7e80; }
.p2p-history-hover {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.p2p-history-hover.is-hidden {
  display: none;
}

.p2p-history-hover-label {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(8, 11, 16, 0.86);
  color: #e7e9ee;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transform: translate(-9999px, -9999px);
}

.p2p-history-hover-label.buy {
  border-color: rgba(48, 209, 129, 0.55);
  color: #8df0c2;
}

.p2p-history-hover-label.sell {
  border-color: rgba(255, 126, 128, 0.55);
  color: #ffb0b1;
}

.p2p-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.p2p-column {
  border-radius: 16px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: linear-gradient(145deg, rgba(21, 23, 26, 0.92), rgba(16, 18, 20, 0.86));
  padding: 12px;
}

.p2p-column-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #e8ecf1);
}

.p2p-exchange-list {
  display: grid;
  gap: 10px;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.p2p-exchange-list.is-rendering {
  opacity: 0.25;
  transform: translateY(10px);
}

.p2p-exchange-card {
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  background: var(--p2p-surface-3);
  overflow: hidden;
  position: relative;
  animation: p2pFadeInUp 0.3s ease both;
}

.p2p-exchange-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: var(--p2p-ex-gradient, transparent);
  opacity: 0.35;
  pointer-events: none;
}

.p2p-exchange-card > * {
  position: relative;
  z-index: 1;
}

.p2p-exchange-card.ex-binance { --p2p-ex-gradient: linear-gradient(135deg, rgba(240,185,11,0.22), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-bybit { --p2p-ex-gradient: linear-gradient(135deg, rgba(255,210,77,0.18), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-okx { --p2p-ex-gradient: linear-gradient(135deg, rgba(220,230,255,0.14), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-bingx { --p2p-ex-gradient: linear-gradient(135deg, rgba(0,134,255,0.18), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-gate { --p2p-ex-gradient: linear-gradient(135deg, rgba(56,120,255,0.16), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-mexc { --p2p-ex-gradient: linear-gradient(135deg, rgba(77,179,255,0.16), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-bitget { --p2p-ex-gradient: linear-gradient(135deg, rgba(0,200,255,0.16), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-htx { --p2p-ex-gradient: linear-gradient(135deg, rgba(53,215,207,0.16), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-kucoin { --p2p-ex-gradient: linear-gradient(135deg, rgba(0,190,120,0.18), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-ourbit { --p2p-ex-gradient: linear-gradient(135deg, rgba(0,200,170,0.18), rgba(0,0,0,0) 70%); }
.p2p-exchange-card.ex-whitebit { --p2p-ex-gradient: linear-gradient(135deg, rgba(70,120,255,0.16), rgba(0,0,0,0) 70%); }

.p2p-skeleton-card {
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 10px;
  background: var(--p2p-surface-3);
  position: relative;
  overflow: hidden;
}

.p2p-skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0) 0%,
    rgba(148, 163, 184, 0.18) 45%,
    rgba(148, 163, 184, 0) 100%
  );
  background-size: 220% 100%;
  animation: p2pShimmer 1.25s ease-in-out infinite;
}

.p2p-skeleton-row {
  height: 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.14);
  margin-bottom: 8px;
}

.p2p-skeleton-row:last-child {
  margin-bottom: 0;
}

.p2p-skeleton-row.w-30 { width: 30%; }
.p2p-skeleton-row.w-45 { width: 45%; }
.p2p-skeleton-row.w-60 { width: 60%; }
.p2p-skeleton-row.w-80 { width: 80%; }

.p2p-ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}

.p2p-ex-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.p2p-ex-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.p2p-ex-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #e8ecf1);
  text-transform: capitalize;
}

.p2p-ex-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--p2p-link-underline);
}

.p2p-ex-link:hover,
.p2p-ex-link:focus {
  color: var(--p2p-link-hover);
  text-decoration: none;
  border-bottom-color: var(--p2p-link-underline);
}

.p2p-ex-best {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #e8ecf1);
}

.p2p-ex-meta {
  font-size: 12px;
  color: var(--muted, #95a2b3);
}

.p2p-ex-error {
  color: #ff8f93;
  font-size: 12px;
}

.p2p-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.p2p-table th,
.p2p-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--text, #e8ecf1);
  vertical-align: middle;
}

.p2p-table th {
  color: var(--muted, #95a2b3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}

.p2p-table tr:last-child td {
  border-bottom: none;
}

.p2p-table .num {
  text-align: right;
  white-space: nowrap;
}

.p2p-table .limit .limit-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.p2p-table .merchant {
  max-width: 220px;
}

.p2p-table .merchant .merchant-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.p2p-table .pay {
  color: var(--muted, #95a2b3);
}

.p2p-table .pay .pay-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

.p2p-empty {
  padding: 13px;
  font-size: 13px;
  color: var(--muted, #95a2b3);
}

.p2p-table th:nth-child(1),
.p2p-table td:nth-child(1) { width: 5%; }
.p2p-table th:nth-child(2),
.p2p-table td:nth-child(2) { width: 11%; }
.p2p-table th:nth-child(3),
.p2p-table td:nth-child(3) { width: 20%; }
.p2p-table th:nth-child(4),
.p2p-table td:nth-child(4) { width: 14%; }
.p2p-table th:nth-child(5),
.p2p-table td:nth-child(5) { width: 16%; }
.p2p-table th:nth-child(6),
.p2p-table td:nth-child(6) { width: 22%; }
.p2p-table th:nth-child(7),
.p2p-table td:nth-child(7) { width: 12%; }

body.light .p2p-hero,
body.light .p2p-summary-card,
body.light .p2p-history-card,
body.light .p2p-column,
body.light .p2p-exchange-card,
body.light .p2p-alerts-card {
  background: var(--p2p-surface-1);
  border-color: var(--border);
  box-shadow: var(--p2p-shadow);
}

body.light .p2p-exchange-card::before {
  opacity: 0.18;
}

body.light .p2p-field select,
body.light .p2p-field input,
body.light .p2p-alert-field select,
body.light .p2p-alert-field input,
body.light .p2p-history-field select,
body.light .p2p-toggle,
body.light .p2p-mode-switch,
body.light .p2p-alert-check,
body.light .p2p-alert-mini-btn,
body.light .p2p-alert-item,
body.light .p2p-alert-fire-item {
  background: var(--p2p-surface-2);
  border-color: var(--border);
  color: var(--text);
}

body.light .p2p-meta-pill {
  background: var(--p2p-surface-3);
}

body.light .p2p-table th,
body.light .p2p-table td {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light .p2p-title,
body.light .p2p-column-title,
body.light .p2p-summary-card h2,
body.light .p2p-alerts-title,
body.light .p2p-table th,
body.light .p2p-table td,
body.light .p2p-ex-name,
body.light .p2p-ex-best,
body.light .p2p-meta-pill,
body.light .p2p-price {
  color: var(--text);
}

body.light .p2p-subtitle,
body.light .p2p-status,
body.light .p2p-meta,
body.light .p2p-alert-field span,
body.light .p2p-alert-feedback,
body.light .p2p-alert-item-meta,
body.light .p2p-alert-column-title,
body.light .p2p-alert-fire-meta,
body.light .p2p-alert-fire-time,
body.light .p2p-ex-meta,
body.light .p2p-table .pay,
body.light .p2p-field span,
body.light .p2p-history-subtitle,
body.light .p2p-history-field span,
body.light .p2p-history-empty,
body.light .p2p-history-legend {
  color: var(--muted);
}

body.light .p2p-ex-link {
  border-bottom-color: var(--p2p-link-underline);
}

body.light .p2p-ex-link:hover,
body.light .p2p-ex-link:focus {
  color: var(--p2p-link-hover);
  border-bottom-color: var(--p2p-link-underline);
}

body.light .p2p-history-hover-label {
  border-color: rgba(15, 23, 42, 0.2);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

body.light .p2p-status.is-loading::after {
  border-color: rgba(100, 116, 139, 0.45);
  border-top-color: transparent;
}

@keyframes p2pSpin {
  to { transform: rotate(360deg); }
}

@keyframes p2pShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -20% 0; }
}

@keyframes p2pFadeInUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes p2pPopIn {
  0% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .p2p-shell,
  .p2p-shell.is-fetching .p2p-summary-grid,
  .p2p-shell.is-fetching .p2p-columns,
  .p2p-shell.is-fetching .p2p-history-card,
  .p2p-summary-card,
  .p2p-exchange-list,
  .p2p-exchange-card {
    transition: none;
    animation: none;
  }

  .p2p-status.is-loading::after,
  .p2p-skeleton-card::after,
  .p2p-summary-card.is-loading .p2p-price,
  .p2p-summary-card.is-loading .p2p-meta {
    animation: none;
  }
}

body.light.p2p-alerts-page .p2p-alerts-card {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-color: #cbd5e1;
  box-shadow: none;
}

body.light.p2p-alerts-page .p2p-alert-field select,
body.light.p2p-alerts-page .p2p-alert-field input:not([type="checkbox"]),
body.light.p2p-alerts-page .p2p-alert-check,
body.light.p2p-alerts-page .p2p-alert-mini-btn {
  background: #ffffff;
  border-color: #cbd5e1;
}

body.light.p2p-alerts-page .p2p-alert-item,
body.light.p2p-alerts-page .p2p-alert-fire-item {
  background: #ffffff;
  border-color: #cfd8e3;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

body.light.p2p-alerts-page .p2p-alert-permission {
  background: #ffffff;
  border-color: #cbd5e1;
}

body.light.p2p-alerts-page .p2p-alert-permission.granted {
  color: #15803d;
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(22, 163, 74, 0.38);
}

body.light.p2p-alerts-page .p2p-alert-permission-help {
  background: rgba(226, 232, 240, 0.55);
  border-color: rgba(148, 163, 184, 0.28);
  color: #475569;
}

body.light.p2p-alerts-page .p2p-alert-permission-help.warn {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
}

body.light.p2p-alerts-page .p2p-alert-permission-help.error {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.1);
}

body.light.p2p-alerts-page .p2p-alert-permission-help.ok {
  color: #166534;
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.1);
}

body.light.p2p-alerts-page .p2p-alert-btn {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-color: #cbd5e1;
  color: #0f172a;
}

body.light.p2p-alerts-page .p2p-alert-btn-primary {
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  border-color: #93c5fd;
  color: #1e3a8a;
}

body.light.p2p-alerts-page .p2p-alert-btn-primary:disabled {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #93a4bc;
  cursor: not-allowed;
}

body.light.p2p-alerts-page .p2p-alert-fire-title .p2p-ex-link {
  color: #1d4ed8;
  border-bottom-color: rgba(29, 78, 216, 0.3);
}

body.light.p2p-alerts-page .p2p-alert-fire-title .p2p-ex-link:hover,
body.light.p2p-alerts-page .p2p-alert-fire-title .p2p-ex-link:focus {
  color: #1e40af;
  border-bottom-color: rgba(30, 64, 175, 0.38);
}

@media (max-width: 1199.98px) {
  .p2p-toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .p2p-alert-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .p2p-alert-field-wide,
  .p2p-alert-field-op {
    grid-column: span 2;
  }
  .p2p-alert-columns {
    grid-template-columns: 1fr;
  }
  .p2p-alert-fired-list {
    max-height: 360px;
  }
  .p2p-field-amount {
    grid-column: auto;
  }
}

@media (max-width: 991.98px) {
  .p2p-mode-main {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .p2p-mode-switch {
    width: 100%;
    min-width: 0;
  }
  .p2p-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .p2p-alerts-head,
  .p2p-alert-item {
    flex-direction: column;
    align-items: stretch;
  }
  .p2p-alerts-actions,
  .p2p-alert-item-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .p2p-alert-permission-stack {
    width: 100%;
    align-items: stretch;
  }
  .p2p-alert-permission-row {
    width: 100%;
    justify-content: space-between;
  }
  .p2p-alert-permission-help {
    width: 100%;
  }
  .p2p-alert-item-main,
  .p2p-alert-item-title,
  .p2p-alert-item-meta {
    width: 100%;
    max-width: 100%;
  }
  .p2p-alert-item-title {
    overflow-wrap: anywhere;
  }
  .p2p-alert-item-meta {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .p2p-alert-item-actions {
    display: flex;
    flex-wrap: wrap;
  }
  .p2p-alert-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .p2p-alert-field-wide,
  .p2p-alert-field-op {
    grid-column: span 2;
  }
  .p2p-alert-actions-row {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }
  .p2p-alert-submit-btn {
    min-width: 0;
  }
  .p2p-field-amount {
    grid-column: span 2;
  }
  .p2p-summary-grid {
    grid-template-columns: 1fr;
  }
  .p2p-history-head {
    flex-direction: column;
  }
  .p2p-history-controls {
    width: 100%;
  }
  .p2p-history-chart {
    height: 330px;
  }
  .p2p-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .p2p-page .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .p2p-hero {
    padding: 14px;
  }
  .p2p-title {
    font-size: 24px;
  }
  .p2p-toolbar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .p2p-mode-main {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .p2p-open-alerts-btn {
    width: 100%;
  }
  .p2p-alert-form {
    grid-template-columns: 1fr;
  }
  .p2p-alert-field-wide,
  .p2p-alert-field-op {
    grid-column: span 1;
  }
  .p2p-alert-op-wrap {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  .p2p-alert-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .p2p-alert-submit-btn {
    width: 100%;
  }
  .p2p-alerts-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .p2p-alert-permission-row {
    align-items: stretch;
  }
  .p2p-alert-item-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .p2p-alert-mini-check,
  .p2p-alert-mini-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
  .p2p-field select,
  .p2p-field input,
  .p2p-toggle {
    height: 34px;
    border-radius: 10px;
  }
  .p2p-price {
    font-size: 28px;
  }
  .p2p-history-controls {
    grid-template-columns: 1fr;
  }
  .p2p-history-chart {
    height: 260px;
  }
  .p2p-table th,
  .p2p-table td {
    padding: 7px 8px;
    font-size: 11px;
  }
}
