#profile-modal {
  background: rgba(18, 27, 43, 0.38) !important;
  backdrop-filter: blur(8px) !important;
}

#profile-modal .profile-card {
  width: min(780px, calc(100vw - 28px)) !important;
  max-height: calc(100vh - 24px) !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid #dce5f2 !important;
  border-radius: 16px !important;
  color: #1c2940 !important;
  background: #fff !important;
  box-shadow: 0 24px 70px rgba(27, 42, 67, 0.2) !important;
}

#profile-modal .profile-center-head {
  display: grid !important;
  grid-template-columns: 58px minmax(0, 1fr) 36px !important;
  gap: 14px !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 24px 26px 20px !important;
  border: 0 !important;
  background: #fff !important;
}

#profile-modal .profile-avatar-edit,
#profile-modal .profile-avatar-edit span {
  width: 58px !important;
  height: 58px !important;
  min-height: 58px !important;
  border: 0 !important;
  border-radius: 10px !important;
  color: #fff !important;
  background: #1769e8 !important;
}

#profile-modal .profile-avatar-edit em {
  right: -3px !important;
  bottom: -4px !important;
  height: 19px !important;
  padding: 0 6px !important;
  border: 2px solid #fff !important;
  border-radius: 10px !important;
  color: #1769e8 !important;
  background: #eaf2ff !important;
  font-size: 9px !important;
}

#profile-modal .profile-center-head > div > span {
  display: block !important;
  margin: 0 0 3px !important;
  color: #16766f !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

#profile-modal .profile-center-head h2 {
  margin: 0 !important;
  color: #172238 !important;
  font-size: 27px !important;
  line-height: 1.12 !important;
}

#profile-modal .profile-center-head p {
  margin: 6px 0 0 !important;
  color: #6e7c91 !important;
  font-size: 13px !important;
}

#profile-modal .profile-header-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #526bd7;
  background: transparent;
  cursor: pointer;
}

#profile-modal .profile-header-close:hover {
  background: #eef4ff;
}

#profile-modal .profile-header-close .lucide {
  width: 23px;
  height: 23px;
}

#profile-modal .profile-center-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 14px !important;
  max-height: calc(100vh - 175px) !important;
  padding: 0 26px 6px !important;
  overflow: auto !important;
}

#profile-modal .profile-panel,
#profile-modal .profile-stat-grid {
  padding: 16px !important;
  border: 1px solid #dce5f2 !important;
  border-radius: 8px !important;
  background: #fff !important;
  box-shadow: none !important;
}

#profile-modal .profile-account-compact,
#profile-modal .profile-stat-grid,
#profile-modal .profile-invite-combined,
#profile-modal .profile-service-panel,
#profile-modal #profile-message {
  grid-column: 1 / -1 !important;
  width: auto !important;
}

#profile-modal .profile-panel-title {
  margin-bottom: 12px !important;
}

#profile-modal .profile-panel-title strong {
  color: #1d2a40 !important;
  font-size: 14px !important;
}

#profile-modal .profile-form-compact {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 9px !important;
}

#profile-modal .profile-form-compact label {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: center !important;
  height: 46px !important;
  padding: 0 12px !important;
  border: 1px solid #dbe5f1 !important;
  border-radius: 7px !important;
  color: #718097 !important;
  background: #f7faff !important;
}

#profile-modal .profile-form-compact label > span {
  color: #718097 !important;
  font-size: 12px !important;
  white-space: nowrap !important;
}

#profile-modal .profile-form-compact input {
  min-width: 0 !important;
  height: 42px !important;
  padding: 0 !important;
  border: 0 !important;
  color: #1d2a40 !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  text-align: right !important;
  box-shadow: none !important;
}

#profile-modal .profile-form-compact label:has(input:not([readonly]))::after {
  display: none !important;
}

#profile-modal .profile-stat-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 9px !important;
  padding: 0 !important;
  border: 0 !important;
}

#profile-modal .profile-stat-grid article {
  display: grid !important;
  grid-template-columns: 30px minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  gap: 1px 10px !important;
  align-items: center !important;
  min-height: 72px !important;
  padding: 12px 14px !important;
  border: 1px solid #d8e3f1 !important;
  border-radius: 8px !important;
  color: #21314b !important;
  background: #f7faff !important;
}

#profile-modal .profile-stat-grid article > .lucide {
  grid-row: 1 / 3 !important;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  color: #2770e7 !important;
}

#profile-modal .profile-stat-grid article span,
#profile-modal .profile-stat-grid article strong {
  display: block !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: inherit !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#profile-modal .profile-stat-grid article span {
  font-size: 11px !important;
  opacity: 0.65 !important;
}

#profile-modal .profile-stat-grid article strong {
  font-size: 14px !important;
}

#profile-modal .profile-invite-combined {
  display: grid !important;
  gap: 13px !important;
  padding: 16px !important;
}

#profile-modal .profile-invite-summary {
  display: grid !important;
  grid-template-columns: 40px minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: center !important;
}

#profile-modal .profile-promotion-icon {
  display: grid !important;
  place-items: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px !important;
  color: #fff !important;
  background: #1769e8 !important;
}

#profile-modal .profile-invite-summary strong {
  color: #1d2a40 !important;
  font-size: 14px !important;
}

#profile-modal .profile-invite-summary span {
  color: #6f7e94 !important;
  font-size: 12px !important;
}

#profile-modal .profile-invite-summary > button {
  min-height: 34px !important;
  padding: 0 12px !important;
  border: 1px solid #bdd2f4 !important;
  border-radius: 7px !important;
  color: #1761cf !important;
  background: #edf4ff !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

#profile-modal .profile-invite-binding {
  display: grid !important;
  grid-template-columns: auto auto minmax(260px, 1fr) !important;
  gap: 10px !important;
  align-items: center !important;
  padding-top: 13px !important;
  border-top: 1px solid #dfe7f2 !important;
}

#profile-modal .profile-invite-binding > span {
  color: #273750 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

#profile-modal .profile-invite-binding > small {
  color: #7b899d !important;
  font-size: 11px !important;
}

#profile-modal .profile-invite-binding .profile-inline-action {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
}

#profile-modal .profile-invite-binding input {
  height: 38px !important;
  border: 1px solid #d8e3f1 !important;
  border-radius: 7px !important;
  color: #26354e !important;
  background: #f7faff !important;
}

#profile-modal #profile-bind-invite:disabled,
#profile-modal #profile-bind-invite:disabled::placeholder {
  font-size: 12px !important;
}

#profile-modal .profile-invite-binding button {
  min-height: 38px !important;
  border: 1px solid #bdd2f4 !important;
  border-radius: 7px !important;
  color: #1761cf !important;
  background: #edf4ff !important;
}

#profile-modal .profile-service-panel {
  padding: 16px !important;
}

#profile-modal .profile-action-grid-wide {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 9px !important;
}

#profile-modal .profile-action-grid-wide button {
  min-height: 54px !important;
  border: 1px solid #d8e3f1 !important;
  border-radius: 7px !important;
  color: #2a3a54 !important;
  background: #f7faff !important;
}

#profile-modal .profile-action-grid-wide button:hover {
  color: #175fca !important;
  border-color: #b9cff0 !important;
  background: #edf4ff !important;
}

#profile-modal #profile-message {
  min-height: 0 !important;
  margin: 0 !important;
  color: #64748b !important;
  font-size: 12px !important;
  text-align: center !important;
}

#profile-modal #profile-message:empty {
  display: none !important;
}

#profile-modal .profile-actions {
  margin: 0 !important;
  padding: 15px 26px 22px !important;
  border: 0 !important;
  background: #fff !important;
}

#profile-modal .profile-actions #profile-save {
  display: inline-flex !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 18px !important;
  border: 1px solid #1769e8 !important;
  border-radius: 8px !important;
  color: #fff !important;
  background: #1769e8 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

#profile-modal .profile-actions #profile-save:hover {
  border-color: #125bc8 !important;
  background: #125bc8 !important;
}

#profile-modal .profile-actions #profile-save .lucide {
  width: 18px !important;
  height: 18px !important;
}

@media (max-width: 720px) {
  #profile-modal .profile-card {
    width: calc(100vw - 14px) !important;
    border-radius: 12px !important;
  }

  #profile-modal .profile-center-head {
    grid-template-columns: 50px minmax(0, 1fr) 34px !important;
    padding: 17px 16px 15px !important;
  }

  #profile-modal .profile-avatar-edit,
  #profile-modal .profile-avatar-edit span {
    width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
  }

  #profile-modal .profile-center-head h2 {
    font-size: 22px !important;
  }

  #profile-modal .profile-center-grid {
    max-height: calc(100vh - 155px) !important;
    padding: 0 13px 5px !important;
  }

  #profile-modal .profile-form-compact,
  #profile-modal .profile-stat-grid,
  #profile-modal .profile-action-grid-wide {
    grid-template-columns: 1fr !important;
  }

  #profile-modal .profile-invite-summary {
    grid-template-columns: 38px minmax(0, 1fr) !important;
  }

  #profile-modal .profile-invite-summary > button {
    grid-column: 1 / -1 !important;
    justify-content: center !important;
  }

  #profile-modal .profile-invite-binding {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  #profile-modal .profile-invite-binding .profile-inline-action {
    grid-column: 1 / -1 !important;
  }

  #profile-modal .profile-actions {
    padding: 12px 13px 15px !important;
  }
}

html[data-theme="dark"] #profile-modal .profile-card,
html[data-theme="dark"] #profile-modal .profile-center-head,
html[data-theme="dark"] #profile-modal .profile-actions {
  background: #111827 !important;
}

#affiliate-modal .affiliate-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

@media (max-width: 720px) {
  #affiliate-modal .affiliate-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
