/* Referrals panel — match templates/referrals.html inside account card */

body.referral-panel-open > a.close {
  display: none;
}

.card.referral-mode {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  width: auto !important;
  display: flex !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: none !important;
}

.card.referral-mode #card-content {
  width: 100% !important;
  max-width: 960px !important;
}

body.referral-panel-open .container {
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 24px;
}

@media (max-width: 900px) {
  body.referral-panel-open .container {
    flex-wrap: wrap;
    gap: 14px;
  }

  body.referral-panel-open .container .sidebar {
    width: 100%;
    flex-basis: 100%;
  }

  .card.referral-mode {
    width: 100% !important;
  }
}

#referral-section {
  --ref-stroke: #223449;
  --ref-muted: #96a5b8;
  --ref-blue: #f5b52e;
  --ref-blue2: #ffe08a;
  position: relative !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 28px 26px 26px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  color: #f6f8fb !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
  background:
    radial-gradient(circle at 72% 7%, rgba(59, 130, 246, 0.16), transparent 30%),
    radial-gradient(circle at 6% 0%, rgba(96, 165, 250, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(12, 25, 41, 0.94), rgba(7, 17, 30, 0.97)) !important;
  box-shadow: none !important;
}

#referral-section::before,
#referral-section::after {
  display: none !important;
  content: none !important;
}

#referral-section .ref-panel-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ref-stroke);
  color: #b8c3d0;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: 0.18s ease;
}

#referral-section .ref-panel-close:hover {
  border-color: var(--ref-blue);
  color: #fff;
  background: rgba(59, 130, 246, 0.1);
}

#referral-section .ref-panel-close svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
}

#referral-section .ref-hero {
  position: relative;
  z-index: 1;
  min-height: 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
  margin: 0 54px 28px 0;
}

#referral-section .ref-hero-left {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

#referral-section .ref-hero-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(20, 65, 130, 0.18));
  color: var(--ref-blue);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#referral-section .ref-hero-icon svg {
  width: 40px;
  height: 40px;
  stroke: currentColor;
  stroke-width: 1.85;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#referral-section .ref-hero h1 {
  margin: 6px 0 10px;
  padding: 0;
  text-align: left;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: #fff;
}

#referral-section .ref-hero p {
  margin: 0;
  color: var(--ref-muted);
  font-size: 16px;
  line-height: 1.45;
}

#referral-section .ref-hero-visual {
  min-height: 140px;
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 16px;
  background:
    radial-gradient(circle at 25% 70%, rgba(59, 130, 246, 0.5), transparent 16%),
    radial-gradient(circle at 88% 72%, rgba(59, 130, 246, 0.22), transparent 26%),
    linear-gradient(135deg, rgba(10, 26, 47, 0.82), rgba(7, 17, 30, 0.38));
  transform: rotate(-4deg);
  position: relative;
  overflow: hidden;
  opacity: 0.9;
}

#referral-section .ref-hero-visual svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--ref-blue);
  opacity: 0.86;
}

#referral-section .ref-block {
  position: relative;
  z-index: 1;
  margin-bottom: 26px;
}

#referral-section .ref-block-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  text-align: left;
  font-size: 20px;
  font-weight: 780;
  letter-spacing: -0.02em;
  color: #fff;
}

#referral-section .ref-info-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: var(--ref-muted);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

#referral-section .ref-how-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

#referral-section .ref-how-card {
  min-height: 120px;
  border: 1px solid var(--ref-stroke);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(13, 28, 46, 0.9), rgba(8, 18, 31, 0.86));
  padding: 20px 18px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

#referral-section .ref-how-icon,
#referral-section .ref-metric-icon,
#referral-section .ref-commission-icon,
#referral-section .ref-code-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.13);
  color: var(--ref-blue);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.17);
}

#referral-section .ref-how-icon svg,
#referral-section .ref-metric-icon svg,
#referral-section .ref-code-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#referral-section .ref-how-card p {
  margin: 0;
  color: #f3f7fc;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 650;
}

#referral-section .ref-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0 26px;
  position: relative;
  z-index: 1;
}

#referral-section .ref-commission-row {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr);
  gap: 16px;
}

#referral-section .ref-commission-card,
#referral-section .ref-metrics-card,
#referral-section .ref-code-card {
  border: 1px solid var(--ref-stroke);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(13, 28, 46, 0.9), rgba(8, 18, 31, 0.86));
  padding: 22px 20px;
}

#referral-section .ref-commission-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

#referral-section .ref-commission-icon {
  width: 64px;
  height: 64px;
  font-size: 28px;
  font-weight: 900;
  color: var(--ref-blue);
}

#referral-section .ref-commission-icon span {
  font-size: 32px;
  line-height: 1;
}

#referral-section .ref-commission-card strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 750;
}

#referral-section .ref-commission-card p {
  margin: 0;
  color: var(--ref-muted);
  font-size: 14px;
  line-height: 1.5;
}

#referral-section .ref-metrics-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 18px 12px;
}

#referral-section .ref-metric {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.11);
}

#referral-section .ref-metric:last-child {
  border-right: 0;
}

#referral-section .ref-metric-icon {
  width: 46px;
  height: 46px;
}

#referral-section .ref-metric b {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
}

#referral-section .ref-metric span {
  display: block;
  color: #f3f7fc;
  font-size: 14px;
}

#referral-section .ref-metric small {
  display: block;
  color: var(--ref-muted);
  font-size: 12px;
}

#referral-section .ref-code-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(180px, 280px);
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
}

#referral-section .ref-code-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 1px dashed rgba(96, 165, 250, 0.38);
  background: rgba(59, 130, 246, 0.055);
}

#referral-section .ref-code-value {
  min-width: 0;
}

#referral-section .referral-code {
  display: block;
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #fff;
  font-family: inherit;
}

#referral-section .ref-code-hint {
  display: block;
  color: var(--ref-muted);
  margin-top: 6px;
  font-size: 14px;
}

#referral-section .ref-copy-btn {
  height: 54px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #d98e12, #e8a020);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 16px 40px rgba(59, 130, 246, 0.24);
  transition: 0.18s ease;
  width: 100%;
}

#referral-section .ref-copy-btn:hover {
  filter: brightness(1.08);
}

#referral-section .ref-copy-btn.copied {
  background: rgba(34, 197, 94, 0.1);
  color: #dfffe7;
  border: 1px solid rgba(34, 197, 94, 0.45);
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.12);
}

#referral-section .ref-copy-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

#referral-section .ref-copied {
  margin-top: 10px;
  text-align: center;
  color: #8bdc5a;
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  transform: translateY(-4px);
  transition: 0.2s ease;
}

#referral-section .ref-copied.show {
  opacity: 1;
  transform: translateY(0);
}

#referral-section .ref-footer-note {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ref-muted);
  font-size: 14px;
  line-height: 1.45;
  margin-top: 16px;
}

#referral-section .ref-footer-note svg {
  width: 22px;
  height: 22px;
  stroke: var(--ref-muted);
  stroke-width: 1.8;
  fill: none;
  flex: 0 0 auto;
  margin-top: 1px;
}

@media (max-width: 1100px) {
  #referral-section .ref-hero {
    grid-template-columns: 1fr;
    margin-right: 54px;
  }

  #referral-section .ref-hero-visual {
    display: none;
  }

  #referral-section .ref-how-grid,
  #referral-section .ref-commission-row {
    grid-template-columns: 1fr;
  }

  #referral-section .ref-code-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  #referral-section .ref-copy-btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  #referral-section {
    padding: 18px 14px 22px !important;
    border-radius: 14px !important;
  }

  #referral-section .ref-panel-close {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
  }

  #referral-section .ref-hero {
    margin: 0 48px 20px 0;
  }

  #referral-section .ref-hero-left {
    gap: 12px;
  }

  #referral-section .ref-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }

  #referral-section .ref-hero-icon svg {
    width: 30px;
    height: 30px;
  }

  #referral-section .ref-hero h1 {
    font-size: 26px;
    margin-top: 2px;
  }

  #referral-section .ref-hero p {
    font-size: 14px;
  }

  #referral-section .ref-how-card {
    grid-template-columns: 48px 1fr;
    min-height: 96px;
    padding: 14px;
  }

  #referral-section .ref-how-card p {
    font-size: 14px;
  }

  #referral-section .ref-commission-card {
    grid-template-columns: 1fr;
  }

  #referral-section .ref-metrics-card {
    grid-template-columns: 1fr;
  }

  #referral-section .ref-metric {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 96px;
  }

  #referral-section .ref-metric:last-child {
    border-bottom: 0;
  }

  #referral-section .ref-code-card {
    grid-template-columns: 1fr;
  }

  #referral-section .referral-code {
    font-size: 24px;
  }

  #referral-section .ref-block-title {
    font-size: 18px;
  }
}
