/* =========================================================
   REFERRAL — register form field + plan page reward
   ========================================================= */

/* ---------- REGISTER: "Have a referral code?" ---------- */
.rf-reg {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.rf-reg.open {
  border-color: #bfd3fb;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}
.rf-reg.is-valid {
  border-color: #86d9a4;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.1);
}
.rf-reg.is-invalid {
  border-color: #f5b5b5;
}

.rf-reg-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}
.rf-reg-toggle .rf-reg-gift {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eaf1ff;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.rf-reg-toggle .rf-reg-off {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.rf-reg-toggle .rf-reg-caret {
  color: #94a3b8;
  font-size: 12px;
  transition: transform 0.2s;
}
.rf-reg.open .rf-reg-caret {
  transform: rotate(180deg);
}

.rf-reg-body {
  padding: 14px;
  border-top: 1px solid #eef2f7;
}
.rf-reg-body[hidden] {
  display: none;
}
.rf-reg-row {
  display: flex;
  gap: 10px;
}
.rf-reg-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 14px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #1e3a8a;
  outline: none;
  background: #fff;
}
.rf-reg-row input::placeholder {
  font-family: inherit;
  letter-spacing: 0;
  font-weight: 400;
  text-transform: none;
  color: #94a3b8;
}
.rf-reg-row input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.rf-reg-row button {
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.rf-reg-row button:hover {
  background: #1d4ed8;
}
.rf-reg-row button:disabled {
  opacity: 0.7;
  cursor: default;
}

.rf-reg-msg {
  display: none;
  margin-top: 10px;
  font-size: 13px;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.45;
}
.rf-reg-msg.ok {
  display: flex;
  gap: 10px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.rf-reg-msg.err {
  display: flex;
  gap: 10px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.rf-reg-msg i {
  margin-top: 2px;
}
.rf-reg-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #64748b;
}

/* ---------- PLAN PAGE: reward ribbon + price ---------- */
.rf-reward {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 4px 0 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  border: 1px solid #bbf7d0;
}
.rf-reward-ic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #16a34a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rf-reward strong {
  display: block;
  font-size: 14px;
  color: #14532d;
}
.rf-reward span {
  font-size: 12.5px;
  color: #3f6212;
}
.rf-was {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 15px;
  color: #94a3b8;
}
.rf-was s {
  text-decoration-thickness: 2px;
}
.rf-was b {
  font-size: 11px;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 999px;
}
.rf-save {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
}
.rf-save i {
  margin-right: 4px;
}

@media (max-width: 480px) {
  .rf-reg-row {
    flex-direction: column;
  }
  .rf-reg-row button {
    width: 100%;
  }
  .rf-reg-toggle .rf-reg-off {
    display: none;
  }
}

/* =========================================================
   REFER & EARN POPUP (dashboard)
   ========================================================= */
body.rfm-open {
  overflow: hidden;
}

.rfm,
.rfm * {
  box-sizing: border-box;
}
.rfm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.rfm[hidden] {
  display: none;
}
.rfm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: rfmFade 0.2s ease;
}

.rfm__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.35);
  outline: none;
  animation: rfmPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes rfmFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes rfmPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rfm__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.rfm__close:hover {
  background: rgba(255, 255, 255, 0.35);
}
.rfm__close:focus-visible,
.rfm__btn:focus-visible,
.rfm__chan:focus-visible,
.rfm__offer:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

/* hero */
.rfm__hero {
  position: relative;
  padding: 30px 28px 26px;
  text-align: center;
  color: #fff;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
}
.rfm__hero::before,
.rfm__hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.rfm__hero::before {
  width: 180px;
  height: 180px;
  top: -70px;
  left: -50px;
}
.rfm__hero::after {
  width: 140px;
  height: 140px;
  bottom: -60px;
  right: -30px;
}
.rfm__hero > * {
  position: relative;
  z-index: 1;
}
.rfm__hero-icon {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 27px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.rfm__title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #fff;
}
.rfm__sub {
  margin: 0 auto;
  max-width: 370px;
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
}
.rfm__sub strong {
  color: #fff;
  font-weight: 800;
}

/* body */
.rfm__body {
  padding: 20px 24px 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rfm__label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #94a3b8;
}

.rfm__offer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 13px;
  background: linear-gradient(110deg, #f0fdf4, #f4f8ff);
  text-decoration: none;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.rfm__offer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.14);
}
.rfm__offer-ic {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: #16a34a;
  color: #fff;
}
.rfm__offer-txt {
  flex: 1;
  min-width: 0;
}
.rfm__offer-txt strong {
  display: block;
  font-size: 13.5px;
  color: #14532d;
}
.rfm__offer-txt small {
  font-size: 12px;
  color: #3f6212;
}
.rfm__offer-cta {
  font-size: 12.5px;
  font-weight: 800;
  color: #15803d;
  white-space: nowrap;
}

.rfm__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rfm__stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #e8edf6;
  border-radius: 14px;
  background: #fafbfe;
}
.rfm__stat-ic {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  font-size: 16px;
}
.rfm__stat-ic.blue {
  background: #eaf1ff;
  color: #2563eb;
}
.rfm__stat-ic.amber {
  background: #fff4d6;
  color: #d97706;
}
.rfm__stat strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.rfm__stat span {
  font-size: 12px;
  color: #64748b;
}

.rfm__code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0px 0px 0px 16px;
  border: 1.5px dashed #b6c8f5;
  border-radius: 13px;
  background: #f5f8ff;
}
.rfm__code-val {
  font:
    800 19px/1.2 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  letter-spacing: 2px;
  color: #1e3a8a;
  user-select: all;
  word-break: break-all;
}

.rfm__linkrow {
  display: flex;
  gap: 8px;
}
.rfm__link {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #f8fafc;
  color: #475569;
  font-size: 12.5px;
  outline: none;
  text-overflow: ellipsis;
}
.rfm__link:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.rfm__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s;
}
.rfm__btn--soft {
  background: #2563eb;
  color: #fff;
}
.rfm__btn--soft:hover {
  background: #1d4ed8;
}
.rfm__btn.is-done {
  background: #16a34a;
  color: #fff;
}

.rfm__share {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}
.rfm__chan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid #e8edf6;
  border-radius: 12px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    border-color 0.15s;
}
.rfm__chan[hidden] {
  display: none;
}
.rfm__chan i {
  font-size: 22px;
}
.rfm__chan:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
  color: #0f172a;
}
.rfm__chan.wa i {
  color: #25d366;
}
.rfm__chan.wa:hover {
  border-color: #25d366;
}
.rfm__chan.tg i {
  color: #229ed9;
}
.rfm__chan.tg:hover {
  border-color: #229ed9;
}
.rfm__chan.ml i {
  color: #ea4335;
}
.rfm__chan.ml:hover {
  border-color: #ea4335;
}
.rfm__chan.more i {
  color: #2563eb;
}
.rfm__chan.more:hover {
  border-color: #2563eb;
}

.rfm__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rfm__steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}
.rfm__steps b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  background: #eaf1ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.rfm__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  padding: 13px 20px 16px;
  border-top: 1px solid #eef2f7;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 520px) {
  .rfm {
    align-items: flex-end;
    padding: 0;
  }
  .rfm__dialog {
    max-width: none;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    animation: rfmSheet 0.3s ease;
  }
  .rfm__hero {
    border-radius: 22px 22px 0 0;
    padding: 26px 20px 22px;
  }
  .rfm__body {
    padding: 18px 18px 4px;
  }
  .rfm__code-val {
    font-size: 17px;
    letter-spacing: 1.4px;
  }
}
@keyframes rfmSheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rfm__dialog,
  .rfm__backdrop {
    animation: none;
  }
}
